Boost logo

Boost Users :

Subject: [Boost-users] Boost Test with multiple processes (MPI)
From: James Amundson (amundson_at_[hidden])
Date: 2010-07-01 12:26:46


Does anyone have a solution for writing unit tests with Boost Test that
run in multiple processes? I am using MPI, but I think the same problem
would appear in other multi-process situations. I need some way to
collect whether, e.g., BOOST_CHECK, has passed.

Here's a schematic view of the problem. I want my "example" test to fail
because should_be_true is false on process 1. What happens is that I get
success on process 0 and failure in process 1.

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(example)
{
     double should_be_unity;
     const double tolerance = 1.0e-10;

     // do something that sets should_be_unity to 1.0
     // in process 0, and 1.1 in process 1.

     BOOST_CHECK_CLOSE(sh);
}

I then run the test with
     mpirun -np 2 ./mytest

Obviously, I can write all my tests


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