-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"cargo test" not noticing file changes #10695
Comments
Here is a gist, I'm not totally sure how to interpret it -- from my initial scan it does seem to notice the file is out of date and has to rebuild the program, but then doesn't rebuild the tests? https://gist.github.com/ChrisJefferson/60ab4a82be6bb799a9fc3ae05a86ea68 However, if cargo doesn't do sub-second times, then all this could well be happening faster than a second and that would explain things. |
Or the mtime from the restored file is actually older then referenced mtime from depinfo? There is a condition checking that. Could you check the mtime before touching it by something like |
Update: I put a "sleep 5" after each command, which didn't fix the problem. I switched the "mv" to "cp" which did. The The almost comes from the fact that But, in the case I put in the gist, it's the other way around, |
@ChrisJefferson Glad you figured it out! Your observation also matches what I remembered: Anyway, I guess we could track alternative ways to detect file changes in #6529. I'll close this. Thank you for your findings! Footnotes |
Problem
I run a script (attached below) on a repository, which changes various source files. After this script is run,
cargo test
reports failure unless I "touch" a source file, at which point it notices files have changed and the tests pass. While the stuff I'm doing is fairly stupid, I don't think I'm doing anything that horrible, so I'd expectcargo test
to notice the changed files?Steps
cargo test
, notice it works fine.This remove 'pub' in two places in "src/perm/mod.rs", then puts the old file back.
5. Run
cargo test
, notice it fails6. Run
git diff
, notice it says no changes7. Run
touch src/perm/mod.rs
, thencargo test
, nowcargo test
passes.Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: