Skip to content

Conversation

@ColinFinck
Copy link
Contributor

This has been implemented in a backward-compatible way:

  • --target arguments specifying target names are still passed as arguments just like before.
  • --target arguments specifying a json file path have previously not been cached at all. The json file is now hashed like other external file dependencies.

Fixes #2174

@sylvestre
Copy link
Collaborator

Could you please add a test here to make sure we don't regress?
https://github.com/mozilla/sccache/blob/main/.github/workflows/integration-tests.yml

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (0cc0c62) to head (c61187f).
Report is 129 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #2269       +/-   ##
==========================================
- Coverage   30.91%       0   -30.92%     
==========================================
  Files          53       0       -53     
  Lines       20112       0    -20112     
  Branches     9755       0     -9755     
==========================================
- Hits         6217       0     -6217     
+ Misses       7922       0     -7922     
+ Partials     5973       0     -5973     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ColinFinck
Copy link
Contributor Author

Hey @sylvestre, thanks a lot for your quick response! I've checked the integration-tests.yml file you gave me, but it only contains a single test for each platform/compiler, not for individual flags of the Rust compiler. I'm willing to add a test for the newly supported flag, but I need a good example on how sccache currently does per-flag tests.

@sylvestre
Copy link
Collaborator

@ColinFinck ColinFinck force-pushed the feature/cache-target-json-specs branch from bb88bf5 to 616dd8c Compare November 18, 2024 11:57
@ColinFinck
Copy link
Contributor Author

@sylvestre I've rebased to latest main and added a test in 616dd8c

@ColinFinck
Copy link
Contributor Author

Bump

@sylvestre
Copy link
Collaborator

sorry, i missed your comment. CI started!

@sylvestre sylvestre force-pushed the feature/cache-target-json-specs branch from 616dd8c to 91b7c1c Compare December 3, 2024 10:26
@ColinFinck
Copy link
Contributor Author

@sylvestre Thanks for getting back to this PR. However, I'm still seeing "2 workflows awaiting approval" in GitHub.

@sylvestre
Copy link
Collaborator

done
could you please add a test in
https://github.com/mozilla/sccache/blob/main/tests/system.rs
too ?

@ColinFinck
Copy link
Contributor Author

could you please add a test in
https://github.com/mozilla/sccache/blob/main/tests/system.rs
too ?

@sylvestre There is currently not a single test in that file which exercises the Rust compiler. This is only done in src/compiler/rust.rs. Which is why I added my test there.
Multiple C compilers are tested in tests/system.rs, but not rustc. Adding a test framework for the Rust compiler to that file exceeds the scope of this PR and goes beyond my limited knowledge of sccache.

I hope we're able to merge the few lines of this PR without requiring an entirely new test framework for the Rust compiler first.

@sylvestre
Copy link
Collaborator

@sylvestre There is currently not a single test in that file which exercises the Rust compiler.

@ColinFinck we have proper Rustc testing:

See:
https://github.com/mozilla/sccache/blob/main/tests/sccache_cargo.rs
and
https://github.com/mozilla/sccache/blob/main/tests/sccache_rustc.rs

@sylvestre sylvestre force-pushed the feature/cache-target-json-specs branch from 91b7c1c to 7e96849 Compare December 12, 2024 10:57
@ColinFinck
Copy link
Contributor Author

@sylvestre There is currently not a single test in that file which exercises the Rust compiler.

@ColinFinck we have proper Rustc testing:

See: https://github.com/mozilla/sccache/blob/main/tests/sccache_cargo.rs and https://github.com/mozilla/sccache/blob/main/tests/sccache_rustc.rs

@sylvestre These are different files. I already had a look at them, but the first one just contains very high-level tests of running cargo and checking for cache hits and misses. The second file tests against a mock rustc and not the real one. None of these files are prepared for adding a low-level test of validating a single parameter (--target) passed to a real rustc compiler.

Which is why I added a test for --target to src/compiler/rust.rs. This is as much as I can do given the current state of the sccache testing framework.

@sylvestre sylvestre merged commit f656c4d into mozilla:main Jan 6, 2025
59 checks passed
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.

Caching custom Rust targets

3 participants