After rL301562, on FreeBSD the following unittest failures are being reported:
******************** TEST 'LLVM-Unit :: Support/DynamicLibrary/DynamicLibraryTests/DynamicLibrary.Shutdown' FAILED ******************** Note: Google Test filter = DynamicLibrary.Shutdown [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from DynamicLibrary [ RUN ] DynamicLibrary.Shutdown /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:107: Failure Value of: DL.isValid() Actual: false Expected: true /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:108: Failure Value of: Err.empty() Actual: false Expected: true /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:112: Failure Value of: SS != nullptr Actual: false Expected: true ******************** TEST 'LLVM-Unit :: Support/DynamicLibrary/DynamicLibraryTests/DynamicLibrary.Overload' FAILED ******************** Note: Google Test filter = DynamicLibrary.Overload [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from DynamicLibrary [ RUN ] DynamicLibrary.Overload /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:65: Failure Value of: DL.isValid() Actual: false Expected: true /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:66: Failure Value of: Err.empty() Actual: false Expected: true /share/dim/src/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:69: Failure Value of: GS != nullptr && GS != &TestA Actual: false Expected: true
This is because the test uses getMainExecutable("DynamicLibraryTests", Ptr);, and since the path does not contain any slashes, retrieving the main executable will not work.
I chose to reimplement getMainExecutable() for FreeBSD using sysctl(3), which is more reliable than fiddling with relative or absolute paths.
However, this approach might not fix any failures for other OSes. So I also added retrieval of the original argv[] from the GoogleTest framework, to use as a fallback.
I also thought that the final fallback name might be "./DynamicLibraryTests", but that will not work on Windows. Is this test run on Windows at all?
|| defined ( __NetBSD__)