@@ -493,12 +493,8 @@ impl<'test> TestCx<'test> {
493
493
let expected_coverage_dump = self . load_expected_output ( kind) ;
494
494
let actual_coverage_dump = self . normalize_output ( & proc_res. stdout , & [ ] ) ;
495
495
496
- let coverage_dump_errors = self . compare_output (
497
- kind,
498
- & actual_coverage_dump,
499
- & expected_coverage_dump,
500
- self . props . compare_output_lines_by_subset ,
501
- ) ;
496
+ let coverage_dump_errors =
497
+ self . compare_output ( kind, & actual_coverage_dump, & expected_coverage_dump) ;
502
498
503
499
if coverage_dump_errors > 0 {
504
500
self . fatal_proc_rec (
@@ -591,12 +587,8 @@ impl<'test> TestCx<'test> {
591
587
self . fatal_proc_rec ( & err, & proc_res) ;
592
588
} ) ;
593
589
594
- let coverage_errors = self . compare_output (
595
- kind,
596
- & normalized_actual_coverage,
597
- & expected_coverage,
598
- self . props . compare_output_lines_by_subset ,
599
- ) ;
590
+ let coverage_errors =
591
+ self . compare_output ( kind, & normalized_actual_coverage, & expected_coverage) ;
600
592
601
593
if coverage_errors > 0 {
602
594
self . fatal_proc_rec (
@@ -4051,35 +4043,17 @@ impl<'test> TestCx<'test> {
4051
4043
match output_kind {
4052
4044
TestOutput :: Compile => {
4053
4045
if !self . props . dont_check_compiler_stdout {
4054
- errors += self . compare_output (
4055
- stdout_kind,
4056
- & normalized_stdout,
4057
- & expected_stdout,
4058
- self . props . compare_output_lines_by_subset ,
4059
- ) ;
4046
+ errors +=
4047
+ self . compare_output ( stdout_kind, & normalized_stdout, & expected_stdout) ;
4060
4048
}
4061
4049
if !self . props . dont_check_compiler_stderr {
4062
- errors += self . compare_output (
4063
- stderr_kind,
4064
- & normalized_stderr,
4065
- & expected_stderr,
4066
- self . props . compare_output_lines_by_subset ,
4067
- ) ;
4050
+ errors +=
4051
+ self . compare_output ( stderr_kind, & normalized_stderr, & expected_stderr) ;
4068
4052
}
4069
4053
}
4070
4054
TestOutput :: Run => {
4071
- errors += self . compare_output (
4072
- stdout_kind,
4073
- & normalized_stdout,
4074
- & expected_stdout,
4075
- self . props . compare_output_lines_by_subset ,
4076
- ) ;
4077
- errors += self . compare_output (
4078
- stderr_kind,
4079
- & normalized_stderr,
4080
- & expected_stderr,
4081
- self . props . compare_output_lines_by_subset ,
4082
- ) ;
4055
+ errors += self . compare_output ( stdout_kind, & normalized_stdout, & expected_stdout) ;
4056
+ errors += self . compare_output ( stderr_kind, & normalized_stderr, & expected_stderr) ;
4083
4057
}
4084
4058
}
4085
4059
errors
@@ -4173,12 +4147,7 @@ impl<'test> TestCx<'test> {
4173
4147
)
4174
4148
} ) ;
4175
4149
4176
- errors += self . compare_output (
4177
- "fixed" ,
4178
- & fixed_code,
4179
- & expected_fixed,
4180
- self . props . compare_output_lines_by_subset ,
4181
- ) ;
4150
+ errors += self . compare_output ( "fixed" , & fixed_code, & expected_fixed) ;
4182
4151
} else if !expected_fixed. is_empty ( ) {
4183
4152
panic ! (
4184
4153
"the `//@ run-rustfix` directive wasn't found but a `*.fixed` \
@@ -4673,17 +4642,19 @@ impl<'test> TestCx<'test> {
4673
4642
}
4674
4643
}
4675
4644
4676
- fn compare_output (
4677
- & self ,
4678
- kind : & str ,
4679
- actual : & str ,
4680
- expected : & str ,
4681
- compare_output_by_lines : bool ,
4682
- ) -> usize {
4645
+ fn compare_output ( & self , kind : & str , actual : & str , expected : & str ) -> usize {
4683
4646
if actual == expected {
4684
4647
return 0 ;
4685
4648
}
4686
4649
4650
+ // If `compare-output-lines-by-subset` is not explicitly enabled then
4651
+ // auto-enable it when a `runner` is in use since wrapper tools might
4652
+ // provide extra output on failure, for example a WebAssembly runtime
4653
+ // might print the stack trace of an `unreachable` instruction by
4654
+ // default.
4655
+ let compare_output_by_lines =
4656
+ self . props . compare_output_lines_by_subset || self . config . runner . is_some ( ) ;
4657
+
4687
4658
let tmp;
4688
4659
let ( expected, actual) : ( & str , & str ) = if compare_output_by_lines {
4689
4660
let actual_lines: HashSet < _ > = actual. lines ( ) . collect ( ) ;
0 commit comments