]> git.stg.codes - stg.git/blobdiff - tests/tut/tut_posix.hpp
Fixed BFStream work with large strings, allowed null put on last.
[stg.git] / tests / tut / tut_posix.hpp
index 89a713053c08946aef2dd8173719d4145590d5b2..c7cfe57a42628ed080dda70bac26e101e2f3c2fc 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef TUT_FORK_H_GUARD
 #define TUT_FORK_H_GUARD
+#include <tut/tut_config.hpp>
 
 #if defined(TUT_USE_POSIX)
 #include <errno.h>
@@ -44,7 +45,7 @@ private:
 
         if(tr.result != test_result::ok)
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << int(tr.result) << "\n"
                 << tr.group << "\n"
                 << tr.test << "\n"
@@ -57,6 +58,10 @@ private:
             ensure_errno("write() failed", w == size);
         }
     }
+
+    virtual ~test_group_posix()
+    {
+    }
 };
 
 template<typename T>
@@ -126,7 +131,8 @@ public:
      * Default constructor
      */
     test_object_posix()
-        : pipe_(-1)
+        : pids_(),
+          pipe_(-1)
     {
     }
 
@@ -142,7 +148,7 @@ public:
 
         if(!pids_.empty())
         {
-            std::stringstream ss;
+            std::ostringstream ss;
 
             // in parent, reap children
             for(std::map<pid_t, int>::iterator i = pids_.begin(); i != pids_.end(); ++i)
@@ -226,7 +232,7 @@ private:
             else
             {
                 // cannot kill, we are in trouble
-                std::stringstream ss;
+                std::ostringstream ss;
                 char e[1024];
                 ss << "child " << pid << " could not be killed with SIGTERM, " << strerror_r(errno, e, sizeof(e)) << std::endl;
                 fail(ss.str());
@@ -257,7 +263,7 @@ private:
                 }
                 else
                 {
-                    std::stringstream ss;
+                    std::ostringstream ss;
                     char e[1024];
                     ss << "child " << pid << " could not be killed with SIGKILL, " << strerror_r(errno, e, sizeof(e)) << std::endl;
                     fail(ss.str());
@@ -269,7 +275,7 @@ private:
 
             ensure_equals("child process exists after SIGKILL", ::kill(pid, 0), -1);
 
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child " << pid << " had to be killed with SIGKILL";
             fail(ss.str());
         }
@@ -361,7 +367,7 @@ private:
     {
         if(WIFSIGNALED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child killed by signal " << WTERMSIG(status)
                 << ": expected exit with code " << exit_status;
 
@@ -372,7 +378,7 @@ private:
         {
             if(WEXITSTATUS(status) != exit_status)
             {
-                std::stringstream ss;
+                std::ostringstream ss;
                 ss << "child exited, expected '"
                     << exit_status
                     << "' actual '"
@@ -385,7 +391,7 @@ private:
 
         if(WIFSTOPPED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child stopped by signal " << WTERMSIG(status)
                 << ": expected exit with code " << exit_status;
             throw failure(ss.str().c_str());
@@ -398,7 +404,7 @@ private:
         {
             if(WTERMSIG(status) != signal)
             {
-                std::stringstream ss;
+                std::ostringstream ss;
                 ss << "child killed by signal, expected '"
                     << signal
                     << "' actual '"
@@ -410,7 +416,7 @@ private:
 
         if(WIFEXITED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child exited with code " << WEXITSTATUS(status)
                 << ": expected signal " << signal;
 
@@ -419,7 +425,7 @@ private:
 
         if(WIFSTOPPED(status))
         {
-            std::stringstream ss;
+            std::ostringstream ss;
             ss << "child stopped by signal " << WTERMSIG(status)
                 << ": expected kill by signal " << signal;
 
@@ -453,6 +459,9 @@ namespace tut
 
 struct test_object_posix
 {
+    virtual ~test_object_posix()
+    {
+    }
 };
 
 struct test_group_posix
@@ -461,6 +470,10 @@ struct test_group_posix
     void send_result_(const T*, const test_result &)
     {
     }
+
+    virtual ~test_group_posix()
+    {
+    }
 };
 
 } // namespace tut