From f97414fff44eac57a065652475349123cf374220 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:48:37 -0400 Subject: [PATCH] test different coverage path --- .github/workflows/CI.yml | 3 +++ src/file_handler.cpp | 5 ++++- tests/CMakeLists.txt | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fddd0d912e2..5ad162768c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -502,6 +502,7 @@ jobs: run: | ${{ steps.python.outputs.python-path }} -m pip install gcovr ${{ steps.python.outputs.python-path }} -m gcovr -r .. \ + --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ --exclude '.*tests/.*' \ @@ -840,6 +841,7 @@ jobs: cd ${build_dir} ${{ steps.python.outputs.python-path }} -m pip install gcovr sudo ${{ steps.python.outputs.python-path }} -m gcovr -r ../${dir} \ + --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ --exclude '.*${dir}/tests/.*' \ @@ -1086,6 +1088,7 @@ jobs: run: | ${{ steps.python-path.outputs.python-path }} -m pip install gcovr ${{ steps.python-path.outputs.python-path }} -m gcovr -r .. \ + --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ --exclude '.*tests/.*' \ diff --git a/src/file_handler.cpp b/src/file_handler.cpp index 1c7f98e9b3b..b108fa8fbfa 100644 --- a/src/file_handler.cpp +++ b/src/file_handler.cpp @@ -31,7 +31,10 @@ namespace file_handler { } std::ifstream in(path); - return std::string { (std::istreambuf_iterator(in)), std::istreambuf_iterator() }; + std::istreambuf_iterator begin(in); + std::istreambuf_iterator end; + std::string contents(begin, end); + return contents; } /** diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e4583f9c6a5..cdc091b3dc1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,8 +19,8 @@ include_directories("${GTEST_SOURCE_DIR}/googletest/include" "${GTEST_SOURCE_DIR # coverage # https://gcovr.com/en/stable/guide/compiling.html#compiler-options -set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -O1") -set(CMAKE_C_FLAGS "-fprofile-arcs -ftest-coverage -O1") +set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -O0") +set(CMAKE_C_FLAGS "-fprofile-arcs -ftest-coverage -O0") # if windows if (WIN32)