libt2n: (gerd) make sure no exception is thrown in command_client constructor, fix...
[libt2n] / test / callback.cpp
index bc951b9..257da83 100644 (file)
@@ -44,6 +44,8 @@ class test_callback : public TestFixture
 
     std::vector<bool> callback_done;
 
+    pid_t child_pid;
+
     public:
 
     void setUp()
@@ -54,6 +56,10 @@ class test_callback : public TestFixture
     void tearDown()
     {
         callback_done.clear();
+
+        // make sure the server-child is dead before the next test runs
+        kill(child_pid,SIGKILL);
+        sleep(1);
     }
 
     void callback_func(callback_event_type ev, int conn_id)
@@ -67,9 +73,7 @@ class test_callback : public TestFixture
 
     void ServerNewConnCallback()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -128,9 +132,7 @@ class test_callback : public TestFixture
 
     void ServerConnClosedCallback()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -189,9 +191,7 @@ class test_callback : public TestFixture
 
     void ServerConnDeletedCallback()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -253,9 +253,7 @@ class test_callback : public TestFixture
 
     void ServerCallbackOrder()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -336,9 +334,7 @@ class test_callback : public TestFixture
 
     void ClientConnClosedCallback()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -390,9 +386,7 @@ class test_callback : public TestFixture
 
     void ClientConnDeletedCallback()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {