-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make x test tests
work
#121372
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
Merged
Merged
Make x test tests
work
#121372
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,16 +288,61 @@ impl PathSet { | |
} | ||
} | ||
|
||
const PATH_REMAP: &[(&str, &str)] = &[("rust-analyzer-proc-macro-srv", "proc-macro-srv-cli")]; | ||
|
||
fn remap_paths(paths: &mut [&Path]) { | ||
for path in paths.iter_mut() { | ||
const PATH_REMAP: &[(&str, &[&str])] = &[ | ||
// config.toml uses `rust-analyzer-proc-macro-srv`, but the | ||
// actual path is `proc-macro-srv-cli` | ||
("rust-analyzer-proc-macro-srv", &["proc-macro-srv-cli"]), | ||
// Make `x test tests` function the same as `x t tests/*` | ||
( | ||
"tests", | ||
&[ | ||
"tests/assembly", | ||
"tests/codegen", | ||
"tests/codegen-units", | ||
"tests/coverage", | ||
"tests/coverage-run-rustdoc", | ||
"tests/debuginfo", | ||
"tests/incremental", | ||
"tests/mir-opt", | ||
"tests/pretty", | ||
"tests/run-make", | ||
"tests/run-make-fulldeps", | ||
"tests/run-pass-valgrind", | ||
"tests/rustdoc", | ||
"tests/rustdoc-gui", | ||
"tests/rustdoc-js", | ||
"tests/rustdoc-js-std", | ||
"tests/rustdoc-json", | ||
"tests/rustdoc-ui", | ||
"tests/ui", | ||
"tests/ui-fulldeps", | ||
], | ||
), | ||
]; | ||
|
||
fn remap_paths(paths: &mut Vec<&Path>) { | ||
let mut remove = vec![]; | ||
let mut add = vec![]; | ||
for (i, path) in paths | ||
.iter() | ||
.enumerate() | ||
.filter_map(|(i, path)| if let Some(s) = path.to_str() { Some((i, s)) } else { None }) | ||
{ | ||
for &(search, replace) in PATH_REMAP { | ||
if path.to_str() == Some(search) { | ||
*path = Path::new(replace) | ||
// Remove leading and trailing slashes so `tests/` and `tests` are equivalent | ||
if path.trim_matches(std::path::is_separator) == search { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Different shells can tab-complete a folder name with or without a trailing slash so hopefully this can handle both |
||
remove.push(i); | ||
add.extend(replace.into_iter().map(Path::new)); | ||
break; | ||
} | ||
} | ||
} | ||
remove.sort(); | ||
remove.dedup(); | ||
for idx in remove.into_iter().rev() { | ||
paths.remove(idx); | ||
} | ||
paths.append(&mut add); | ||
} | ||
|
||
impl StepDescription { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nothing can go wrong with hardcoded paths.
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.
Maybe collects folders in /tests at runtime and assert that lists equal (excluding
auxiliary
)?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'll follow this one up with a test
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.
And now this list missing tests/crashes
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.
We have a test for checking the existance paths. Seems like we need a test for missing paths too.
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.
Here it is: #124969