Ticket #12 (new enhancement)

Opened 9 months ago

Last modified 4 months ago

Add parallel processing of tests to speed execution

Reported by: tswicegood Owned by: tswicegood
Priority: major Milestone: Google Summer of Code
Component: PHPT_Core Version:
Keywords: Cc:
Blocking: Blocked By:

Description (last modified by tswicegood) (diff)

Executing each test sequentially requires that all setup and teardown of the process be included in the test time. Allowing tests to be run in parallel processes should speed up the execution of tests by allowing more of the system to be utilized at any one point. This is especially true of tests that by necessity must sleep for a period of time to test time-dependent code.

Change History

Changed 9 months ago by tswicegood

  • description modified (diff)

One solution to this is to utilize [php.net/socket-create-pair socket_create_pair()] to allow for interprocess communication (IPC) to occur between the test cases. The obvious place for this fork to happen is within the PHPT_Suite::run() method. This would require refactoring the actual run into a PHPT_Suite_Runner object so it could be replaced.

The idea is that Suite::run() would fork prior to calling Case::run() on each case. The Case would be passed a specialized reporter that would send back a serialized result that Suite would watch for, and once found would send back to the Reporter at the current process so it can handle reporting out.

Another option is to create a Reporter on an independent process - then have all Case's send messages to it via a Reporter_Stream object. It would need to be able to create some sort of Proxy object that could be passed in to it. Something like:

<?php
$reporter = new PHPT_Reporter_Stream();
$case->run($reporter->getReporterProxy());
// getReporterProxy() returns instance of PHPT_Reporter_Stream_Proxy

This still requires a new Suite_Runner object, however, in order to separate the various paths of execution for running a suite (sequential, parallel, networked - if added, etc.).

Changed 7 months ago by tswicegood

  • milestone set to PHPT_Core 0.3

Changed 4 months ago by tswicegood

  • milestone changed from PHPT_Core 0.3 to Google Summer of Code

This may become part of the Google Summer of Code project after making the php-src tests run.

Note: See TracTickets for help on using tickets.