-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Magically improve coverage #6345
Magically improve coverage #6345
Conversation
Now that the upstream bug (rust-lang#45511) is fixed. Remove this workaround!
Weird, |
Sorry, it seems that this doesn't work out-of-box locally too. Heh, it turns out this isn't free lunch for coverage greens.... First, I needed a fix in the upstream `librocksdb-sys' crate.. rust-rocksdb/rust-rocksdb#339, which in turn would be blocked by our #5507 even if the PR is accepted. (This may be my system dependant issue.) Sure long way... |
Also, I'll split the |
@@ -14,13 +14,14 @@ reportName="lcov-${CI_COMMIT:0:9}" | |||
|
|||
if [[ -n $1 ]]; then | |||
crate="--package $1" | |||
shift |
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.
To forward the rest to cargo test
at https://github.com/solana-labs/solana/pull/6345/files#diff-c29225768574b8edd4f3608f595c29f7R41, shift
$1
here.
scripts/coverage.sh
Outdated
_ cargo +$rust_nightly test --target-dir target/cov --lib $crate | ||
RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov --lib --no-run $crate "$@" | ||
# shellcheck disable=SC2086 # | ||
RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov --lib $crate "$@" 2> /dev/null |
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.
Separated compile and test for easier debugging because the messages from cargo build
would be also discarded altogether otherwise.
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.
Why hide stderr here? 2> /dev/null
?
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.
Otherwise, tons of tons of logs will be printed on the terminal, after all we're running all test with trace level. Maybe, better off to note that as a comment?
Or, should we stash the logs to 2> $(mktemp)
? I think this is overdue because we're in the coverage run. It's unlikely we need to debug using this build.
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.
Ah, I see. Yes there are times when the build only fails in a coverage run in CI (we had an occurrence of this today in fact!) so being able to view the log could be helpful.
We don't need anything fancy like mktemp
here though. Instead just redirect to a fixed file, coverage-stderr.log
, then use https://github.com/solana-labs/solana/blob/master/ci/upload-ci-artifact.sh to include the log file as a buildkite artifact for easy access by anybody who wants it
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.
Thanks for explanation done 98005bf..
By the way, I'm guessing for the log file to be ranges of X00MB.. Let's see if its filesize is too big, or not... If that's concern, I'll just compress it via bz2
.
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.
Yay, build passed.
Heh, I was pessimistic a bit, it seems.
@mvines Hi, are ~100MB artifacts a bit concern? Should compress?
artifact: target/cov/coverage-stderr.log
-rw-r--r-- 1 buildkite-agent buildkite-agent 94182845 Oct 16 19:03 target/cov/coverage-stderr.log
+ buildkite-agent artifact upload target/cov/coverage-stderr.log
2019-10-16 19:05:27 INFO Found 1 files that match "target/cov/coverage-stderr.log"
2019-10-16 19:05:27 INFO Creating (0-1)/1 artifacts
2019-10-16 19:05:28 INFO Uploading artifact 8e17d76a-93ea-4883-99d9-3606292791b4 target/cov/coverage-stderr.log (94182845 bytes)
2019-10-16 19:05:31 INFO Successfully annotated build
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.
Oh wow. Sure please gzip
it. I don't expect this to be used very often so the extra decompression step for the user should be no big deal
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.
it really shrank!
-rw-r--r-- 1 buildkite-agent buildkite-agent 10056926 Oct 16 23:51 target/cov/coverage-stderr.log.gz
+ buildkite-agent artifact upload target/cov/coverage-stderr.log.gz
2019-10-16 23:52:52 INFO Found 1 files that match "target/cov/coverage-stderr.log.gz"
2019-10-16 23:52:52 INFO Creating (0-1)/1 artifacts
2019-10-16 23:52:52 INFO Uploading artifact 98e02c81-9b3f-456d-95ee-4826660c7cb3 target/cov/coverage-stderr.log.gz (10056926 bytes)
2019-10-16 23:52:54 INFO Successfully annotated build
@mvines Hi, I updated this PR; in short, workaround is still needed.. Please have a look if there is some time! I hope CI passes with more greens this time, really... |
Codecov Report
@@ Coverage Diff @@
## master #6345 +/- ##
========================================
Coverage ? 69.4%
========================================
Files ? 219
Lines ? 46946
Branches ? 0
========================================
Hits ? 32597
Misses ? 14349
Partials ? 0 |
ci/test-coverage.sh
Outdated
stderr_log=target/cov/coverage-stderr.log | ||
compressed_stderr_log="${stderr_log}.gz" | ||
gzip < "$stderr_log" > "$compressed_stderr_log" | ||
upload-ci-artifact "$compressed_stderr_log" |
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.
How about this instead:
gzip target/cov/coverage-stderr.log
upload-ci-artifact target/cov/coverage-stderr.log.gz
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.
yeah, It looks nicer; ccafb52.
Just that I'm too fond of redirections and pipes.. :p
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.
looks good to me, thanks!
Yay! |
Problem
There is an outdated workaround. And logging macros are red by default, which is a kind of eyesore..
Summary of Changes
Now that the upstream bug (rust-lang#45511) is fixed. Remove this workaround!
Also, enable logging with maximum level and discard 'em all just for more greens with no extra effort! :D