Skip to content

Commit

Permalink
add short path name for executables
Browse files Browse the repository at this point in the history
  • Loading branch information
yerke committed Jan 31, 2022
1 parent a6c1459 commit ed579b6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
13 changes: 8 additions & 5 deletions src/cargo/ops/cargo_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,21 @@ fn cmd_builds(
compilation: &Compilation<'_>,
) -> CargoResult<(String, ProcessBuilder)> {
let test_path = unit.target.src_path().path().unwrap();
let short_test_path = test_path
.strip_prefix(unit.pkg.root())
.unwrap_or(test_path)
.display();

let exe_display = if let TargetKind::Test = unit.target.kind() {
format!(
"{} ({})",
test_path
.strip_prefix(unit.pkg.root())
.unwrap_or(test_path)
.display(),
short_test_path,
path.strip_prefix(cwd).unwrap_or(path).display()
)
} else {
format!(
"unittests ({})",
"unittests {} ({})",
short_test_path,
path.strip_prefix(cwd).unwrap_or(path).display()
)
};
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,8 @@ fn test_bench_no_run() {
"\
[COMPILING] foo v0.0.1 ([..])
[FINISHED] bench [optimized] target(s) in [..]
[EXECUTABLE] unittests (target/release/deps/foo-[..][EXE])
[EXECUTABLE] unittests (target/release/deps/bbaz-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/release/deps/foo-[..][EXE])
[EXECUTABLE] unittests benches/bbaz.rs (target/release/deps/bbaz-[..][EXE])
",
)
.run();
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/features2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ fn minimal_download() {
[COMPILING] dev_dep v1.0.0
[COMPILING] foo v0.1.0 [..]
[FINISHED] [..]
[EXECUTABLE] unittests (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/debug/deps/foo-[..][EXE])
",
)
.run();
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/freshness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ fn no_rebuild_transitive_target_deps() {
[COMPILING] b v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..])
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[EXECUTABLE] unittests (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] tests/foo.rs (target/debug/deps/foo-[..][EXE])
",
)
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn deduplicate_messages_basic() {
warning: `foo` (lib) generated 1 warning
warning: `foo` (lib test) generated 1 warning (1 duplicate)
[FINISHED] [..]
[EXECUTABLE] unittests (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/debug/deps/foo-[..][EXE])
",
rustc_message
);
Expand Down Expand Up @@ -107,7 +107,7 @@ warning: `foo` (lib) generated 1 warning
{}\
warning: `foo` (lib test) generated 2 warnings (1 duplicate)
[FINISHED] [..]
[EXECUTABLE] unittests (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/debug/deps/foo-[..][EXE])
",
lib_output, lib_test_output
);
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ fn test_no_run() {
"\
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[EXECUTABLE] unittests (target/debug/deps/foo-[..][EXE])
[EXECUTABLE] unittests src/lib.rs (target/debug/deps/foo-[..][EXE])
",
)
.run();
Expand Down

0 comments on commit ed579b6

Please sign in to comment.