- Notifications
You must be signed in to change notification settings - Fork 500
Description
I believe it would be great to better integrate googletest into the opentelemetry-cpp's build process, so when distro/system-wide googletest source code is available, it can be built along with opentelemetry-cpp.
As googletest upstream recommends, gtest and gmock should be compiled with the same flags than the tested code (http://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d). Upstream doesn't recommend to rely on precompiled libraries.
I found a related issue while packaging opentelemetry-cpp to debian, getting tests that end up with FATAL
, even if they should pass. E.g.:
test 515 Start 515: exporter.otlp.OtlpHttpExporterTest.Shutdown 515: Test command: /home/santiago/cpp/opentelemetry-cpp-1.19.0/obj-x86_64-linux-gnu/exporters/otlp/otlp_http_exporter_test "--gtest_filter=OtlpHttpExporterTest.Shutdown" 515: Working Directory: /home/santiago/cpp/opentelemetry-cpp-1.19.0/obj-x86_64-linux-gnu/exporters/otlp 515: Test timeout computed to be: 1500 515: Running main() from ./googletest/src/gtest_main.cc 515: Note: Google Test filter = OtlpHttpExporterTest.Shutdown 515: [==========] Running 1 test from 1 test suite. 515: [----------] Global test environment set-up. 515: [----------] 1 test from OtlpHttpExporterTest 515: [ RUN ] OtlpHttpExporterTest.Shutdown 515: [Error] File: ./exporters/otlp/src/otlp_http_exporter.cc:150 [OTLP TRACE HTTP Exporter] ERROR: Export 0 trace span(s) failed, exporter is shutdown 515: [ OK ] OtlpHttpExporterTest.Shutdown (0 ms) 515: [----------] 1 test from OtlpHttpExporterTest (0 ms total) 515: 515: [----------] Global test environment tear-down 515: [==========] 1 test from 1 test suite ran. (0 ms total) 515: [ PASSED ] 1 test. 515: 515: [ FATAL ] ./googletest/include/gtest/internal/gtest-port.h:1811:: pthread_key_delete(key_)failed with error 22 515/609 Test #515: exporter.otlp.OtlpHttpExporterTest.Shutdown ..........................................................Subprocess aborted***Exception: 0.01 sec Running main() from ./googletest/src/gtest_main.cc Note: Google Test filter = OtlpHttpExporterTest.Shutdown [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from OtlpHttpExporterTest [ RUN ] OtlpHttpExporterTest.Shutdown [Error] File: ./exporters/otlp/src/otlp_http_exporter.cc:150 [OTLP TRACE HTTP Exporter] ERROR: Export 0 trace span(s) failed, exporter is shutdown [ OK ] OtlpHttpExporterTest.Shutdown (0 ms) [----------] 1 test from OtlpHttpExporterTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. [ FATAL ] ./googletest/include/gtest/internal/gtest-port.h:1811:: pthread_key_delete(key_)failed with error 22
I understand that for opentelemetry-cpp's CI, googletest is setup with ./ci/setup_googletest.sh, but it is suboptimal from a distro packaging PoV.
I'd propose to rely on CMake's very features (ExternalProject
/ FindGTest
) to build and find the googletest libraries. I belive