-
Notifications
You must be signed in to change notification settings - Fork 274
Add codecov #4448
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 codecov #4448
Conversation
Would it be possible to add a few comments to clarify, including a full commit message? This looks like a piece of black magic right now. Useful documentation would include links to documentation that explain that this is the way to interact with codecov.io. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a work-in-progress experiment by Yumi, which is not intended to be merged just yet. I'm putting a blocking comment here for now, until such times as the experiments are over and we can then decided whether to merge or close.
If we're talking code coverage, here's what I'm dreaming of:
|
A long standing problem with the CPROVER code base is functionality bit-rotting because everyone assumed someone else was using / testing it. If this could help us identify or even avoid this, it would be great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 3ccfd64).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106160190
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: a62bf2d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106437109
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 23c389f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106458365
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 8cbcbce).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106465840
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
09dbbc0
to
8863565
Compare
.travis.yml
Outdated
@@ -4,7 +4,7 @@ jobs: | |||
include: | |||
|
|||
- &formatting-stage | |||
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test | |||
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spurious change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit was removed
buildspec-linux-make-gcc-cov.yml
Outdated
- '/var/lib/apt/lists/**/*' | ||
- '/root/.ccache/**/*' | ||
- '/root/.cache/codecov.sh' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the spaces in this line
5c0316d
to
2d7a508
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 2d7a508).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113725873
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reasonably happy for this to go in as it is, but I've left a couple of queries as comments that would be good to check.
- make -C jbmc/unit test | ||
- make -C jbmc/regression test | ||
- lcov --capture --directory . --output-file ./lcov.info | ||
- VCS_PULL_REQUEST=$(echo $CODEBUILD_SOURCE_VERSION | sed 's/pr\///g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is VCS_PULL_REQUEST actually used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure. As I referred in another your question. I took this 4 lines of scripts from codecov/codecov-python#140.
- VCS_PULL_REQUEST=$(echo $CODEBUILD_SOURCE_VERSION | sed 's/pr\///g') | ||
- COV_SCRIPT=/root/.cache/codecov.sh | ||
- if [ ! -f "$COV_SCRIPT" ]; then curl -s https://codecov.io/bash > "$COV_SCRIPT"; fi | ||
- echo "$CODEBUILD_INITIATOR" | grep GitHub && bash "$COV_SCRIPT" -t "$CODECOV_TOKEN" || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand what this line is doing (I'm afraid I don't know what the contents of $CODEBUILD_INITIATOR
is off the top of my head) - but I'm slightly worried by the || true
- which will basically mask any errors that occur here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, essentially I blindly used script example here
codecov/codecov-python#140
According to https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html, $CODEBUILD_INITIATOR
is "the entity that started the build". In our case, (also from log), I believe this is webhook?
[Container] 2019/05/30 09:35:34 Running command echo "$CODEBUILD_INITIATOR" | grep GitHub && bash "$COV_SCRIPT" -t "$CODECOV_TOKEN" || true
GitHub-Hookshot/0a2cefb
Do you want me to try removing the || true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly not sure on the || true
- I guess lets run it as is and see how reliable it is.
@@ -8,6 +8,11 @@ else | |||
CXXFLAGS += -Wall -pedantic -Werror -Wno-deprecated-declarations -Wswitch-enum | |||
endif | |||
|
|||
ifeq ($(CPROVER_WITH_PROFILING),1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you mentioned that somehow CMake unit tests fail if coverage is enabled, but I think it would still be preferable if we kept Make and CMake builds in sync, and at least adding these options to CMake would be good - even if you raise an issue in the GitHub issue tracker to cover whatever failures you see in CMake unit tests rather than also fixing them in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. The thing is this invariant violation happens only codebuild, and I've tried to reproduce it on local codebuild docker, it did not reproduce. I have a gut feeling though initially, cbmc-codecov environment was openjdk-8
, not standard-2.0
. Let me give me another go with cmake-coverage and if it's reproducible, I will raise an issue in the GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisr-diffblue , OK, so perhaps the invariant violation I observed was because of AWS image. I no longer observe it. I still have a problem codecov does not find existing coverage files from the VM. I will push just one more time with extra LCOV
command it should be able to report. In that case, do you want another buildspec file buildspec-linux-cmake-gcc-cov.yml
and CMakeLists.txt
to be part of this PR?
af5c1c2
to
5db16f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 5db16f5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113763817
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 6feed18).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113781916
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: 41365e2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113796061
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
to be enabled for coverage measurement
This is not a part of CI.
@peterschrammel and @chrisr-diffblue, I am requesting re-review as the current state is
As per request from @chrisr-diffblue, I checked However, I also realised that there is a quite a bit of difference in analysed lines between This trend is reproducible locally
Do you want me to investigate this on any further before merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: a780511).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113807199
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
@yumibagge @peterschrammel - Thanks Yumi for the extra clarification. I'm happy for this to go in as it is - but it would be nice to understand why cmake and make give different coverage results. It doesn't entirely surprise me, and I can think of a number of reasons why coverage might be different, but it would be good to be sure :-) However, I'm happy for that work to be done separately to this PR. |
I think this definitely needs to be investigated, but it can be done as a follow-up action. |
The purpose of this PR is to understand current CBMC coverage.
Below are justification of why I created
buildspec-linux-make-gcc-cov.yml
and modifiedconfig.inc
travis
vs.CodeBuild
😢
travis
has timeout =50min
and maximum log length10k
😢 codecov does not support CodeBuild
🔨 Therefore
CODECOV_TOKEN
needs to be set as a environment variable in Build detail (not in buildspec.xml)🔨 In order to coverage reporting available, needed to install
lcov
,curl
,python-pip
, thenpip install codecov
(This is to hopecodecov.sh
find allgcda
files)cmake
vs.make
😞
make
withCXXFLAGS
in the same line causes compile error🔨 to mitigate this, in
config.inc
, a new environment variableCPROVER_WITH_PROFILING
withCXXFLAGS
andLINKFLAGS
are added🔨 append
CPROVER_WITH_PROFILING=1
is added for eachmake
and alsomake -C regression test
as it's callingdriver
which also require coverage instrumentation❔
cmake
andmake
shows different statistics❔ it is unclear why it's reported failure when build is complete for
cmake
codecov script
😞
bash
does not work onCodeBuild
🔨 use the 4 line shell scripts
lcov
😞
codecov.sh
does not findgcda
files for some reasons, so had to generate coverage info file usinglcov