tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
808 stars 284 forks source link

testExportAscii and testExportNonAscii tests fail on Ubuntu 18.04 #700

Closed janusw closed 5 years ago

janusw commented 6 years ago

When building OCE 0.18.3 with -DOCE_TESTING=ON on Ubuntu 18.04 (using cmake 3.10, gcc 7.3, glibc 2.27), I see the following two test failures:

96% tests passed, 2 tests failed out of 48

The following tests FAILED:
     25 - OCAFExportTestSuite.testExportAscii (Failed)
     26 - OCAFExportTestSuite.testExportNonAscii (Failed)

This does not happen on Ubuntu 16.04 (and I don't remember seeing it on 17.10 either, but I'm not sure about this).

janusw commented 6 years ago

Looking at Testing/Temporary/LastTest.log in my build directory, I see:

25/48 Testing: OCAFExportTestSuite.testExportAscii
25/48 Test: OCAFExportTestSuite.testExportAscii
Command: "/home/janus/OCE/oce/build_0.18/test/OCAFExport_test/OCAFExport_test" "--gtest_filter=OCAFExportTestSuite.testExportAscii"
Directory: /home/janus/OCE/oce/build_0.18/test/OCAFExport_test
"OCAFExportTestSuite.testExportAscii" start time: Jul 20 09:53 CEST
Output:
----------------------------------------------------------
Note: Google Test filter = OCAFExportTestSuite.testExportAscii
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from OCAFExportTestSuite
[ RUN      ] OCAFExportTestSuite.testExportAscii
could not open: TKBin ; reason: libTKBin.so.11: cannot open shared object file: No such file or directory
/home/janus/OCE/oce/test/OCAFExport_test/OCAFExport_test.cpp:22: Failure
Value of: file.Exists()
  Actual: false
Expected: true
[  FAILED  ] OCAFExportTestSuite.testExportAscii (2 ms)
[----------] 1 test from OCAFExportTestSuite (2 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (2 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] OCAFExportTestSuite.testExportAscii

 1 FAILED TEST
<end of output>
Test time =   0.02 sec
----------------------------------------------------------
Test Failed.
"OCAFExportTestSuite.testExportAscii" end time: Jul 20 09:53 CEST
"OCAFExportTestSuite.testExportAscii" time elapsed: 00:00:00
----------------------------------------------------------

26/48 Testing: OCAFExportTestSuite.testExportNonAscii
26/48 Test: OCAFExportTestSuite.testExportNonAscii
Command: "/home/janus/OCE/oce/build_0.18/test/OCAFExport_test/OCAFExport_test" "--gtest_filter=OCAFExportTestSuite.testExportNonAscii"
Directory: /home/janus/OCE/oce/build_0.18/test/OCAFExport_test
"OCAFExportTestSuite.testExportNonAscii" start time: Jul 20 09:53 CEST
Output:
----------------------------------------------------------
Note: Google Test filter = OCAFExportTestSuite.testExportNonAscii
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from OCAFExportTestSuite
[ RUN      ] OCAFExportTestSuite.testExportNonAscii
could not open: TKBin ; reason: libTKBin.so.11: cannot open shared object file: No such file or directory
/home/janus/OCE/oce/test/OCAFExport_test/OCAFExport_test.cpp:44: Failure
Value of: file.Exists()
  Actual: false
Expected: true
[  FAILED  ] OCAFExportTestSuite.testExportNonAscii (1 ms)
[----------] 1 test from OCAFExportTestSuite (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] OCAFExportTestSuite.testExportNonAscii

 1 FAILED TEST
<end of output>
Test time =   0.01 sec
----------------------------------------------------------
Test Failed.
"OCAFExportTestSuite.testExportNonAscii" end time: Jul 20 09:53 CEST
"OCAFExportTestSuite.testExportNonAscii" time elapsed: 00:00:00
----------------------------------------------------------

The crucial part is obviously:

could not open: TKBin ; reason: libTKBin.so.11: cannot open shared object file: No such file or directory
janusw commented 6 years ago

Actually the errors seem to go away after doing make install.

I also verified that the build folder does contain the following files:

./Unix/x86_64-Release-64/libTKBin.so
./Unix/x86_64-Release-64/libTKBin.so.11
./Unix/x86_64-Release-64/libTKBin.so.11.0.0

but apparently those are not found during testing.

janusw commented 6 years ago

Possibly related to #381?

janusw commented 6 years ago

Although the OCAFExport_test executable is supposed to be linked to libTKBin, ldd does not actually show such a dependency.

One way to fix the testsuite failures (without make install) seems to be to set LD_LIBRARY_PATH in the test environment:

diff --git a/test/OCAFExport_test/CMakeLists.txt b/test/OCAFExport_test/CMakeLists.txt
index f81798a3a..8d9f6ad86 100644
--- a/test/OCAFExport_test/CMakeLists.txt
+++ b/test/OCAFExport_test/CMakeLists.txt
@@ -5,6 +5,6 @@ if (OCE_OCAF AND NOT OCE_DISABLE_X11)
        file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../src/StdResource" BuildPluginDir)
        # Semi-colon is a delimiter in SET_TESTS_PROPERTIES and have to be escaped
        string(REPLACE ";" "\\;" BuildPluginDir "${BuildPluginDir}")
-       set_tests_properties(OCAFExportTestSuite.testExportAscii PROPERTIES ENVIRONMENT "CSF_PluginDefaults=${BuildPluginDir};CSF_StandardDefaults=${BuildPluginDir}")
-       set_tests_properties(OCAFExportTestSuite.testExportNonAscii PROPERTIES ENVIRONMENT "CSF_PluginDefaults=${BuildPluginDir};CSF_StandardDefaults=${BuildPluginDir}")
+       set_tests_properties(OCAFExportTestSuite.testExportAscii PROPERTIES ENVIRONMENT "CSF_PluginDefaults=${BuildPluginDir};CSF_StandardDefaults=${BuildPluginDir};LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${LIBRARY_OUTPUT_PATH}")
+       set_tests_properties(OCAFExportTestSuite.testExportNonAscii PROPERTIES ENVIRONMENT "CSF_PluginDefaults=${BuildPluginDir};CSF_StandardDefaults=${BuildPluginDir};LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${LIBRARY_OUTPUT_PATH}")
 endif ()
janusw commented 6 years ago

Alternatively one could try to fix it via the RPATH, e.g. something like: set(CMAKE_BUILD_RPATH ${LIBRARY_OUTPUT_PATH})

However, I did not actually get this to work.