Skip to content

Commit

Permalink
Rollup merge of #95352 - jyn514:full-relative-path, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
[bootstrap] Print the full relative path to failed tests

Before:
```
failures:
    [ui] rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

After:
```
failures:
    [ui] src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

This allows copy pasting the path or using Ctrl+Click in IDEs to go directly to the file, instead of having to edit the filename first.
  • Loading branch information
Dylan-DPC authored Apr 7, 2022
2 parents 2310da4 + d0a3260 commit f7499a8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,10 @@ fn make_test_name(
testpaths: &TestPaths,
revision: Option<&String>,
) -> test::TestName {
// Convert a complete path to something like
//
// ui/foo/bar/baz.rs
let path = PathBuf::from(config.src_base.file_name().unwrap())
.join(&testpaths.relative_dir)
.join(&testpaths.file.file_name().unwrap());
// Print the name of the file, relative to the repository root.
// `src_base` looks like `/path/to/rust/src/test/ui`
let root_directory = config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
let path = testpaths.file.strip_prefix(root_directory).unwrap();
let debugger = match config.debugger {
Some(d) => format!("-{}", d),
None => String::new(),
Expand Down

0 comments on commit f7499a8

Please sign in to comment.