Merge remote-tracking branch 'pocoproject@github/develop' into PocoCppUnit

This commit is contained in:
FrancisANDRE
2016-01-10 11:57:27 +01:00
4 changed files with 82 additions and 11 deletions

View File

@@ -16,6 +16,7 @@
#include "Poco/Process.h"
#include "Poco/Pipe.h"
#include "Poco/PipeStream.h"
#include "Poco/Thread.h"
#include <csignal>
@@ -176,6 +177,27 @@ void ProcessTest::testIsRunning()
}
void ProcessTest::testIsRunningAllowsForTermination()
{
#if !defined(_WIN32_WCE)
std::string name("TestApp");
std::string cmd;
#if defined(POCO_OS_FAMILY_UNIX)
cmd = "./";
cmd += name;
#else
cmd = name;
#endif
std::vector<std::string> args;
ProcessHandle ph = Process::launch(cmd, args, 0, 0, 0);
while (Process::isRunning(ph))
Poco::Thread::sleep(100);
#endif // !defined(_WIN32_WCE)
}
void ProcessTest::testSignalExitCode()
{
#if defined(POCO_OS_FAMILY_UNIX)
@@ -213,6 +235,7 @@ CppUnit::Test* ProcessTest::suite()
CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectOut);
CppUnit_addTest(pSuite, ProcessTest, testLaunchEnv);
CppUnit_addTest(pSuite, ProcessTest, testIsRunning);
CppUnit_addTest(pSuite, ProcessTest, testIsRunningAllowsForTermination);
CppUnit_addTest(pSuite, ProcessTest, testSignalExitCode);
return pSuite;