Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#1723 closed Bugs (fixed)

No subprocess can be started in init_unit_test_suite

Reported by: jensseidel@… Owned by: Gennadiy Rozental
Milestone: Boost 1.36.0 Component: test
Version: Boost Development Trunk Severity: Problem
Keywords: Cc: jensseidel@…

Description

As reported in http://article.gmane.org/gmane.comp.lib.boost.devel/172560 (Boost.Test: "Test setup error: child has exited" error with RC2, Message-ID: <20080325124954.GB10116@…>):

I got a new error once I try to start my test: Test setup error: child has exited; pid: 1001; uid: 20576; exit value: 0 The problem seems to be related to a std::system() call, which I do not understand! Without it it works! Here is my test code: #include <cstdlib> #include <boost/test/included/unit_test_framework.hpp> using boost::unit_test::test_suite; void Vektor3Test1() { } test_suite* Vektor3_test_suite() {

test_suite *test = BOOST_TEST_SUITE("Vektor3 test suite"); test->add(BOOST_TEST_CASE(&Vektor3Test1));

return test;

}

test_suite* init_unit_test_suite(int, char *[]) {

std::system("true"); leads to "Test setup error: child has exited; pid: 1001; uid: 30540; exit value: 0"

test_suite *test = BOOST_TEST_SUITE("Master test suite"); test->add(Vektor3_test_suite()); return test;

}

Attachments (1)

0001-fix-for-boost.test.patch (1.4 KB ) - added by tim@… 14 years ago.
fix for 1.36

Download all attachments as: .zip

Change History (6)

comment:1 by Gennadiy Rozental, 14 years ago

Resolution: fixed
Status: newclosed

fixed in svn already

comment:2 by anonymous, 14 years ago

This bug does not seem to be fixed in Boost 1.36.0. I still obtain errors when child processes exit with return code 0.

Test setup error: child has exited; pid: 503; uid: 26975; exit value: 0

comment:3 by anonymous, 14 years ago

You can disable catching this error with the environment variable BOOST_TEST_CATCH_SYSTEM_ERROR=no

by tim@…, 14 years ago

fix for 1.36

comment:4 by anonymous, 14 years ago

I'm finding that the patch prevents the error message but doesn't cause the code after the system() call (within the BOOST_AUTO_TEST_CASE) to be executed.

For example:

BOOST_AUTO_TEST_CASE(MyTestCase) {
	cerr << "Before command" << endl;
	system("echo Command");
	cerr << "After command" << endl;
	BOOST_CHECK_EQUAL(1, 1);
}

...gives output which includes the following...

Entering test case "MyTestCase"
Before command
Command
Test case MyTestCase doesn't include any assertions
***************************************************
Leaving test case "MyTestCase"

This is the case after I have applied the patch and set the environment variable BOOST_TEST_CATCH_SYSTEM_ERROR to "no".

Thanks very much for your help.

in reply to:  3 comment:5 by anonymous, 14 years ago

Replying to anonymous:

You can disable catching this error with the environment variable BOOST_TEST_CATCH_SYSTEM_ERROR=no

Not that this should be

BOOST_TEST_CATCH_SYSTEM_ERRORS=no rather than BOOST_TEST_CATCH_SYSTEM_ERROR=no

Note: See TracTickets for help on using tickets.