Skip to content

Commit 5f391d3

Browse files
authored
Merge pull request #88 from oli-obk/version_bump
Use display printing for io error
2 parents 0d00ffa + 6a49b69 commit 5f391d3

File tree

10 files changed

+45
-17
lines changed

10 files changed

+45
-17
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ui_test"
3-
version = "0.11.5"
3+
version = "0.11.6"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "A test framework for testing rustc diagnostics output"

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ fn run_test(
521521

522522
let output = cmd
523523
.output()
524-
.unwrap_or_else(|err| panic!("could not execute {cmd:?}: {err:?}"));
524+
.unwrap_or_else(|err| panic!("could not execute {cmd:?}: {err}"));
525525
let mode = config.mode.maybe_override(comments, revision, &mut errors);
526526
let status_check = mode.ok(output.status);
527527
if status_check.is_empty() && matches!(mode, Mode::Run { .. }) {

src/status_emitter.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,32 @@ impl<T: StatusEmitter, U: StatusEmitter> StatusEmitter for (T, U) {
543543
}
544544
}
545545

546+
impl<T: StatusEmitter + ?Sized> StatusEmitter for Box<T> {
547+
fn failed_test<'a>(
548+
&'a self,
549+
revision: &'a str,
550+
path: &'a Path,
551+
cmd: &'a Command,
552+
stderr: &'a [u8],
553+
) -> Box<dyn Debug + 'a> {
554+
(**self).failed_test(revision, path, cmd, stderr)
555+
}
556+
557+
fn test_result(&mut self, path: &Path, revision: &str, result: &TestResult) {
558+
(**self).test_result(path, revision, result);
559+
}
560+
561+
fn finalize(
562+
&self,
563+
failures: usize,
564+
succeeded: usize,
565+
ignored: usize,
566+
filtered: usize,
567+
) -> Box<dyn Summary> {
568+
(**self).finalize(failures, succeeded, ignored, filtered)
569+
}
570+
}
571+
546572
impl Summary for (Box<dyn Summary>, Box<dyn Summary>) {
547573
fn test_failure(&mut self, path: &Path, revision: &str, errors: &Errors) {
548574
self.0.test_failure(path, revision, errors);

tests/integration.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ fn run(name: &str, mode: Mode) -> Result<()> {
7272
config.stderr_filter("/([^/\\.]+)\\.dylib", "/$1.so");
7373
config.stderr_filter("(command: )\"[^<rp][^\"]+", "$1\"$$CMD");
7474
config.stderr_filter("(src/.*?\\.rs):[0-9]+:[0-9]+", "$1:LL:CC");
75+
config.stderr_filter("program not found", "No such file or directory");
76+
config.stderr_filter(" \\(os error [0-9]+\\)", "");
7577

7678
run_tests_generic(
7779
config,

tests/integrations/basic-bin/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic-fail-mode/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic-fail/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic-fail/Cargo.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,23 +528,23 @@ error: test failed, to rerun pass `--test ui_tests_invalid_program`
528528

529529
Caused by:
530530
process didn't exit successfully: `$DIR/target/ui/debug/ui_tests_invalid_program-HASH --test-threads 1` (exit status: 1)
531-
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/bad_pattern.rs" "--edition" "2021"', $DIR/src/lib.rs
531+
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/bad_pattern.rs" "--edition" "2021": No such file or directory', $DIR/src/lib.rs
532532
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
533533
tests/actual_tests/bad_pattern.rs ... FAILED
534-
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable.rs" "--edition" "2021"', $DIR/src/lib.rs
534+
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable.rs" "--edition" "2021": No such file or directory', $DIR/src/lib.rs
535535
tests/actual_tests/executable.rs ... FAILED
536-
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable_compile_err.rs" "--edition" "2021"', $DIR/src/lib.rs
536+
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable_compile_err.rs" "--edition" "2021": No such file or directory', $DIR/src/lib.rs
537537
tests/actual_tests/executable_compile_err.rs ... FAILED
538-
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/exit_code_fail.rs" "--edition" "2021"', $DIR/src/lib.rs
538+
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/exit_code_fail.rs" "--edition" "2021": No such file or directory', $DIR/src/lib.rs
539539
tests/actual_tests/exit_code_fail.rs ... FAILED
540540
tests/actual_tests/filters.rs ... FAILED
541-
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/foomp.rs" "--edition" "2021"', $DIR/src/lib.rs
541+
thread '<unnamed>' panicked at 'could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/foomp.rs" "--edition" "2021": No such file or directory', $DIR/src/lib.rs
542542
tests/actual_tests/foomp.rs ... FAILED
543543

544544
tests/actual_tests/bad_pattern.rs FAILED:
545545
command: "<unknown>"
546546

547-
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/bad_pattern.rs" "--edition" "2021"
547+
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/bad_pattern.rs" "--edition" "2021": No such file or directory
548548

549549
full stderr:
550550

@@ -553,7 +553,7 @@ full stderr:
553553
tests/actual_tests/executable.rs FAILED:
554554
command: "<unknown>"
555555

556-
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable.rs" "--edition" "2021"
556+
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable.rs" "--edition" "2021": No such file or directory
557557

558558
full stderr:
559559

@@ -562,7 +562,7 @@ full stderr:
562562
tests/actual_tests/executable_compile_err.rs FAILED:
563563
command: "<unknown>"
564564

565-
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable_compile_err.rs" "--edition" "2021"
565+
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/executable_compile_err.rs" "--edition" "2021": No such file or directory
566566

567567
full stderr:
568568

@@ -571,7 +571,7 @@ full stderr:
571571
tests/actual_tests/exit_code_fail.rs FAILED:
572572
command: "<unknown>"
573573

574-
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/exit_code_fail.rs" "--edition" "2021"
574+
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/exit_code_fail.rs" "--edition" "2021": No such file or directory
575575

576576
full stderr:
577577

@@ -590,7 +590,7 @@ full stderr:
590590
tests/actual_tests/foomp.rs FAILED:
591591
command: "<unknown>"
592592

593-
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/foomp.rs" "--edition" "2021"
593+
A bug in `ui_test` occurred: could not execute "invalid_foobarlaksdfalsdfj" "tests/actual_tests/foomp.rs" "--edition" "2021": No such file or directory
594594

595595
full stderr:
596596

tests/integrations/basic/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)