CPPUNIT_TEST_SUITE_END();
+ pid_t child_pid;
+
public:
void setUp()
- {
-}
+ { }
void tearDown()
- { }
+ {
+ // make sure the server-child is dead before the next test runs
+ kill(child_pid,SIGKILL);
+ sleep(1);
+ }
void SimpleCmd()
{
- pid_t pid;
-
- switch(pid=fork())
+ switch(child_pid=fork())
{
case -1:
{
CPPUNIT_ASSERT_EQUAL(string("hello, testfunc() was here"),ret);
}
}
- kill(pid,SIGKILL);
}
void SimpleException()
{
- pid_t pid;
-
- switch(pid=fork())
+ switch(child_pid=fork())
{
case -1:
{
{ throw; }
CPPUNIT_ASSERT_EQUAL(string("throw me around"),ret);
-
- kill(pid,SIGKILL);
}
}
}
void BigReturn()
{
- pid_t pid;
-
- switch(pid=fork())
+ switch(child_pid=fork())
{
case -1:
{
string ret=dynamic_cast<testfunc_res*>(rc.get_result())->get_data();
CPPUNIT_ASSERT_EQUAL(string().insert(0,100*1024,'x'),ret);
-
- kill(pid,SIGKILL);
}
}
}
void BigParameter()
{
- pid_t pid;
-
- switch(pid=fork())
+ switch(child_pid=fork())
{
case -1:
{
string ret=dynamic_cast<testfunc_res*>(rc.get_result())->get_data();
CPPUNIT_ASSERT_EQUAL(string().insert(0,100*1024,'y')+", testfunc() was here",ret);
-
- kill(pid,SIGKILL);
}
}
}