Gtest discover_tests 在 Github 操作中失败:进程因超时而终止
Gtest discover_tests failing in Github Actions: Process terminated due to timeout
我正在使用 google-test(gtest) 与 CMake 和 运行 单元测试作为 GitHub ci 作业 Linux 和 Mac。 Linux 个作业成功通过。但是,mac 跑步者出现错误。
错误是
CMake Error at /usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:77 (message):
Error running test executable.
Path: '/Users/runner/work/splitwebp/build/test/splitwebp_tests'
Result: Process terminated due to timeout
Output:
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:173 (gtest_discover_tests_impl)
这是测试目录CMakelists.txt
# CMake config file for unit tests
# Requiring V 3.10 for gtest_discover_tests
cmake_minimum_required(VERSION 3.10)
find_package(OpenCV REQUIRED)
enable_testing()
# finds all .cpp files under this directory (./test) and add them to executable
file(GLOB_RECURSE tests "*.cpp")
file(GLOB_RECURSE source "../src/*.cpp")
add_executable(splitwebp_tests ${tests} ${source})
include_directories("../3rdparty/libwebp/include")
# Link gtest libraries
target_link_libraries(splitwebp_tests ${OpenCV_LIBS})
target_link_libraries(splitwebp_tests webp webpdemux pthread)
target_link_libraries(splitwebp_tests gtest_main)
set(CTEST_OUTPUT_ON_FAILURE 1)
# Find all tests in all .cpp files and convert to CTests
include(GoogleTest)
gtest_discover_tests(splitwebp_tests)
如何修复 CI 管道?
问题是 gtest_discover_tests(...)
花费的时间太长,因此超时。显而易见的解决方案是增加超时限制。
行
gtest_discover_tests(splitwebp_tests)
可以替换为
gtest_discover_tests(splitwebp_tests PROPERTIES TIMEOUT 600)
我正在使用 google-test(gtest) 与 CMake 和 运行 单元测试作为 GitHub ci 作业 Linux 和 Mac。 Linux 个作业成功通过。但是,mac 跑步者出现错误。 错误是
CMake Error at /usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:77 (message):
Error running test executable.
Path: '/Users/runner/work/splitwebp/build/test/splitwebp_tests'
Result: Process terminated due to timeout
Output:
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:173 (gtest_discover_tests_impl)
这是测试目录CMakelists.txt
# CMake config file for unit tests
# Requiring V 3.10 for gtest_discover_tests
cmake_minimum_required(VERSION 3.10)
find_package(OpenCV REQUIRED)
enable_testing()
# finds all .cpp files under this directory (./test) and add them to executable
file(GLOB_RECURSE tests "*.cpp")
file(GLOB_RECURSE source "../src/*.cpp")
add_executable(splitwebp_tests ${tests} ${source})
include_directories("../3rdparty/libwebp/include")
# Link gtest libraries
target_link_libraries(splitwebp_tests ${OpenCV_LIBS})
target_link_libraries(splitwebp_tests webp webpdemux pthread)
target_link_libraries(splitwebp_tests gtest_main)
set(CTEST_OUTPUT_ON_FAILURE 1)
# Find all tests in all .cpp files and convert to CTests
include(GoogleTest)
gtest_discover_tests(splitwebp_tests)
如何修复 CI 管道?
问题是 gtest_discover_tests(...)
花费的时间太长,因此超时。显而易见的解决方案是增加超时限制。
行
gtest_discover_tests(splitwebp_tests)
可以替换为
gtest_discover_tests(splitwebp_tests PROPERTIES TIMEOUT 600)