This class schedules the tests across one or more targets.
The shedule is determined dynamically as the tests are executed
based on which targets are idle and which are not. Therefore, the
testing load should be reasonably well balanced, even across a
heterogeneous network of testing machines.
Methods
|
|
|
|
AddInputHandler
|
AddInputHandler (
self,
fd,
function,
)
Add an input handler for fd .
-
fd
- A file descriptor, open for reading.
-
function
- A callable object taking a single parameter.
The execution engine will periodically monitor fd . When input
is available, it will call function passing it fd .
|
|
RequestTermination
|
RequestTermination ( self )
Request that the execution engine stop executing tests.
Request that the execution thread be terminated. Termination
may take some time; tests that are already running will continue
to run, for example.
|
|
Run
|
Run ( self )
Run the tests.
This method runs the tests specified in the __init__
function.
- returns
- True if any tests had unexpected outcomes.
|
|
_IsTerminationRequested
|
_IsTerminationRequested ( self )
Returns true if termination has been requested.
- returns
- True if no further tests should be executed. If the
value is -1, the execution engine should simply terminate
gracefully.
|
|
_RunTests
|
_RunTests ( self )
Exceptions
|
|
TerminationRequested, "Termination requested."
|
|
|
_Trace
|
_Trace ( self, message )
Write a trace message .
-
message
- A string to be output as a trace message.
|
|
_WriteInitialAnnotations
|
_WriteInitialAnnotations ( self )
|
|
__AddResult
|
__AddResult ( self, result )
Report the result of running a test or resource.
-
result
- A
Result object representing the result of running
a test or resource.
|
|
__AddTestToStack
|
__AddTestToStack ( self, test_id )
Adds test_id to the stack of current tests.
- returns
- True if the test was added to the stack; false if the
test could not be loaded. In the latter case, an
UNTESTED
result is recorded for the test.
|
|
__AddToTargetPatternQueue
|
__AddToTargetPatternQueue ( self, descriptor )
A a test to the appropriate target pattern queue.
-
descriptor
- A
TestDescriptor .
Adds the test to the target pattern queue indicated in the
descriptor.
|
|
__AddUntestedResult
|
__AddUntestedResult (
self,
test_name,
cause,
annotations={},
exc_info=None,
)
Add a Result indicating that test_name was not run.
-
test_name
- The label for the test that could not be run.
-
cause
- A string explaining why the test could not be run.
-
annotations
- A map from strings to strings giving
additional annotations for the result.
-
exc_info
- If this test could not be tested due to a thrown
exception,
exc_info is the result of sys.exc_info() when the
exception was caught. None otherwise.
|
|
__CheckForResponse
|
__CheckForResponse ( self, wait )
See if any of the targets have completed a task.
-
wait
- If false, this function returns immediately if there
is no available response. If
wait is true, this function
continues to wait until a response is available.
- returns
- True iff a response was received.
|
|
__FeedTarget
|
__FeedTarget ( self, target )
Run a test on target
-
target
- The
Target on which the test should be run.
- returns
- True, iff a test could be found to run on
target .
False otherwise.
|
|
__FindRunnableTest
|
__FindRunnableTest ( self, target )
Return a test that is ready to run.
-
target
- The
Target on which the test will run.
- returns
- the
TestDescriptor for the next available ready
test, or None if no test could be found that will run on
target .
If a test with unsatisfied prerequisites is encountered, the
test will be pushed on the stack and the prerequisites processed
recursively.
|
|
__GetPendingPrerequisites
|
__GetPendingPrerequisites ( self, descriptor )
Return pending prerequisite tests for descriptor .
-
descriptor
- A
TestDescriptor .
- returns
- A list of prerequisite test ids that have to
complete, or
None if one of the prerequisites had an
unexpected outcome.
|
|
__GetTestDescriptor
|
__GetTestDescriptor ( self, test_id )
Return the TestDescriptor for test_id .
- returns
- The
TestDescriptor for test_id , or None if the
descriptor could not be loaded.
If the database cannot load the descriptor, an UNTESTED result
is recorded for test_id .
|
|
__init__
|
__init__ (
self,
database,
test_ids,
context,
targets,
result_streams=None,
expectations=None,
)
Set up a test run.
-
database
- The
Database containing the tests that will be
run.
-
test_ids
- A sequence of IDs of tests to run. Where
possible, the tests are started in the order specified.
-
context
- The context object to use when running tests.
-
targets
- A sequence of
Target objects, representing
targets on which tests may be run.
-
result_streams
- A sequence of
ResultStream objects. Each
stream will be provided with results as they are available.
-
expectations
- If not
None , a dictionary mapping test IDs
to expected outcomes.
|