Skip to content

rust: fix the env-dep basedir test after dep-info reuse - #2982

Closed
xdustinface wants to merge 1 commit into
mozilla:mainfrom
xdustinface:fix/basedir-env-dep-test-reuse
Closed

xdustinface wants to merge 1 commit into
mozilla:mainfrom
xdustinface:fix/basedir-env-dep-test-reuse

Conversation

@xdustinface

Copy link
Copy Markdown
Contributor

compiler::rust::test::test_hash_env_dep_equal_to_basedir_is_not_unset fails on main on every platform, which turns every open PR's test jobs red. It started with c72ff6c ("rust: reuse dep-info and output lists across compiles of a crate").

The test set Y only in the mocked dep-info and never in the environment. Both of its compiles therefore had the same dep_info_key, so the second reused the first's remembered env-deps and the test compared a key with itself.

rustc reads Y from the environment, so the test now puts a set Y there too, and leaves it out for the unset case. The two compiles get their own dep-info keys again.

The test still guards what it was written for: with the \0 prefix removed from strip_basedirs_os, it fails again. cargo test --lib passes (625 tests) and cargo clippy --lib --tests is clean.

`test_hash_env_dep_equal_to_basedir_is_not_unset` has failed on every platform since c72ff6c started reusing dep-info across compiles of a crate. The test set `Y` only in the mocked dep-info, never in the environment, so both of its compiles had the same dep-info key and the second reused the first's env-deps. It then compared a key with itself.

rustc reads `Y` from the environment, so the test now puts a set `Y` there too. The two compiles get their own dep-info keys again, and the test still fails if a stripped env-dep value hashes like an unset one.
@codecov-commenter

codecov-commenter commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.01%. Comparing base (474835d) to head (8f14ae9).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2982       +/-   ##
===========================================
+ Coverage   28.28%   79.01%   +50.73%     
===========================================
  Files          74       74               
  Lines       42086    45841     +3755     
===========================================
+ Hits        11904    36222    +24318     
+ Misses      30182     9619    -20563     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ghoulspa

ghoulspa commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

I added the test in #2918
this is the right fix for it, thanks

@xdustinface

Copy link
Copy Markdown
Contributor Author

Closing: #2989 fixed this on main with the same change.

@sylvestre

Copy link
Copy Markdown
Collaborator

i am still taking your version, it is better, i didn't see it, sorry

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.

4 participants