#ifndef TUT_FORK_H_GUARD
#define TUT_FORK_H_GUARD
+#include <tut/tut_config.hpp>
#if defined(TUT_USE_POSIX)
#include <errno.h>
if(tr.result != test_result::ok)
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << int(tr.result) << "\n"
<< tr.group << "\n"
<< tr.test << "\n"
ensure_errno("write() failed", w == size);
}
}
+
+ virtual ~test_group_posix()
+ {
+ }
};
template<typename T>
* Default constructor
*/
test_object_posix()
- : pipe_(-1)
+ : pids_(),
+ pipe_(-1)
{
}
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)
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());
}
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());
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());
}
{
if(WIFSIGNALED(status))
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << "child killed by signal " << WTERMSIG(status)
<< ": expected exit with code " << exit_status;
{
if(WEXITSTATUS(status) != exit_status)
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << "child exited, expected '"
<< exit_status
<< "' actual '"
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());
{
if(WTERMSIG(status) != signal)
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << "child killed by signal, expected '"
<< signal
<< "' actual '"
if(WIFEXITED(status))
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << "child exited with code " << WEXITSTATUS(status)
<< ": expected signal " << signal;
if(WIFSTOPPED(status))
{
- std::stringstream ss;
+ std::ostringstream ss;
ss << "child stopped by signal " << WTERMSIG(status)
<< ": expected kill by signal " << signal;
struct test_object_posix
{
+ virtual ~test_object_posix()
+ {
+ }
};
struct test_group_posix
void send_result_(const T*, const test_result &)
{
}
+
+ virtual ~test_group_posix()
+ {
+ }
};
} // namespace tut