X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3156083fd0c328d46be22536720ae33e1ab48090..5d8864b1d5742dae434c83b66b490484f9a839fe:/tests/tut/tut_posix.hpp?ds=inline diff --git a/tests/tut/tut_posix.hpp b/tests/tut/tut_posix.hpp index 89a71305..c7cfe57a 100644 --- a/tests/tut/tut_posix.hpp +++ b/tests/tut/tut_posix.hpp @@ -1,5 +1,6 @@ #ifndef TUT_FORK_H_GUARD #define TUT_FORK_H_GUARD +#include #if defined(TUT_USE_POSIX) #include @@ -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 @@ -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::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