X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=test%2Fsimplecmd.cpp;fp=test%2Fsimplecmd.cpp;h=36e08f1929d314c7da52d72692fb12538e7aa7ce;hp=42721ea64a233763fee63063cce4807fe4955fbe;hb=b592218402bfa779c024da2f32c4c782d52eaf88;hpb=fb3345ada7ea94225b78994fd50e3de693a2a3d5 diff --git a/test/simplecmd.cpp b/test/simplecmd.cpp index 42721ea..36e08f1 100644 --- a/test/simplecmd.cpp +++ b/test/simplecmd.cpp @@ -121,20 +121,23 @@ class test_simplecmd : public TestFixture 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: { @@ -172,14 +175,11 @@ class test_simplecmd : public TestFixture 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: { @@ -224,17 +224,13 @@ class test_simplecmd : public TestFixture { 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: { @@ -269,17 +265,13 @@ class test_simplecmd : public TestFixture string ret=dynamic_cast(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: { @@ -314,8 +306,6 @@ class test_simplecmd : public TestFixture string ret=dynamic_cast(rc.get_result())->get_data(); CPPUNIT_ASSERT_EQUAL(string().insert(0,100*1024,'y')+", testfunc() was here",ret); - - kill(pid,SIGKILL); } } }