From a08a0b3aac0e03a9c1f43c88e53e038550e551bd Mon Sep 17 00:00:00 2001 From: Tao He Date: Sun, 5 Mar 2023 21:37:43 +0800 Subject: [PATCH] Fixes Signed-off-by: Tao He --- .github/workflows/build-test.yml | 3 +++ tst/CMakeLists.txt | 10 +++++++++- tst/MemLeakWatcherTest.cpp | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 15362cd..74c1a56 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,6 +6,9 @@ concurrency: group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} cancel-in-progress: true +env: + SEGFAULT_SIGNALS: all + jobs: build: runs-on: ${{ matrix.os }} diff --git a/tst/CMakeLists.txt b/tst/CMakeLists.txt index 3cca3f0..a8cfe9f 100644 --- a/tst/CMakeLists.txt +++ b/tst/CMakeLists.txt @@ -23,7 +23,15 @@ foreach(testfile ${TEST_FILES}) target_include_directories(${test_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen) target_include_directories(${test_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen/proto) - target_link_libraries(${test_name} etcd-cpp-api) + target_link_libraries(${test_name} PRIVATE etcd-cpp-api) + + if(UNIX AND NOT APPLE) + if(CMAKE_VERSION VERSION_LESS 3.13) + target_link_libraries(${test_name} PRIVATE -Wl,--no-as-needed -lSegFault -Wl,--as-needed) + else() + target_link_options(${test_name} PRIVATE -Wl,--no-as-needed -lSegFault -Wl,--as-needed) + endif() + endif() add_dependencies(etcd_tests ${test_name}) endforeach() diff --git a/tst/MemLeakWatcherTest.cpp b/tst/MemLeakWatcherTest.cpp index 5f276f1..3f1f5a6 100644 --- a/tst/MemLeakWatcherTest.cpp +++ b/tst/MemLeakWatcherTest.cpp @@ -49,7 +49,7 @@ TEST_CASE("watch shouldn't leak memory") // issue some changes to see if the watcher works etcd::Client client(etcd_url); std::unique_ptr watcher; - for (int round = 0; round < 1000; ++round) { + for (int round = 0; round < 10 /* update this value to make it run for longer */; ++round) { if (round % 50 == 0) { std::cout << "starting round " << round << std::endl; }