Skip to content

Commit d0a3260

Browse files
committed
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.
1 parent 37b55c8 commit d0a3260

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/tools/compiletest/src/main.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -744,12 +744,10 @@ fn make_test_name(
744744
testpaths: &TestPaths,
745745
revision: Option<&String>,
746746
) -> test::TestName {
747-
// Convert a complete path to something like
748-
//
749-
// ui/foo/bar/baz.rs
750-
let path = PathBuf::from(config.src_base.file_name().unwrap())
751-
.join(&testpaths.relative_dir)
752-
.join(&testpaths.file.file_name().unwrap());
747+
// Print the name of the file, relative to the repository root.
748+
// `src_base` looks like `/path/to/rust/src/test/ui`
749+
let root_directory = config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
750+
let path = testpaths.file.strip_prefix(root_directory).unwrap();
753751
let debugger = match config.debugger {
754752
Some(d) => format!("-{}", d),
755753
None => String::new(),

0 commit comments

Comments
 (0)