mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
37 lines
717 B
C++
37 lines
717 B
C++
// test_process.cpp
|
|
|
|
#include <ulib/timeval.h>
|
|
#include <ulib/process.h>
|
|
#include <ulib/notifier.h>
|
|
|
|
int
|
|
U_EXPORT main (int argc, char* argv[], char* _environ[])
|
|
{
|
|
U_ULIB_INIT(argv);
|
|
|
|
U_TRACE(5,"main(%d)",argc)
|
|
|
|
UProcess x;
|
|
int exit_value;
|
|
const char* info;
|
|
char buffer[128];
|
|
|
|
if (x.fork())
|
|
{
|
|
if (x.parent())
|
|
{
|
|
x.wait();
|
|
|
|
exit_value = x.exitValue();
|
|
info = x.exitInfo(buffer);
|
|
|
|
U_INTERNAL_ASSERT_EQUALS( exit_value, -1536 )
|
|
U_INTERNAL_ASSERT_EQUALS( memcmp(info, U_CONSTANT_TO_PARAM("Signal SIGABRT (6, Abort")), 0 )
|
|
}
|
|
else
|
|
{
|
|
U_ABORT("abort program for testing...", 0);
|
|
}
|
|
}
|
|
}
|