Skip to content

Commit

Permalink
Remove $DIR replacement of test's parent directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexendoo committed Oct 13, 2023
1 parent bfb22b2 commit a927de8
Show file tree
Hide file tree
Showing 38 changed files with 77 additions and 84 deletions.
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ fn check_output(
revision: &str,
) -> PathBuf {
let target = config.target.as_ref().unwrap();
let output = normalize(path, output, filters, comments, revision, kind);
let output = normalize(output, filters, comments, revision, kind);
let path = output_path(path, comments, revised(revision, kind), target, revision);
match &config.output_conflict_handling {
OutputConflictHandling::Error(bless_command) => {
Expand Down Expand Up @@ -1287,20 +1287,13 @@ fn get_pointer_width(triple: &str) -> u8 {
}

fn normalize(
path: &Path,
text: &[u8],
filters: &Filter,
comments: &Comments,
revision: &str,
kind: &'static str,
) -> Vec<u8> {
// Useless paths
let path_filter = (Match::from(path.parent().unwrap()), b"$DIR" as &[u8]);
let filters = filters.iter().chain(std::iter::once(&path_filter));
let mut text = text.to_owned();
if let Some(lib_path) = option_env!("RUSTC_LIB_PATH") {
text = text.replace(lib_path, "RUSTLIB");
}

for (rule, replacement) in filters {
text = rule.replace_all(&text, replacement).into_owned();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0432]: unresolved import `basic_bin`
--> $DIR/foomp.rs:1:5
--> tests/actual_tests/foomp.rs:1:5
|
1 | use basic_bin::add;
| ^^^^^^^^^ use of undeclared crate or module `basic_bin`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/foomp.rs:4:9
--> tests/actual_tests/foomp.rs:4:9
|
4 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
6 changes: 3 additions & 3 deletions tests/integrations/basic-fail/Cargo.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Location:
error: test failed, to rerun pass `--test ui_tests`

Caused by:
process didn't exit successfully: `$DIR/target/ui/$DIR/debug/deps/ui_tests-HASH` (exit status: 1)
process didn't exit successfully: `$DIR/target/ui/tests/integrations/basic-fail/debug/deps/ui_tests-HASH` (exit status: 1)
thread 'main' panicked at tests/ui_tests_bless.rs:52:18:
invalid mode/result combo: yolo: Err(tests failed

Expand All @@ -22,15 +22,15 @@ Location:
error: test failed, to rerun pass `--test ui_tests_invalid_program`

Caused by:
process didn't exit successfully: `$DIR/target/ui/$DIR/debug/deps/ui_tests_invalid_program-HASH` (exit status: 1)
process didn't exit successfully: `$DIR/target/ui/tests/integrations/basic-fail/debug/deps/ui_tests_invalid_program-HASH` (exit status: 1)
Error: tests failed

Location:
$DIR/src/lib.rs:LL:CC
error: test failed, to rerun pass `--test ui_tests_invalid_program2`

Caused by:
process didn't exit successfully: `$DIR/target/ui/$DIR/debug/deps/ui_tests_invalid_program2-HASH` (exit status: 1)
process didn't exit successfully: `$DIR/target/ui/tests/integrations/basic-fail/debug/deps/ui_tests_invalid_program2-HASH` (exit status: 1)
error: 4 targets failed:
`--test ui_tests`
`--test ui_tests_bless`
Expand Down
42 changes: 21 additions & 21 deletions tests/integrations/basic-fail/Cargo.stdout

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/bad_pattern.rs:4:9
--> tests/actual_tests/bad_pattern.rs:4:9
|
4 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/basic-fail/tests/actual_tests/foomp.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/foomp.rs:4:9
--> tests/actual_tests/foomp.rs:4:9
|
4 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand All @@ -8,7 +8,7 @@ note: function defined here
--> $DIR/tests/integrations/basic/src/lib.rs:1:8
|
1 | pub fn add(left: usize, right: usize) -> usize {
| ^^^ some expected text that isn't in the actual message
| ^^^ some expected text that isn't in the actual message

error: aborting doo to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/foomp2.rs:4:9
--> tests/actual_tests/foomp2.rs:4:9
|
4 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: internal compiler error: no errors reported for args
--> $DIR/rustc_ice.rs:8:5
--> tests/actual_tests/rustc_ice.rs:8:5
|
8 | add("42", 3);
| ^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected one of `!` or `::`, found `<eof>`
--> $DIR/aux_proc_macro_no_main.rs:7:8
--> tests/actual_tests_bless/aux_proc_macro_no_main.rs:7:8
|
7 | thing!(cake);
| ^^^^ expected one of `!` or `::`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/failing_executable.rs:4:5:
thread 'main' panicked at tests/actual_tests_bless/failing_executable.rs:4:5:
assertion `left == right` failed
left: 5
right: 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0308]: mismatched types
--> $DIR/foomp_aux.rs:6:9
--> tests/actual_tests_bless/foomp_aux.rs:6:9
|
6 | add("42", 3);
| --- ^^^^ expected `u8`, found `&str`
| |
| arguments to this function are incorrect
|
note: function defined here
--> $DIR/tests/integrations/basic-fail/$DIR/auxiliary/foomp.rs:1:8
--> $DIR/tests/integrations/basic-fail/tests/actual_tests_bless/auxiliary/foomp.rs:1:8
|
1 | pub fn add(_: u8, _: u8) {}
| ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: cannot mix `bin` crate type with others

error[E0601]: `main` function not found in crate `no_main_manual`
--> $DIR/no_main_manual.rs:3:16
--> tests/actual_tests_bless/no_main_manual.rs:3:16
|
3 | pub fn foo() {}
| ^ consider adding a `main` function to `$DIR/no_main_manual.rs`
| ^ consider adding a `main` function to `tests/actual_tests_bless/no_main_manual.rs`

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
thread 'main' panicked at $DIR/revisioned_executable_panic.rs:6:5:
thread 'main' panicked at tests/actual_tests_bless/revisioned_executable_panic.rs:6:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
thread 'main' panicked at $DIR/revisioned_executable_panic.rs:6:5:
thread 'main' panicked at tests/actual_tests_bless/revisioned_executable_panic.rs:6:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions.rs:11:9
--> tests/actual_tests_bless/revisions.rs:11:9
|
11 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions.rs:6:9
--> tests/actual_tests_bless/revisions.rs:6:9
|
6 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0601]: `main` function not found in crate `revisions_bad`
--> $DIR/revisions_bad.rs:10:2
--> tests/actual_tests_bless/revisions_bad.rs:10:2
|
10 | }
| ^ consider adding a `main` function to `$DIR/revisions_bad.rs`
| ^ consider adding a `main` function to `tests/actual_tests_bless/revisions_bad.rs`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_bad.rs:8:9
--> tests/actual_tests_bless/revisions_bad.rs:8:9
|
8 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_filter2.rs:12:9
--> tests/actual_tests_bless/revisions_filter2.rs:12:9
|
12 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_multiple_per_annotation.rs:5:9
--> tests/actual_tests_bless/revisions_multiple_per_annotation.rs:5:9
|
5 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_multiple_per_annotation.rs:5:9
--> tests/actual_tests_bless/revisions_multiple_per_annotation.rs:5:9
|
5 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_same_everywhere.rs:5:9
--> tests/actual_tests_bless/revisions_same_everywhere.rs:5:9
|
5 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_same_everywhere.rs:5:9
--> tests/actual_tests_bless/revisions_same_everywhere.rs:5:9
|
5 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
thread 'main' panicked at $DIR/run_panic.rs:4:5:
thread 'main' panicked at tests/actual_tests_bless/run_panic.rs:4:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected `,` following `match` arm
--> $DIR/rustfix-fail-revisions.rs:6:27
--> tests/actual_tests_bless/rustfix-fail-revisions.rs:6:27
|
6 | 0 => String::new()
| ^ help: missing a comma here to end this `match` arm: `,`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected `,` following `match` arm
--> $DIR/rustfix-fail-revisions.rs:6:27
--> tests/actual_tests_bless/rustfix-fail-revisions.rs:6:27
|
6 | 0 => String::new()
| ^ help: missing a comma here to end this `match` arm: `,`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected `,` following `match` arm
--> $DIR/rustfix-fail.rs:5:27
--> tests/actual_tests_bless/rustfix-fail.rs:5:27
|
5 | 0 => String::new()
| ^ help: missing a comma here to end this `match` arm: `,`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0601]: `main` function not found in crate `revisions_bad`
--> $DIR/revisions_bad.rs:10:2
--> tests/actual_tests_bless_yolo/revisions_bad.rs:10:2
|
10 | }
| ^ consider adding a `main` function to `$DIR/revisions_bad.rs`
| ^ consider adding a `main` function to `tests/actual_tests_bless_yolo/revisions_bad.rs`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/revisions_bad.rs:8:9
--> tests/actual_tests_bless_yolo/revisions_bad.rs:8:9
|
8 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/rustfix-maybe-incorrect.rs:4:22
--> tests/actual_tests_bless_yolo/rustfix-maybe-incorrect.rs:4:22
|
4 | let _x: String = 42;
| ------ ^^- help: try using a conversion method: `.to_string()`
Expand Down
6 changes: 3 additions & 3 deletions tests/integrations/basic/tests/actual_tests/aux_derive.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: variable `x` is assigned to, but never used
--> $DIR/aux_derive.rs:7:9
--> tests/actual_tests/aux_derive.rs:7:9
|
7 | let x = Foo;
| ^
Expand All @@ -8,7 +8,7 @@ warning: variable `x` is assigned to, but never used
= note: `#[warn(unused_variables)]` on by default

warning: value assigned to `x` is never read
--> $DIR/aux_derive.rs:8:5
--> tests/actual_tests/aux_derive.rs:8:5
|
8 | x = Foo;
| ^
Expand All @@ -17,7 +17,7 @@ warning: value assigned to `x` is never read
= note: `#[warn(unused_assignments)]` on by default

error[E0384]: cannot assign twice to immutable variable `x`
--> $DIR/aux_derive.rs:8:5
--> tests/actual_tests/aux_derive.rs:8:5
|
7 | let x = Foo;
| -
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `cake` in this scope
--> $DIR/aux_proc_macro.rs:6:12
--> tests/actual_tests/aux_proc_macro.rs:6:12
|
6 | thing!(cake);
| ^^^^ not found in this scope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: variable does not need to be mutable
--> $DIR/foomp-rustfix.rs:4:9
--> tests/actual_tests/foomp-rustfix.rs:4:9
|
4 | let mut x = 42;
| ----^
| |
| help: remove this `mut`
|
note: the lint level is defined here
--> $DIR/foomp-rustfix.rs:1:9
--> tests/actual_tests/foomp-rustfix.rs:1:9
|
1 | #![deny(warnings)]
| ^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/basic/tests/actual_tests/foomp.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/foomp.rs:4:9
--> tests/actual_tests/foomp.rs:4:9
|
4 | add("42", 3);
| --- ^^^^ expected `usize`, found `&str`
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/basic/tests/actual_tests/no_rustfix.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: variable does not need to be mutable
--> $DIR/no_rustfix.rs:6:9
--> tests/actual_tests/no_rustfix.rs:6:9
|
6 | let mut x = 42;
| ----^
| |
| help: remove this `mut`
|
note: the lint level is defined here
--> $DIR/no_rustfix.rs:3:9
--> tests/actual_tests/no_rustfix.rs:3:9
|
3 | #![deny(warnings)]
| ^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `cake` in this scope
--> $DIR/aux_proc_macro.rs:6:12
--> tests/actual_tests/subdir/aux_proc_macro.rs:6:12
|
6 | thing!(cake);
| ^^^^ not found in this scope
Expand Down
Loading

0 comments on commit a927de8

Please sign in to comment.