c++iccboost-unit-test-framework

BOOST_AUTO_TEST_CASE does not register test case when compiled with icc


Can anyone explain why this use of BOOST_AUTO_TEST_CASE does not get registered when I compile with icc/icpc? When I compile with g++, it registers & runs.

#define BOOST_TEST_MODULE boosttestunitfailure
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE( helloworld )
{
  BOOST_CHECK( true );
}

Here's how I'm compiling with ICC - note that when I run, the exe says "test tree is empty":

plxv1142: atevet/BoostTestUnitFailure (master)> icpc --version
icpc (ICC) 14.0.4 20140805
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.
plxv1142: atevet/BoostTestUnitFailure (master)> icpc -std=c++11 -Wall -fPIC -DBOOST_TEST_DYN_LINK -I/usr/pkgs/boost/1.53.0/include  -O0 -o boostunittestcasefailure test.cpp -Wl,-rpath=/usr/pkgs/boost/1.53.0/lib64 /usr/pkgs/boost/1.53.0/lib64/libboost_unit_test_framework.so
plxv1142: atevet/BoostTestUnitFailure (master)> ./boostunittestcasefailure 
Test setup error: test tree is empty

And here's g++ - note that when compiled with g++, the test is registered with the framework and is run:

plxv1142: atevet/BoostTestUnitFailure (master)> g++ --version
g++ (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
plxv1142: atevet/BoostTestUnitFailure (master)> g++ -std=c++11 -Wall -fPIC -DBOOST_TEST_DYN_LINK -I/usr/pkgs/boost/1.53.0/include -O0 -o boostunittestcasefailure test.cpp -Wl,-rpath=/usr/pkgs/boost/1.53.0/lib64 /usr/pkgs/boost/1.53.0/lib64/libboost_unit_test_framework.so
plxv1142: atevet/BoostTestUnitFailure (master)> ./boostunittestcasefailure                                                                                                    Running 1 test case...

*** No errors detected

Solution

  • If anyone is curious, this was occurring because of the way my environment determined which g++ to use (corporate environment with wrappers to different versions of tools). When I removed the corporate environment additions, the problem disappeared.