Ticket #13139: killer-test.cpp

File killer-test.cpp, 687 bytes (added by keithb@…, 5 years ago)

killer-test.cpp: small application that uses boost::process library to exercise the killer app which would be produced by killer.c

Line 
1// g++ killer-test.cpp -I/usr/local/boost-1.64.0-gcc6.2-fPIC/include/ -L/usr/local/boost-1.64.0-gcc6.2-fPIC/lib -lboost_system
2// LD_LIBRARY_PATH=/usr/local/boost-1.64.0-gcc6.2-fPIC/lib ./killer-test
3#include <boost/process.hpp>
4namespace bp = boost::process;
5#include <boost/filesystem.hpp>
6namespace fs = boost::filesystem;
7#include <boost/asio.hpp>
8namespace asio = boost::asio;
9
10extern "C" {
11#include <sys/types.h>
12#include <signal.h>
13}
14
15int main(int argc, char **argv) {
16 asio::io_service ios;
17 bp::child c("./killer", std::to_string(SIGABRT));
18 ios.run();
19 c.wait();
20
21 if ( EXIT_SUCCESS != c.exit_code() ) {
22 return EXIT_FAILURE;
23 }
24
25 return EXIT_SUCCESS;
26}
27