Boost logo

Boost :

Subject: [boost] [process] How to run test cases
From: Boris (boriss_at_[hidden])
Date: 2008-09-22 05:54:55


As Boost.Process 0.3 has been released it would be great if the test cases
are run on various platforms. So far I've tested Boost.Process on WinXP
with MSVC 9.0, Cygwin with g++ 3.4.4 and Solaris with g++ 3.4.6 and Sun
C++ 5.9. To make it as easy as possible for others to run the test cases
here's a short description of how to proceed.

Nearly all test cases depend on a program called "helpers". This program
is built first and is started by many test cases as a child process. In
order to find the program "helpers" the test cases must know its location.
As there is no way to get the location at runtime it is hardcoded in the
file libs/process/test/misc.hpp. As the location differs depending on what
compiler is used YOU MUST CHECK FIRST THE PATH IN
libs/process/test/misc.hpp! Otherwise most of the test cases will fail as
they look for a program "helpers" in the wrong directory. As of today only
those paths are correct and have been tested which are set for Windows,
Cygwin and Solaris.

Only after you have checked and maybe updated the path in
libs/process/test/misc.hpp you should try to build and run the test cases:

WinXP/MSVC 9.0
**************

With MSVC 9.0 you only need to open the Visual Studio 2008 Command Prompt,
change to the directory with the test cases and run bjam:

C:\boost_1_36_0\libs\process\test> ..\..\..\bjam.exe -q

Cygwin/GCC 3.4.4
****************

On Cygwin it's important to know if the Boost libraries have been built
for the POSIX or Windows API. By default Boost libraries on Cygwin use the
Windows API. With the Windows API the Boost.Process test cases are not
passed successfully though (there are compiler errors where I'm not sure
currently if they are a Boost.Process problem and how they could be
fixed). If you want to run the test cases on Cygwin you must (re-)build
the Boost libraries to use the POSIX API:

$ cd ~/boost_1_36_0
$ ./bjam cxxflags=-DBOOST_POSIX_API

Afterwards you can run the test cases:

$ cd ~/boost_1_36_0/libs/process/test
$ ../../../bjam cxxflags=-DBOOST_POSIX_API -q

Solaris/GCC 3.4.6
*****************

At first you have to put the following line in ~/user-config.jam:

using gcc : : : <linker-type>sun ;

Then start building the Boost libraries:

$ cd ~/boost_1_36_0
$ ./bjam --toolset=gcc cxxflags=-mcpu=ultrasparc

For the test cases to be passed successfully you must update Boost.Test.
Change line 624 in ~/boost_1_36_0/boost/test/impl/execution_monitor.ipp
temporarily to:

- , m_CHLD_action( SIGCHLD, catch_system_errors, attach_dbg, alt_stack )
+ , m_CHLD_action( SIGCHLD, false, attach_dbg, alt_stack )

It is important that the second parameter is false as the signal SIGCHLD
should not be handled by the execution monitor and should not be reported
as an error.

Afterwards the test cases can be run:

$ cd ~/boost_1_36_0/libs/process/test
$ ../../../bjam --toolset=gcc cxxflags=-mcpu=ultrasparc -q

Solaris/Sun C++ 5.9
*******************

Build the Boost libraries with the sun toolset:

$ cd ~/boost_1_36_0
$ ./bjam --toolset=sun stdlib=sun-stlport

For the test cases to be passed successfully you must update Boost.Test.
Change line 624 in ~/boost_1_36_0/boost/test/impl/execution_monitor.ipp
temporarily to:

- , m_CHLD_action( SIGCHLD, catch_system_errors, attach_dbg, alt_stack )
+ , m_CHLD_action( SIGCHLD, false, attach_dbg, alt_stack )

It is important that the second parameter is false as the signal SIGCHLD
should not be handled by the execution monitor and should not be reported
as an error.

If you run the test cases now you'll get this compiler error for one test
case:

"../../../boost/asio/detail/socket_ops.hpp", line 218: Error: Cannot
assign void* to char*.
"../../../boost/asio/detail/socket_ops.hpp", line 229: Error: Cannot
assign void* to char*.
"../../../boost/asio/detail/descriptor_ops.hpp", line 66: Error: Cannot
assign void* to char*.
"../../../boost/asio/detail/descriptor_ops.hpp", line 72: Error: Cannot
assign void* to char*.

The bug has been reported to the Boost.Asio mailing list. If you want to
build that one test case, too, you need to fix the two files in Boost.Asio
1.36.0 yourself.

All the test cases can be built and run with:

$ cd ~/boost_1_36_0/libs/process/test
$ ../../../bjam --toolset=sun stdlib=sun-stlport -q


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk