memory benchmark + app exit code test + thread scheduler observations.
This commit is contained in:
59
test_return_code.cpp
Normal file
59
test_return_code.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Check cf5-opt.vim defs.
|
||||
VIM: let g:lcppflags="-std=c++11 -O2"
|
||||
VIM: let g:cppflags=g:boost.g:tbb.g:tbbmalloc.g:tbbmproxy
|
||||
VIM: let g:ldlibpath=g:boostld.g:tbbld
|
||||
VIM: let g:cf5output=0
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
void run( const char * cmd )
|
||||
{
|
||||
std::cout << cmd << " => ";
|
||||
int ws = system( cmd );
|
||||
|
||||
if ( WIFEXITED(ws) )
|
||||
std::cout << "return code " << WEXITSTATUS(ws) << std::endl;
|
||||
else if ( WIFSIGNALED(ws) )
|
||||
{
|
||||
std::cout << "signal code " << WTERMSIG(ws);
|
||||
#if 0
|
||||
if ( WCOREDUMP(ws) )
|
||||
std::cout << " and core dump generated." << std::endl;
|
||||
else
|
||||
std::cout << " and core dump is not generated." << std::endl;
|
||||
#endif
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else if ( WIFSTOPPED(ws) )
|
||||
{
|
||||
std::cout << "stopped with signal " << WSTOPSIG(ws) << std::endl;
|
||||
}
|
||||
else
|
||||
std::cout << "Child is not terminated normally." << std::endl;
|
||||
}
|
||||
|
||||
int main ( int argc, char ** argv)
|
||||
{
|
||||
|
||||
if ( argc != 1 )
|
||||
{
|
||||
std::string arg( argv[1] );
|
||||
if ( arg == "throw" )
|
||||
{
|
||||
throw std::runtime_error( "runtime error" );
|
||||
}
|
||||
|
||||
int r = atoi( arg.c_str() );
|
||||
return (r) ? r : -1;
|
||||
}
|
||||
|
||||
run("test_return_code.exe 1");
|
||||
run("test_return_code.exe 2");
|
||||
run("test_return_code.exe throw");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user