beakerlib-synchronisation (1) - Linux Manuals

beakerlib-synchronisation: synchronisation - Process synchronisation routines

NAME

BeakerLib - synchronisation - Process synchronisation routines

DESCRIPTION

This is a library of helpers for process synchronisation of applications.

NOTE: none of this commands will cause the test proper to fail, even in case of critical errors during their invocation. If you want your test to fail if those test fail, use their return codes and rlFail().

FUNCTIONS

Process Synchronisation

rlWaitForCmd

Pauses script execution until command exit status is the expeced value. Logs a WARNING and returns 1 if the command didn't exit successfully before timeout elapsed or a maximum number of invocations has been reached.

    rlWaitForCmd command [-p PID] [-t time] [-m count] [-d delay] [-r retval]
command
Command that will be executed until its return code is equal 0 or value speciefied as option to `-r'.
-t time
Timeout in seconds, default=120. If the command doesn't return 0 before time elapses, the command will be killed.
-p PID
PID of the process to check before running command. If the process exits before the socket is opened, the command will log a WARNING.
-m count
Maximum number of `command' executions before continuing anyway. Default is infite. Returns 1 if the maximum was reached.
-d delay
Delay between `command' invocations. Default 1.
-r retval
Expected return value of command. Default 0.

rlWaitForFile

Pauses script execution until specified file or directory starts existing. Returns 0 if file started existing, 1 if timeout was reached or PID exited. Return code is greater than 1 in case of error.

    rlWaitForFile path [-p PID] [-t time] [-d delay]
path
Path to file that should start existing.
-t time
Timeout in seconds (optional, default=120). If the file isn't opened before the time elapses the command returns 1.
-p PID
PID of the process that should also be running. If the process exits before the file is created, the command returns with status code of 1.
-d delay
Delay between subsequent checks for existence of file. Default 1.

rlWaitForSocket

Pauses script execution until socket starts listening. Returns 0 if socket started listening, 1 if timeout was reached or PID exited. Return code is greater than 1 in case of error.

    rlWaitForSocket {port|path} [-p PID] [-t time] [-d delay] [--close]
port|path
Network port to wait for opening or a path to UNIX socket. Regular expressions are also supported.
-t time
Timeout in seconds (optional, default=120). If the socket isn't opened before the time elapses the command returns 1.
-p PID
PID of the process that should also be running. If the process exits before the socket is opened, the command returns with status code of 1.
-d delay
Delay between subsequent checks for availability of socket. Default 1.
--close
Wait for the socket to stop listening.

rlWait

Wrapper around bash builtin `wait' command. See bash_builtins(1) man page. Kills the process and all its children if the timeout elapses.

    rlWaitFor [n ...] [-s SIGNAL] [-t time]
n
List of PIDs to wait for. They need to be background tasks of current shell. See bash_builtins(1) section for `wait' command/
-t time
Timeout in seconds (optional, default=30). If the wait isn't successful before the time elapses then all specified tasks are killed.
-s SIGNAL
Signal used to kill the process, optional SIGTERM by default.

AUTHORS

Hubert Kario <hkario [at] redhat.com>