[Boost.Test] unexpected behavior after std::system(...)
Hi, I'm using boost 1.57 with gcc 4.7.2 on a debian wheezy. I'm testing an external program that has a non-zero return code and i'm experiencing an unexpected behavior of Boost.Test library. If the test below is linked statically (commenting the first line of course) everything works fine and all the three tests are executed. If the test below is linked dynamically i get the following output: test0 test1 unknown location(0): fatal error in "test1": child has exited; pid: 32314; uid: 1000; exit value: 4 (here program hangs forever and the third test is never executed) Defining the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS=No circumvents the problem. But i don't want to define it on all of the team member's computers and test machines. This can be considered a boost bug? #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE test_module #define BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE #include <boost/test/unit_test.hpp> #include <stdlib.h> BOOST_AUTO_TEST_CASE( test0 ) { std::system("echo \"test0\";exit 0;"); } BOOST_AUTO_TEST_CASE( test1 ) { std::system("echo \"test1\";exit 1;"); } BOOST_AUTO_TEST_CASE( test2 ) { std::system("echo \"test2\";exit 2;"); } Any help is appreciated.
[Please do not mail me a copy of your followup] "contini.mailing@gmail.com" <contini.mailing@gmail.com> spake the secret code <CAPbYoDt06zE2k8jWMtP9Creez4D847NpFi-XNAR=kF-0khMmHg@mail.gmail.com> thusly:
I'm using boost 1.57 with gcc 4.7.2 on a debian wheezy. I'm testing an external program that has a non-zero return code and i'm experiencing an unexpected behavior of Boost.Test library.
If the test below is linked statically (commenting the first line of course) everything works fine and all the three tests are executed. If the test below is linked dynamically i get the following output:
test0 test1 unknown location(0): fatal error in "test1": child has exited; pid: 32314; uid: 1000; exit value: 4 (here program hangs forever and the third test is never executed)
Defining the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS=No circumvents the problem. But i don't want to define it on all of the team member's computers and test machines. This can be considered a boost bug?
I would file a bug on it. I don't see why it would work properly with static linking, but fail with dynamic linking. I haven't dug into the source, but if you control the way your executable is invoked (for instance, if it is invoked by the build system), you can obtain the same effect as the environment variable by using the command-line argument --catch_system_errors=no. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
participants (2)
-
contini.mailing@gmail.com
-
legalize+jeeves@mail.xmission.com