Skip to content

Running tests with CMake #28

@lukeyeager

Description

@lukeyeager

NOTE: Building with CMake still works fine - only the tests are affected.

As I discovered while testing #26, there is some sort of CMake bug in NVcaffe.

Sometimes, when you build with CMake and try to make runtest, you get thousands of lines of errors. The errors seem to occur intermittently - I've tried v0.12.*, v0.13.*, with/without cuDNN, with/without CNMeM, with/without parallel build (make --jobs=4), etc. I think this only happens when Caffe is using CUDA.

Unfortunately, the Caffe TravisCI build doesn't actually build the tests when using CUDA and CMake (see here and here).

How to reproduce

mkdir build
cd build
cmake ..
make all runtest

Error

Sometimes the tests build and run without a hitch. More often, CMake dumps thousands of lines of output. I'm not sure what's relevant, but here are the first 20 lines and the last 20 lines:

CMakeFiles/test.testbin.dir/test_threshold_layer.cpp.o: In function `testing::internal::scoped_ptr<std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > >::reset(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >*) [clone .constprop.221]':
test_threshold_layer.cpp:(.text+0x10): undefined reference to `testing::internal::IsTrue(bool)'
CMakeFiles/test.testbin.dir/test_threshold_layer.cpp.o: In function `testing::internal::scoped_ptr<std::string>::reset(std::string*) [clone .constprop.222]':
test_threshold_layer.cpp:(.text+0x45): undefined reference to `testing::internal::IsTrue(bool)'
CMakeFiles/test.testbin.dir/test_threshold_layer.cpp.o: In function `testing::AssertionResult testing::internal::CmpHelperGE<double, double>(char const*, char const*, double const&, double const&) [clone .constprop.218]':
test_threshold_layer.cpp:(.text+0x1cd): undefined reference to `testing::AssertionFailure()'
test_threshold_layer.cpp:(.text+0x23c): undefined reference to `testing::internal::StringStreamToString(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >*)'
test_threshold_layer.cpp:(.text+0x2ff): undefined reference to `testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
test_threshold_layer.cpp:(.text+0x349): undefined reference to `testing::AssertionSuccess()'
test_threshold_layer.cpp:(.text+0x380): undefined reference to `testing::internal::IsTrue(bool)'
CMakeFiles/test.testbin.dir/test_threshold_layer.cpp.o: In function `testing::AssertionResult testing::internal::CmpHelperLE<double, double>(char const*, char const*, double const&, double const&) [clone .constprop.219]':
test_threshold_layer.cpp:(.text+0x4bd): undefined reference to `testing::AssertionFailure()'
test_threshold_layer.cpp:(.text+0x52c): undefined reference to `testing::internal::StringStreamToString(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >*)'
test_threshold_layer.cpp:(.text+0x5ef): undefined reference to `testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
test_threshold_layer.cpp:(.text+0x639): undefined reference to `testing::AssertionSuccess()'
test_threshold_layer.cpp:(.text+0x670): undefined reference to `testing::internal::IsTrue(bool)'
CMakeFiles/test.testbin.dir/test_threshold_layer.cpp.o: In function `testing::AssertionResult testing::internal::CmpHelperLE<float, double>(char const*, char const*, float const&, double const&) [clone .constprop.216]':
test_threshold_layer.cpp:(.text+0x828): undefined reference to `testing::AssertionFailure()'
test_threshold_layer.cpp:(.text+0x90d): undefined reference to `testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
test_threshold_layer.cpp:(.text+0x951): undefined reference to `testing::AssertionSuccess()'

...

CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe27IOTest_TestDecodeDatum_TestE[_ZTVN5caffe27IOTest_TestDecodeDatum_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe34IOTest_TestDecodeDatumToCVMat_TestE[_ZTVN5caffe34IOTest_TestDecodeDatumToCVMat_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe34IOTest_TestDecodeDatumToCVMat_TestE[_ZTVN5caffe34IOTest_TestDecodeDatumToCVMat_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe41IOTest_TestDecodeDatumToCVMatContent_TestE[_ZTVN5caffe41IOTest_TestDecodeDatumToCVMatContent_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe41IOTest_TestDecodeDatumToCVMatContent_TestE[_ZTVN5caffe41IOTest_TestDecodeDatumToCVMatContent_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe33IOTest_TestDecodeDatumNative_TestE[_ZTVN5caffe33IOTest_TestDecodeDatumNative_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe33IOTest_TestDecodeDatumNative_TestE[_ZTVN5caffe33IOTest_TestDecodeDatumNative_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe40IOTest_TestDecodeDatumToCVMatNative_TestE[_ZTVN5caffe40IOTest_TestDecodeDatumToCVMatNative_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe40IOTest_TestDecodeDatumToCVMatNative_TestE[_ZTVN5caffe40IOTest_TestDecodeDatumToCVMatNative_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe37IOTest_TestDecodeDatumNativeGray_TestE[_ZTVN5caffe37IOTest_TestDecodeDatumNativeGray_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe37IOTest_TestDecodeDatumNativeGray_TestE[_ZTVN5caffe37IOTest_TestDecodeDatumNativeGray_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe44IOTest_TestDecodeDatumToCVMatNativeGray_TestE[_ZTVN5caffe44IOTest_TestDecodeDatumToCVMatNativeGray_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe44IOTest_TestDecodeDatumToCVMatNativeGray_TestE[_ZTVN5caffe44IOTest_TestDecodeDatumToCVMatNativeGray_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe47IOTest_TestDecodeDatumToCVMatContentNative_TestE[_ZTVN5caffe47IOTest_TestDecodeDatumToCVMatContentNative_TestE]+0x20): undefined reference to `testing::Test::SetUp()'
CMakeFiles/test.testbin.dir/test_io.cpp.o:(.data.rel.ro._ZTVN5caffe47IOTest_TestDecodeDatumToCVMatContentNative_TestE[_ZTVN5caffe47IOTest_TestDecodeDatumToCVMatContentNative_TestE]+0x28): undefined reference to `testing::Test::TearDown()'
collect2: error: ld returned 1 exit status
make[3]: *** [test/caffe-nv] Error 1
make[2]: *** [src/caffe/test/CMakeFiles/test.testbin.dir/all] Error 2
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
make: *** [runtest] Error 2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions