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

fix: rust coverage test meets compile error for missing debuginfo #1740

Merged
merged 9 commits into from
Apr 24, 2023

Conversation

yihau
Copy link
Contributor

@yihau yihau commented Apr 20, 2023

Hi @Xuanwo, does this one look correct?

Close #1652

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2023

Codecov Report

Patch coverage: 47.05% and project coverage change: +0.25 🎉

Comparison is base (4a8b5f5) 28.87% compared to head (9bbf8b4) 29.12%.

❗ Current head 9bbf8b4 differs from pull request most recent head 10b37a7. Consider uploading reports for the commit 10b37a7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1740      +/-   ##
==========================================
+ Coverage   28.87%   29.12%   +0.25%     
==========================================
  Files          49       49              
  Lines       17202    17468     +266     
  Branches     8268     8470     +202     
==========================================
+ Hits         4967     5088     +121     
- Misses       7221     7297      +76     
- Partials     5014     5083      +69     
Impacted Files Coverage Δ
src/compiler/rust.rs 33.37% <47.05%> (+0.51%) ⬆️

... and 21 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sylvestre
Copy link
Collaborator

I would like to see a test for that please. Thanks

@Xuanwo
Copy link
Collaborator

Xuanwo commented Apr 20, 2023

I don't know how optional works, maybe it ok for us to ignore all errors happened while writing cache?

@yihau
Copy link
Contributor Author

yihau commented Apr 20, 2023

I found the feature was introduced cuz .dwo files may absent.

sccache/src/compiler/gcc.rs

Lines 536 to 542 in 4a8b5f5

outputs.insert(
"dwo",
ArtifactDescriptor {
path: dwo,
optional: true,
},
);

in the same PR, the author try to keep .gcno having the original behavior I think. so he make:

sccache/src/compiler/gcc.rs

Lines 550 to 556 in 4a8b5f5

outputs.insert(
"gcno",
ArtifactDescriptor {
path: gcno,
optional: false,
},
);

tbh I have no idea how sccache deal with those .gcno files. maybe .gcno are also optional files?

@yihau
Copy link
Contributor Author

yihau commented Apr 20, 2023

yeah. I think .gcno may absent as well in the newer nightly rust version.

I found that when we try to do coverage test,

in nightly-2023-02-08, all file in deps have .d, .gcda, .gcno and -cgu.0.rcgu.o. 4 different extensions file.

but in nightly-2023-02-09, some of deps only have .d file

btw, I tested it in this repo https://github.com/yihau/sccache-coverage-build-error

Copy link
Contributor Author

@yihau yihau left a comment

Choose a reason for hiding this comment

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

copied the mechanism from c complier

src/compiler/rust.rs Show resolved Hide resolved
src/compiler/rust.rs Outdated Show resolved Hide resolved
@Xuanwo
Copy link
Collaborator

Xuanwo commented Apr 20, 2023

Mostly LGTM! Can you add a job which uses rust coverage to make sure it works? I think we can add a new job called issues-1652.

Copy link
Collaborator

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, thanks a lot!

@ryoqun
Copy link

ryoqun commented Apr 20, 2023

hi, thanks for quick review! I'm from the same org (@solana-labs) with @yihau

X ci / test freebsd-13.1 rust stable (macos-12, 13.1) (pull_request) Failing after 18m

i couldn't decipher the error from the ci build...

in nightly-2023-02-08, all file in deps have .d, .gcda, .gcno and -cgu.0.rcgu.o. 4 different extensions file.

but in nightly-2023-02-09, some of deps only have .d file

so, it looks like the regression window is quite narrow: rust-lang/rust@bd39bbb...ef934d9

among them, this came to my attention: rust-lang/rust@6f38fd5, rust-lang/rust#107778

which in turn contains this: rust-lang/cargo#11252

@Xuanwo
Copy link
Collaborator

Xuanwo commented Apr 20, 2023

i couldn't decipher the error from the ci build...

I believe this CI failure is not related to this PR. Please ignore it.

@Xuanwo Xuanwo changed the title ignore file not found error fix: rust coverage test meets compile error for missing debuginfo Apr 20, 2023
@@ -609,3 +609,32 @@ jobs:
${SCCACHE_PATH} --show-stats

${SCCACHE_PATH} --show-stats | grep -e "Cache hits\s*[1-9]"

issues-1652:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please rename the test for something more explicit?

Copy link
Contributor Author

@yihau yihau Apr 21, 2023

Choose a reason for hiding this comment

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

do you have any prefer name? is missing-debug-info a good name?

strategy:
fail-fast: false
matrix:
version: [nightly-2023-02-08, nightly-2023-02-09]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it necessary to hard-coded the date?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found it's broken since the version nightly-2023-02-09 so I choose those two version to test.

@sylvestre
Copy link
Collaborator

sylvestre commented Apr 21, 2023 via email

@yihau
Copy link
Contributor Author

yihau commented Apr 21, 2023

oh. do you mean that 1) change job name to test coverage and 2) use the latest nightly version ?

@yihau
Copy link
Contributor Author

yihau commented Apr 21, 2023

Hi @sylvestre, I have a diff in my local. it looks like:

diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index cf3e909..3ad4cbe 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -610,14 +610,9 @@ jobs:

           ${SCCACHE_PATH} --show-stats | grep -e "Cache hits\s*[1-9]"

-  issues-1652:
+  rust-test-coverage:
     runs-on: ubuntu-latest
     needs: build
-
-    strategy:
-      fail-fast: false
-      matrix:
-        version: [nightly-2023-02-08, nightly-2023-02-09]
     steps:
       - uses: actions/download-artifact@v3
         with:
@@ -628,11 +623,11 @@ jobs:

       - name: Coverage test
         run: |
-          rustup toolchain install ${{ matrix.version }}
+          rustup toolchain install nightly
           cargo new hello
           cd hello
           echo "serde = { version = \"1.0\", features = [\"derive\"] }" >> Cargo.toml
-          cargo +${{ matrix.version }} test
+          cargo +nightly test
         env:
           RUSTC_WRAPPER: /home/runner/.cargo/bin/sccache
           CARGO_INCREMENTAL: "0"

I will push this code if you think it is better

@sylvestre
Copy link
Collaborator

yeah, exactly what I was expecting :)

@Xuanwo
Copy link
Collaborator

Xuanwo commented Apr 24, 2023

This PR seems ready to go now. @sylvestre Do you wanna to take another look?

@sylvestre sylvestre merged commit 3b70d6b into mozilla:main Apr 24, 2023
@ryoqun
Copy link

ryoqun commented Apr 25, 2023

hey, it looks like v0.4.2 has shipped yesterday and includes this pr. really thanks for it. but i'm wondering why v0.4.2 isn't still appearing at crates.io? (we use that release channel for convenience as part of our docker ci image generation).

@Xuanwo
Copy link
Collaborator

Xuanwo commented Apr 25, 2023

seems we didn't push to crates.io in our release workflow.

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.

rust coverage test could not compile error
5 participants