Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and unit test failures #827

Open
semihc opened this issue Dec 5, 2022 · 1 comment
Open

Build and unit test failures #827

semihc opened this issue Dec 5, 2022 · 1 comment

Comments

@semihc
Copy link

semihc commented Dec 5, 2022

Hi,

I am trying to build easyloggingpp on Ubuntu 22.4 (WSL2) with Gcc 12.1.0. The CMake configuration fails with following message:

CMake Warning (dev) at /opt/stow/cmake-3.24.3-linux-x86_64/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GTest) does
  not match the name of the calling package (gtest).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Findgtest.cmake:152 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:78 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)

I made following changes to the CMakeFile to overcome the above issue:

semihc@ALTAY:/opt/TC/ext/easyloggingpp$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 538cc8a..654db04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,8 @@ if (test)
     require_cpp11()
     set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

-    find_package (gtest REQUIRED)
+    #-find_package (gtest REQUIRED)
+    find_package(GTest CONFIG REQUIRED) # Gtest/mock

     include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})

@@ -98,7 +99,8 @@ if (test)
     )

     # Standard linking to gtest stuff.
-    target_link_libraries(easyloggingpp-unit-tests gtest gtest_main)
+    #- target_link_libraries(easyloggingpp-unit-tests gtest gtest_main)
+    target_link_libraries(easyloggingpp-unit-tests GTest::gtest GTest::gtest_main)

     add_test(NAME easyloggingppUnitTests COMMAND easyloggingpp-unit-tests -v)
 endif()


However, This time I encounter unit test failures:

1: [----------] 11 tests from WriteAllTest (3092 ms total)
1:
1: [----------] Global test environment tear-down
1: [==========] 79 tests from 26 test suites ran. (11934 ms total)
1: [ PASSED ] 77 tests.
1: [ FAILED ] 2 tests, listed below:
1: [ FAILED ] CommandLineArgsTest.LoggingFlagsArg
1: [ FAILED ] HelpersTest.ConvertTemplateToStdString
1:
1: 2 FAILED TESTS
1/1 Test #1: easyloggingppUnitTests ...........***Failed 12.09 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 12.09 sec

The following tests FAILED:
1 - easyloggingppUnitTests (Failed)
Errors while running CTest
Output from these tests are in: /opt/TC/ext/easyloggingpp/bld_gcc/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
semihc@ALTAY:/opt/TC/ext/easyloggingpp$

Do you have any advice to fix unit tests?

Regards,
Semih

@musicinmybrain
Copy link

musicinmybrain commented Jan 27, 2023

I maintain the easyloggingpp package in Fedora Linux.

I previously filed #816 about this.

I don’t know what the root cause is, but I am working around the failures by calling easyloggingpp-unit-tests with the argument --gtest_filter=-CommandLineArgsTest.LoggingFlagsArg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants