Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Test] unexpected behavior after std::system(...)
From: contini.mailing_at_[hidden]
Date: 2014-11-27 05:37:15


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.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net