Trees | Indices | Help |
|
---|
|
object --+ | ProcessUser
Class providing basic operations over interacting with processes.
The ProcessUser class provides the minimum set of operations for
managing and interacting with processes. The class is designed to be
extended by the pysys.baserunner.BaseRunner and pysys.basetest.BaseTest classes so that they prescribe a
common set of process operations that any child test can use. Process
operations have associated potential outcomes in their execution, e.g.
BLOCKED
, TIMEDOUT
, DUMPEDCORE
etc.
As such the class additionally acts as the container for storing the list
of outcomes from all child test related actions.
|
|||
|
|||
|
|||
integer |
|
||
tuple |
|
||
handle |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
integer |
|
||
string |
|
||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
Default constructor.
|
Return the number of processes started within the testcase matching the supplied displayName. The ProcessUser class maintains a reference count of processes started within the class instance via the startProcess() method. The reference count is maintained against a logical name for the process, which is the displayName used in the method call to startProcess(), or the basename of the command if no displayName was supplied. The method returns the number of processes started with the supplied logical name, or 0 if no processes have been started.
Deprecated: The recommended way to allocate unique names is now allocateUniqueStdOutErr |
Allocate filenames of the form processKey[.n].out (similarly for .err).
|
Start a process running in the foreground or background, and return the process handle. The method allows spawning of new processes in a platform independent
way. The command, arguments, environment and working directory to run the
process in can all be specified in the arguments to the method, along
with the filenames used for capturing the stdout and stderr of the
process. Processes may be started in the
|
Send a soft or hard kill to a running process to stop its execution. This method uses the pysys.process.helper module to stop a running process.
Should the request to stop the running process fail, a
|
Send a signal to a running process (Unix only). This method uses the pysys.process.helper module to send a signal to a
running process. Should the request to send the signal to the running
process fail, a
|
Wait for a background process to terminate, return on termination or expiry of the timeout. Timeouts will result in an exception unless the project property defaultAbortOnError=False.
|
Write data to the stdin of a process. This method uses the pysys.process.helper module to write a data string to the stdin of a process. This wrapper around the write method of the process helper only adds checking of the process running status prior to the write being performed, and logging to the testcase run log to detail the write.
|
Wait for a socket connection to be established. This method blocks until connection to a particular host:port pair can be established. This is useful for test timing where a component under test creates a socket for client server interaction - calling of this method ensures that on return of the method call the server process is running and a client is able to create connections to it. If a connection cannot be made within the specified timeout interval, the method returns to the caller.
|
Wait for a file to exist on disk. This method blocks until a file is created on disk. This is useful for test timing where a component under test creates a file (e.g. for logging) indicating it has performed all initialisation actions and is ready for the test execution steps. If a file is not created on disk within the specified timeout interval, the method returns to the caller.
|
Wait for a particular regular expression to be seen on a set number of lines in a text file. This method blocks until a particular regular expression is seen in a
text file on a set number of lines. The number of lines which should
match the regular expression is given by the
|
Registers a zero-arg function that will be called as part of the cleanup of this object. Cleanup functions are invoked in reverse order with the most recently added first (LIFO), and before the automatic termination of any remaining processes associated with this object. e.g. self.addCleanupFunction(lambda: self.cleanlyShutdownProcessX(params)) |
Cleanup function that frees resources managed by this object. Should be called exactly once when this object is no longer needed. Instead of overriding this function, use addCleanupFunction. |
Add a validation outcome (and optionally a reason string) to the validation list. The method provides the ability to add a validation outcome to the internal data structure storing the list of validation outcomes. Multiple validations may be performed, the current supported validation outcomes of which are: SKIPPED: An execution/validation step of the test was skipped (e.g. deliberately) BLOCKED: An execution/validation step of the test could not be run (e.g. a missing resource) DUMPEDCORE: A process started by the test produced a core file (unix only) TIMEDOUT: An execution/validation step of the test timed out (e.g. process deadlock) FAILED: A validation step of the test failed NOTVERIFIED: No validation steps were performed INSPECT: A validation step of the test requires manual inspection PASSED: A validation step of the test passed The outcomes are considered to have a precedence order, as defined by
the order of the outcomes listed above. Thus a
|
Raise an AbortException.
|
Get the overall outcome based on the precedence order. The method returns the overall outcome of the test based on the
outcomes stored in the internal data structure. The precedence order of
the possible outcomes is used to determined the overall outcome of the
test, e.g. if The method returns the integer value of the outcome as defined in pysys.constants. To
convert this to a string representation use the
|
Get the reason string for the current overall outcome (if specified).
|
Private method to check if a file is that for a particular class.
|
Logs some or all the lines in the specified file. If the file does not exist or cannot be opened, does nothing. This method is useful for providing key diagnostic information (e.g. error messages from tools executed by the test) directly in run.log, to make test failures easier to triage quickly.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Mar 07 19:45:25 2018 | http://epydoc.sourceforge.net |