Functions | |
proc | test_format (kind, cmd, result) |
proc | compare (reflist, result) |
proc | ser_init (args) |
proc | par_init (args) |
proc | run_return (cmd, retval) |
proc | run_error (cmd, errormsg) |
proc | par_return (cmd, retval, comm=tclmpi::comm_world) |
proc | par_error (cmd, retval, comm=tclmpi::comm_world) |
proc | test_summary (section) |
Variables | |
set | version |
version of the package | |
variable | comm = tclmpi::comm_world |
shortcut for world communicator | |
variable | master = 0 |
rank of MPI master process | |
variable | rank = 0 |
rank of this MPI process on $comm | |
variable | size = 1 |
number of processes on $comm | |
variable | int = tclmpi::int |
shortcut for tclmpi::int data type | |
variable | intint = tclmpi::intint |
shortcut for tclmpi::intint data type | |
variable | maxloc = tclmpi::maxloc |
shortcut for tclmpi::maxloc operator | |
variable | minloc = tclmpi::minloc |
shortcut for tclmpi::minloc operator | |
variable | pass = 0 |
counter for successful tests | |
variable | fail = 0 |
counter for failed tests | |
TclMPI test harness implementation namespace
This namespace contains several Tcl procedures that are used to conduct unit tests on the TclMPI package. For simplicity paths are hardcoded, so that this file must not be moved around and stay in the same directory as the individual tests, which in turn have to be in a subdirectory of the directory where the TclMPI shared object and/or the tclmpish extended Tcl shell reside.
proc tclmpi_test::compare | ( | reflist | , |
result | |||
) |
partial result and error message comparison
reflist | list of strings that have to appear in the result |
result | result string |
This function does an inexact comparison of the reference data to the actual result. The reference is a list of strings, each of which has to be matched in a case insensitive string search. The function returns a 1 if all tests did match.
proc tclmpi_test::par_error | ( | cmd | , |
retval | , | ||
comm | = tclmpi::comm_world |
||
) |
run a parallel test that is expected to produce a Tcl error
cmd | list of strings or lists with the commands to execute |
retval | list of the expected error message(s) or return values |
comm | communicator. defaults to world communicator |
This function executes the lists command lines passed in $cmd in parallel each command taken from the list based on the rank of the individual MPI task on the communicator and intercepts its resulting error message or return value using the 'catch' command. It is then checked if one of the commands failed as expected and actual return value are then compared against the expected reference passed in the $retval list with similar assignments to the individual ranks as the commands. If one of the strings does not match or all command unexpectedly succeeded failure is reported otherwise success.
proc tclmpi_test::par_init | ( | args | ) |
init for parallel tests
args | all parameters are ignored |
This function will perform an initialization of the parallel environment for subsequent parallel tests. It also initializes the global variables $rank and $size.
proc tclmpi_test::par_return | ( | cmd | , |
retval | , | ||
comm | = tclmpi::comm_world |
||
) |
run a parallel test that is expected to succeed
cmd | list of strings or lists with the commands to execute |
retval | list of the expected return values |
comm | communicator. defaults to world communicator |
This function executes the lists command lines passed in $cmd in parallel each command taken from the list based on the rank of the individual MPI task on the communicator and intercepts its resulting return value using the 'catch' command. The actual return value is then compared against the expected reference passed in the $retval list, similarly assigned to the individual ranks as the commands. The result is compared on all ranks and if one of the commands failed or the actual return value is not equal to the expected one, failure is reported and both, expected and and actual results are printed on one of the failing ranks. The error reporting expects that the MPI communicator remains usable after failure.
proc tclmpi_test::run_error | ( | cmd | , |
errormsg | |||
) |
run a serial test that is expected to fail
cmd | string or list with the command to execute |
errormsg | expected error message contents |
This function executes the command line passed in $cmd and intercepts its resulting error using the 'catch' command. The actual error message is then compared against the expected reference passed in $errormsg. The test is passed if the two strings match, otherwise failure is reported and both the expected and actual error messages are printed. Also an unexpectedly successful execution is considered a failure and its result reported for reference.
proc tclmpi_test::run_return | ( | cmd | , |
retval | |||
) |
run a serial test that is expected to succeed
cmd | string or list with the command to execute |
retval | expected return value contents |
This function executes the command line passed in $cmd and intercepts its resulting return value using the 'catch' command. The actual return value is then compared against the expected reference passed in $retval. The test is passed if the two strings match, otherwise failure is reported and both the expected and actual results are printed. Also an unexpectedly failure of the command is reported as failure and the resulting error message is reported for debugging.
proc tclmpi_test::ser_init | ( | args | ) |
init for serial tests
args | all parameters are ignored |
This function will perform a simple init test requesting the tclmpi package and matching it against the current verison number. It will also initialize some commonly used global variables. If called from a parallel environment, it will only execute and produce output on the master process
proc tclmpi_test::test_format | ( | kind | , |
cmd | , | ||
result | |||
) |
format output
kind | string representing the kind of test (max 11 chars). |
cmd | string representing the command. will be truncated as needed. |
result | string indicating the result (PASS or FAIL/reason) |
This function will format a test summary message, so that it does not break the output on a regular terminal screen. The first column will be the total number of the test computed from the sum of passed and failed tests, followed by a string describing the test type, the command executed and a result string. The command string in the middle will be truncated as needed to not break the format.
proc tclmpi_test::test_summary | ( | section | ) |
print result summary
section | number of the test section |
This function will print a nicely formatted summary of the tests. If executed in parallel only the master rank of the world communicator will produce output.