Skip to content

Code coverage support for CacheLib #50

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

Merged
merged 1 commit into from
Jan 20, 2023
Merged

Code coverage support for CacheLib #50

merged 1 commit into from
Jan 20, 2023

Conversation

guptask
Copy link

@guptask guptask commented Jan 6, 2023

Packages needed are lcov and genhtml.
Coverage requires addition of new compile and linker flags. It can be encapsulated as an option. Currently it is the hard-coded.


This change is Reviewable

@guptask guptask self-assigned this Jan 6, 2023
Copy link
Member

@igchor igchor left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @guptask)


cachelib/CMakeLists.txt line 89 at r1 (raw file):

# Add code coverage
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")

Can add an option to enable/disable coverage?

Something like:

if(COVERAGE_ENABLED)
    # Add code coverage
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()

@guptask
Copy link
Author

guptask commented Jan 17, 2023

cachelib/CMakeLists.txt line 89 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

Can add an option to enable/disable coverage?

Something like:

if(COVERAGE_ENABLED)
    # Add code coverage
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()

Done.

@guptask guptask force-pushed the gcov branch 2 times, most recently from fbcc7eb to c6598b7 Compare January 18, 2023 00:01
@guptask guptask requested a review from igchor January 18, 2023 00:05
Copy link
Member

@igchor igchor left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @guptask)


run_code_coverage.sh line 11 at r2 (raw file):

# Track coverage
lcov -c -i -b . -d . -o Coverage.baseline

what is this Coverage.baseline? what does it contain if no tests were run?

Copy link
Member

@igchor igchor left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @guptask)


run_code_coverage.sh line 3 at r2 (raw file):

#!/bin/bash

BUILD_DIR='build-cachelib'

I'm not sure if you should put compilation/installation step here - it would be better for this script to be standalone.

@guptask
Copy link
Author

guptask commented Jan 18, 2023

run_code_coverage.sh line 3 at r2 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

I'm not sure if you should put compilation/installation step here - it would be better for this script to be standalone.

Are you saying it is better to split this into 2 scripts - build_coverage and generate_coverage ?

@guptask
Copy link
Author

guptask commented Jan 18, 2023

run_code_coverage.sh line 11 at r2 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

what is this Coverage.baseline? what does it contain if no tests were run?

Even if you don't run unit tests, the coverage report shows non-zero coverage for few files. I'm not sure exactly why that is the case. These commands allow us to include those coverage stats in the final report.

Copy link
Member

@igchor igchor left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on @guptask)


run_code_coverage.sh line 3 at r2 (raw file):

Previously, guptask (Sounak Gupta) wrote…

Are you saying it is better to split this into 2 scripts - build_coverage and generate_coverage ?

I mean, I'm not sure if we need the build script at all. We can just document what flag you need to pass to cmake to enable coverage.


run_code_coverage.sh line 11 at r2 (raw file):

Previously, guptask (Sounak Gupta) wrote…

Even if you don't run unit tests, the coverage report shows non-zero coverage for few files. I'm not sure exactly why that is the case. These commands allow us to include those coverage stats in the final report.

Ok, got it.

@guptask guptask requested a review from igchor January 19, 2023 23:07
@guptask guptask merged commit d18ac58 into intel:develop Jan 20, 2023
byrnedj pushed a commit that referenced this pull request Jul 23, 2023
Fix issue with "Destorying an unresolved handle"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants