-
Notifications
You must be signed in to change notification settings - Fork 51
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
Enhancements to Unit Testing, Code Coverage Reporting, and CI Build Process #45
base: main
Are you sure you want to change the base?
Conversation
-- Detecting CXX compile features - done 24 CMake Error at /usr/local/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message): 25 Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY 26 OPENGL_INCLUDE_DIR) 27 Call Stack (most recent call first): 28 /usr/local/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) 29 /usr/local/share/cmake-3.28/Modules/FindOpenGL.cmake:545 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) 30 CMakeLists.txt:45 (find_package) 31 -- Configuring incomplete, errors occurred! 32 Error: Process completed with exit code 1. Build with Ninja
0s 1 Run ninja -C build test 2 ninja -C build test 3 shell: /usr/bin/bash -e {0} 4 ninja: Entering directory `build' 5 ninja: error: unknown target 'test', did you mean 'help'? 6 Error: Process completed with exit code 1. Collect coverage
Run ninja -C build cov 2 ninja -C build cov 3 lcov --list build/coverage.info 4 shell: /usr/bin/bash -e {0} 5 ninja: Entering directory `build' 6 [1/1] Generating cov.info 7 FAILED: cov.info /home/runner/work/olcUTIL_Geometry2D/olcUTIL_Geometry2D/build/cov.info 8 cd /home/runner/work/olcUTIL_Geometry2D/olcUTIL_Geometry2D/build && /usr/bin/lcov -c -o cov.info -d . -b . --gcov-tool /usr/bin/gcov --ignore-errors mismatch && /usr/bin/lcov -r cov.info -o cov.info */tests/* */googletest/* */g++*/bits/* '*/g++-v13/*' && /usr/bin/lcov -l cov.info && /usr/bin/genhtml cov.info -output coverage && /usr/bin/lcov -l cov.info 2>/dev/null | grep Total | sed 's/|//g' | sed 's/Total://g' | awk '{print }' | sed s/%//g > coverage/total 9 Capturing coverage data from . 10 Subroutine read_intermediate_text redefined at /usr/bin/geninfo line 2623. 11 Subroutine read_intermediate_json redefined at /usr/bin/geninfo line 2655. 12 Subroutine intermediate_text_to_info redefined at /usr/bin/geninfo line 2703. 13 Subroutine intermediate_json_to_info redefined at /usr/bin/geninfo line 2792. 14 Subroutine get_output_fd redefined at /usr/bin/geninfo line 2872. 15 Subroutine print_gcov_warnings redefined at /usr/bin/geninfo line 2900. 16 Subroutine process_intermediate redefined at /usr/bin/geninfo line 2930. 17 Found gcov version: 11.4.0 18 geninfo: ERROR: unknown argument for --ignore-errors: mismatch 19 Using intermediate gcov format 20 ninja: build stopped: subcommand failed. 21 Error: Process completed with exit code 1. Generate JSON coverage report
lcov: ERROR: cannot read file build/coverage.info! 85 Reading tracefile build/coverage.info 86 Error: Process completed with exit code 9. Generate JSON coverage report
Firstly thanks for doing this! Secondly, I'm utterly out of my depth with this sort of thing, so I've given this PR some visibility on the discord server. It'll take me a little while to understand what all this is for (by that i mean, of course i get whats happening, but ive not used git and github in this way before). So please bear with me while I learn about it 😄 |
function and line coverage is 100% with only 3 tests
The coverage report consistently shows 100% due to the project being header-only. This does not reflect actual coverage. I found a Stack Overflow thread discussing better coverage for such libraries, which I'm still reviewing: https://stackoverflow.com/questions/9666800/getting-useful-gcov-results-for-header-only-libraries Meanwhile, the colored lines in the HTML report help visually indicate tested lines. |
This pull request introduces several improvements to the project's testing and continuous integration (CI) workflow. Below is a summary of the changes:
Unit Tests:
tests/
directory. I kept it very simple and only implemented three tests.CMakeLists.txt
now allow these tests to be included in the build when the-DDENABLE_GEOM2D_UNIT_TESTS=ON
option is provided. I only tested this on Linux, though.GitHub Actions for CI:
.github/workflows/code_coverage.yml
file.Code Coverage Report:
Current Limitation:
gcovr
tool, which is preventing the generation of the code coverage report.This pull request aims to bolster the robustness of our codebase and improve the visibility of our testing efforts. Your review and feedback are welcome.
Example output of the unit test:
Screenshots of the code coverage report:
As it the code is in only one header file this listing is not very useful:
When you click on the file, you can see the lines highlighted, that were executed during the unit tests: