X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=test%2Freconnect.cpp;h=394ba25e6102cb7fb0eee8a3c14091807fb89e31;hp=09c5f5f084c1051221d1ca43ea9c180e070f7970;hb=393e7b700efffc748e593661b365ead414a341c1;hpb=af84dfb53a739a0c8c343d9172f1847fa908906d diff --git a/test/reconnect.cpp b/test/reconnect.cpp index 09c5f5f..394ba25 100644 --- a/test/reconnect.cpp +++ b/test/reconnect.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -51,13 +52,19 @@ class test_reconnect : 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 send_raw_socket(string hello_string, socket_server* ss, int conn_id) { @@ -70,9 +77,7 @@ class test_reconnect : public TestFixture void simple_reconnect() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -143,9 +148,7 @@ class test_reconnect : public TestFixture void reconnect_with_close() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -221,9 +224,7 @@ class test_reconnect : public TestFixture void reconnect_buffer_complete() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -289,11 +290,9 @@ class test_reconnect : public TestFixture void reconnect_buffer_several_complete() { - pid_t pid; - const int packets=3; - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -379,9 +378,7 @@ class test_reconnect : public TestFixture void reconnect_buffer_no_incomplete1() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: { @@ -457,9 +454,7 @@ class test_reconnect : public TestFixture void reconnect_buffer_no_incomplete2() { - pid_t pid; - - switch(pid=fork()) + switch(child_pid=fork()) { case -1: {