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

Magically improve coverage #6345

Merged
merged 6 commits into from
Oct 16, 2019

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented Oct 14, 2019

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

Now that the upstream bug (rust-lang#45511) is fixed. Remove this workaround!
@mvines
Copy link
Member

mvines commented Oct 14, 2019

cc: rust-lang/rust#45511

@mvines mvines added the CI Pull Request is ready to enter CI label Oct 14, 2019
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Oct 14, 2019
@mvines
Copy link
Member

mvines commented Oct 14, 2019

Weird, cargo +nightly-2019-10-03 test --target-dir target/cov --lib --all --exclude solana-local-cluster didn't like this at all -- it just died. It works for you locally @ryoqun?

@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

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...

@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

Also, I'll split the RUST_LOG thing from this PR.

@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

Also, I'll split the RUST_LOG thing from this PR.

Sorry, I was completely mistook... After, some degree of investigation, it's found that the workaround is still needed. Even grcov uses this as a black magic with no justification or explanation. So I restored it and refreshed the comment. a82a494

@ryoqun ryoqun changed the title Delete old workaround and magically improve coverage Magically improve coverage Oct 16, 2019
@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

cc: rust-lang/rust#51705

@@ -14,13 +14,14 @@ reportName="lcov-${CI_COMMIT:0:9}"

if [[ -n $1 ]]; then
crate="--package $1"
shift
Copy link
Member Author

Choose a reason for hiding this comment

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

_ 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
Copy link
Member Author

@ryoqun ryoqun Oct 16, 2019

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Member

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

Copy link
Member Author

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

@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

@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...

@mvines mvines added the CI Pull Request is ready to enter CI label Oct 16, 2019
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Oct 16, 2019
@codecov
Copy link

codecov bot commented Oct 16, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@79e32c9). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff            @@
##             master   #6345   +/-   ##
========================================
  Coverage          ?   69.4%           
========================================
  Files             ?     219           
  Lines             ?   46946           
  Branches          ?       0           
========================================
  Hits              ?   32597           
  Misses            ?   14349           
  Partials          ?       0

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"
Copy link
Member

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

Copy link
Member Author

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

@mvines mvines added the automerge Merge this Pull Request automatically once CI passes label Oct 16, 2019
Copy link
Member

@mvines mvines left a 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!

@solana-grimes solana-grimes merged commit b7b71b3 into solana-labs:master Oct 16, 2019
@ryoqun
Copy link
Member Author

ryoqun commented Oct 16, 2019

Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants