Skip to content
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

Add test with gtest #676

Merged
merged 6 commits into from
Oct 4, 2022
Merged

Conversation

Spacetown
Copy link
Member

This PR modifies the existing CMake tests to use the -DCMAKE_BUILD_TYPE=PROFILE as described in the docs.

In addition a new test is added which use the gtest library from the docker container.

@Spacetown Spacetown requested a review from latk October 3, 2022 19:22
@Spacetown Spacetown added this to the Upcoming release milestone Oct 3, 2022
@Spacetown Spacetown added QA related to testing, build infrastructure, etc Internal change Internal change not visible to user labels Oct 3, 2022
Copy link
Member

@latk latk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a reasonable test!

Once the tests start passing, of course. We'd have to either install gtest in the Github CI runner and on developer machines, or skip the new tests outside of Docker (see the GCOVR_ISOLATED_TEST token that's set in the Dockerfile and used in test_args.py)

Use a shallow clone.

Co-authored-by: Lukas Atkinson <[email protected]>
@Spacetown
Copy link
Member Author

Spacetown commented Oct 4, 2022

The test fails because the DTD for cobertura wasn't available. I'll update the test to use a copy of the DTD.

example_cobertura.xml:2: warning: failed to load external entity "http://cobertura.sourceforge.net/xml/coverage-04.dtd"

@Spacetown
Copy link
Member Author

Looks like a reasonable test!

Once the tests start passing, of course. We'd have to either install gtest in the Github CI runner and on developer machines, or skip the new tests outside of Docker (see the GCOVR_ISOLATED_TEST token that's set in the Dockerfile and used in test_args.py)

I searched for a solution but missed GCOVR_ISOLATED_TEST. Is there a easy way to check in test_gcovr.py if the lib is a available?

@latk
Copy link
Member

latk commented Oct 4, 2022

Is there a easy way to check in test_gcovr.py if the lib is a available?

At least on Linux, can query for the existence of a library with a suitable version like

pkg-config --atleast-version=1.12.0 gtest

@Spacetown
Copy link
Member Author

Is there a easy way to check in test_gcovr.py if the lib is a available?

At least on Linux, can query for the existence of a library with a suitable version like

pkg-config --atleast-version=1.12.0 gtest

Since there is no command for Windows I'll rely on GCOVR_ISOLATED_TEST.

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Base: 94.78% // Head: 95.22% // Increases project coverage by +0.43% 🎉

Coverage data is based on head (eea0fa7) compared to base (a747492).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
+ Coverage   94.78%   95.22%   +0.43%     
==========================================
  Files          24       24              
  Lines        3452     3495      +43     
  Branches      662      615      -47     
==========================================
+ Hits         3272     3328      +56     
+ Misses         99       94       -5     
+ Partials       81       73       -8     
Flag Coverage Δ
ubuntu-18.04 93.95% <100.00%> (?)
windows-2019 94.78% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gcovr/tests/test_args.py 98.86% <100.00%> (+<0.01%) ⬆️
gcovr/tests/test_gcovr.py 97.72% <100.00%> (+1.17%) ⬆️
gcovr/writer/cobertura.py 100.00% <0.00%> (ø)
gcovr/tests/test_config.py 100.00% <0.00%> (ø)
gcovr/tests/test_gcov_parser.py 100.00% <0.00%> (ø)
gcovr/tests/test_html_generator.py 100.00% <0.00%> (ø)
gcovr/workers.py 98.82% <0.00%> (+0.01%) ⬆️
gcovr/coverage.py 99.06% <0.00%> (+0.08%) ⬆️
gcovr/writer/html.py 95.29% <0.00%> (+0.11%) ⬆️
gcovr/merging.py 84.21% <0.00%> (+0.16%) ⬆️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Refactor existing usage of GCOVR_ISOLATED_TEST.
@Spacetown Spacetown force-pushed the add_test_with_gtest branch from 8d8aa35 to eea0fa7 Compare October 4, 2022 19:47
@Spacetown Spacetown merged commit 28e5c88 into gcovr:master Oct 4, 2022
@Spacetown Spacetown deleted the add_test_with_gtest branch October 4, 2022 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal change Internal change not visible to user QA related to testing, build infrastructure, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants