[1.35, Boost.Test] error when using system in a test
The following (see below) test programm compiles under both 1.34.1 and 1.35.0; if linked against 1.35.0 it produces the following error message: Running 1 test case... A unknown location(0): fatal error in "test_call_system": child has exited; pid: 1000; uid: 16129; exit value: 0 *** 1 failure detected in test suite "Master Test Suite" With 1.34.1, no errors are found: Running 1 test case... A *** No errors detected Test program: #define BOOST_AUTO_TEST_MAIN "test-bug" #include <boost/test/auto_unit_test.hpp> BOOST_AUTO_TEST_CASE(test_call_system) { system("echo A"); } Yes, that's it! A single and simple system()-call. (I use these to setup/teardown my test environment; i.e. I create and remove a directory here, really. If there is a better way to do that: hints welcome!) Compiled with gcc 4.1.2 (SLES Linux 10), g++ -I/3rdparty/boost_1_34_1/include/boost-1_34_1 \ -L/3rdparty/boost_1_34_1/lib \ -lboost_unit_test_framework-gcc41 \ -DBOOST_TEST_DYN_LINK \ test.cpp Best regards Christoph
On Thu, Apr 03, 2008 at 09:06:15AM +0200, Christoph Duelli wrote:
The following (see below) test programm compiles under both 1.34.1 and 1.35.0; if linked against 1.35.0 it produces the following error message:
Running 1 test case... A unknown location(0): fatal error in "test_call_system": child has exited; pid: 1000; uid: 16129; exit value: 0
That's bug http://svn.boost.org/trac/boost/ticket/1723.
Yes, that's it! A single and simple system()-call. (I use these to setup/teardown my test environment; i.e. I create and remove a directory here, really. If there is a better way to do that: hints welcome!)
I did the same :-) Nevertheless Boost has a library for filesystem operations which should be platform independent ... Jens
Jens Seidel wrote:
Yes, that's it! A single and simple system()-call. (I use these to setup/teardown my test environment; i.e. I create and remove a directory here, really. If there is a better way to do that: hints welcome!)
I did the same :-) Nevertheless Boost has a library for filesystem operations which should be platform independent ... Yes, I know. With 'better way for it', however, I really meant: can/should the setup of test cases be done inside those tests or is there a (better) way, perhaps some class with setup/tearDown overloads or so...
Best regards Christoph
Christoph Duelli <duelli <at> melosgmbh.de> writes:
With 'better way for it', however, I really meant: can/should the setup of test cases be done inside those tests or is there a (better) way, perhaps some class with setup/tearDown overloads or so...
Boost.Test provides better alternative with use of test cases with fixtures. Gennadiy
Jens Seidel <jensseidel <at> users.sf.net> writes:
On Thu, Apr 03, 2008 at 09:06:15AM +0200, Christoph Duelli wrote:
The following (see below) test programm compiles under both 1.34.1 and 1.35.0; if linked against 1.35.0 it produces the following error message:
Running 1 test case... A unknown location(0): fatal error in "test_call_system": child has exited; pid: 1000; uid: 16129; exit value: 0
That's bug http://svn.boost.org/trac/boost/ticket/1723.
Fixed. Now child process that returns exit code 0 is not reported as error. Gennadiy
participants (3)
-
Christoph Duelli
-
Gennadiy Rozental
-
Jens Seidel