-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
testsuite: explictly update the mtime when needed #13139
Comments
I'm not aware of any tests that do this. Can you point to some? They should always be modifying a file that already has content, which absolutely should change the mtime. (That is what the linked I would be reluctant to have tests manually changing mtimes. They already do that a lot, but I wouldn't want them to do that more. I like having tests try to behave as close to the way real users would be doing things as possible. If the |
Tests affected include:
Using |
Currently some tests use
Project::change_file
with an empty content string just to update the modified time of the file e.g.:cargo/tests/testsuite/freshness.rs
Line 558 in bdef274
However, updating a zero length file to be zero length isn't guaranteed to change the modified time (it might be a no-op). Cargo's tests should explicitly set the modified time using the new
File::set_times
API.There are at least a couple of ways this could be done. An explicit method could be added and used in place of calling
change_file
with an empty string. Or elsechange_file
(or the underlyingFileBuilder
) could be updated to always set the modified time.The text was updated successfully, but these errors were encountered: