X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=test%2Fserialize.cpp;h=808ea089d7afdbcc9eedd86a430348810273a532;hp=85a9b58b8df2fdb0e7cd31b39ca9f0bf376bfe3d;hb=441d41fe583765902aa2f9641c0977e295e62be3;hpb=fb3345ada7ea94225b78994fd50e3de693a2a3d5 diff --git a/test/serialize.cpp b/test/serialize.cpp index 85a9b58..808ea08 100644 --- a/test/serialize.cpp +++ b/test/serialize.cpp @@ -117,19 +117,24 @@ class test_serialize : 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 ClientSerializeErr() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -139,12 +144,18 @@ class test_serialize : public TestFixture case 0: // child { - socket_server ss("./socket"); - command_server cs(ss); + try + { + socket_server ss("./socket"); + command_server cs(ss); - // max 10 sec - for (int i=0; i < 10; i++) - cs.handle(1000000); + // max 10 sec + for (int i=0; i < 10; i++) + cs.handle(1000000); + } catch(...) + { + std::cerr << "exception in child. ignoring\n"; + } // don't call atexit and stuff _exit(0);