-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Use compiletest timestamp to check if the tests should be rerun. #56680
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @nagisa |
r? @nagisa (reissuing as highfive doesn't handle edits I think) |
I won't be able to review this till Wednesday.
…On Mon, Dec 10, 2018, 21:24 Alex Crichton ***@***.*** wrote:
r? @nagisa <https://github.com/nagisa>
(reissuing as highfive doesn't handle edits I think)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#56680 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AApc0uTWlHnMRmrV0v8R0cAkmWEjcMurks5u3sLggaJpZM4ZL-UA>
.
|
src/tools/compiletest/src/main.rs
Outdated
@@ -678,6 +678,20 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path | |||
output_base_dir(config, testpaths, revision).join("stamp") | |||
} | |||
|
|||
/// Walk the directory at `path` and collect timestamps of all files into `inputs`. | |||
fn collect_timestamps(path: &PathBuf, inputs: &mut Vec<FileTime>) { | |||
let mut entries = path.read_dir().unwrap().collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to collect everything into a Vec
first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The smart thing to do here would be to use walk_dir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about using walk_dir
, but that would be an additional dependency. If it is fine to have it, I can change the code to use walk_dir
.
src/tools/compiletest/src/main.rs
Outdated
let entry = entry.unwrap(); | ||
let path = entry.path(); | ||
if entry.metadata().unwrap().is_file() { | ||
inputs.push(mtime(&path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems unnecessary to collect into a vector here either (as the final check is iterating the vector either way), but that would mean a larger change.
The idea in general seems fine. It seems that the implementation could be improved. That being said, I see that it is just moving code around at this point, so I’m fine with merging this as-is. Let me know if you’d rather merge as-is, or would prefer improving the surrounding code as well. |
It is worth doing it only if the rest of the code is changed to use
iterators at the same time. Otherwise there is not much purpose in the
dependency.
…On Thu, Dec 13, 2018, 12:38 Vytautas Astrauskas ***@***.*** wrote:
***@***.**** commented on this pull request.
------------------------------
In src/tools/compiletest/src/main.rs
<#56680 (comment)>:
> @@ -678,6 +678,20 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path
output_base_dir(config, testpaths, revision).join("stamp")
}
+/// Walk the directory at `path` and collect timestamps of all files into `inputs`.
+fn collect_timestamps(path: &PathBuf, inputs: &mut Vec<FileTime>) {
+ let mut entries = path.read_dir().unwrap().collect::<Vec<_>>();
I thought about using walk_dir, but that would be an additional
dependency. If it is fine to have it, I can change the code to use
walk_dir.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#56680 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AApc0vqTo4JWNaUZmT46KV6sYspvhknZks5u4i49gaJpZM4ZL-UA>
.
|
@@ -678,6 +680,15 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path | |||
output_base_dir(config, testpaths, revision).join("stamp") | |||
} | |||
|
|||
/// Return an iterator over timestamps of files in the directory at `path`. | |||
fn collect_timestamps(path: &PathBuf) -> impl Iterator<Item=FileTime> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nagisa Is this the refactoring you had in mind?
Yeah, awesome! It would now be fairly straightforward to improve @bors r+ |
📌 Commit a756a4a0b025d789d8bfd5ef96a71ea69ee78439 has been approved by |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Sorry, I did not notice that during rebase |
Is it possible to do that while still having |
@bors r+
Yes, by chaining the iterators. |
📌 Commit 6562b2c8a07a1ab4617a2154638214c17297ac85 has been approved by |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
📌 Commit d966e57 has been approved by |
⌛ Testing commit d966e57 with merge c4b0c8ea1c9a9e37c693b7e267c61065983e03ec... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@nagisa Do you have any idea why it failed? (I am trying to get access to a Mac machine to try to reproduce the issue.) |
The test failures seem very unrelated to me. Lets try a @bors retry |
⌛ Testing commit d966e57 with merge c317003b4a7fd471b625836527fb7cc2898fdb21... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Use compiletest timestamp to check if the tests should be rerun. An attempt to fix #56280 by checking if timestamps of compile test files are older than the timestamp of the stamp file. ?r nagisa
☀️ Test successful - status-appveyor, status-travis |
An attempt to fix #56280 by checking if timestamps of compile test files are older than the timestamp of the stamp file.
?r nagisa