|
Boost : |
From: Davlet Panech (davlet_panech_at_[hidden])
Date: 2003-11-12 14:49:05
Hello,
I have a few unit test programs that call UNIX fork().
If the child process returns into the Test Framework
code, any test cases that follow the fork()'ed one are
executed in both the parent and the child processes.
This is obviously a problem, I'd like the child
process to be independent from the rest of the test
suite. I mean, the child should exit once the current
test case is finished. Plus, the error counts related
to previous test cases should be discarded, such that
the exit status of the child process reflects its own
status only.
It would really help if the framework included a
function that (1) resets the error counts and (2) sets
some flag that prevents it from running any subsequent
test cases.
Usage Example:
-------------
void test_case1 ()
{
pid_t pid = fork ();
if (pid)
{
// (parent process);
// do the tests
// Make sure the child exited with status 0
int status;
waitpid (pid, &status, 0);
BOOST_CHECK_EQUAL (status, 0);
}
else
{
// (child process)
// Mark current test case as "final"
// and reset all error counts.
BOOST_DETACH_TESTCASE();
// do the tests
// when we return the process terminates
}
}
Your thoughts?
D.
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk