libt2n: (gerd) make sure no exception is thrown in command_client constructor, fix...
[libt2n] / test / comm.cpp
index 688cbf0..7bd8b24 100644 (file)
@@ -41,20 +41,25 @@ class test_comm : 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 UnixCommToServer()
     {
-        pid_t pid;
         string data;
 
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -94,9 +99,7 @@ class test_comm : public TestFixture
 
     void UnixCommToServerAndBack()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -166,9 +169,7 @@ class test_comm : public TestFixture
 
     void UnixCommToServerAndBackBig()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -229,10 +230,9 @@ class test_comm : public TestFixture
 
     void IPCommToServer()
     {
-        pid_t pid;
         string data;
 
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -272,9 +272,7 @@ class test_comm : public TestFixture
 
     void IPCommToServerAndBack()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -344,9 +342,7 @@ class test_comm : public TestFixture
 
     void IPCommToServerAndBackBig()
     {
-        pid_t pid;
-
-        switch(pid=fork())
+        switch(child_pid=fork())
         {
             case -1:
             {
@@ -406,9 +402,6 @@ class test_comm : public TestFixture
             }
         }
     } // eo IPCommToServerAndBackBig()
-
-
-
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(test_comm);