Skip to content

Commit

Permalink
test different coverage path
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Apr 21, 2024
1 parent 557210e commit f97414f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/.*' \
Expand Down Expand Up @@ -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/.*' \
Expand Down Expand Up @@ -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/.*' \
Expand Down
5 changes: 4 additions & 1 deletion src/file_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ namespace file_handler {
}

std::ifstream in(path);
return std::string { (std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>() };
std::istreambuf_iterator<char> begin(in);
std::istreambuf_iterator<char> end;
std::string contents(begin, end);
return contents;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f97414f

Please sign in to comment.