Add the directive compare-output-by-lines
This commit is contained in:
parent
898aff704d
commit
e17989edc7
14 changed files with 53 additions and 19 deletions
|
|
@ -111,6 +111,7 @@ for more details.
|
|||
| `forbid-output` | A pattern which must not appear in stderr/`cfail` output | `ui`, `incremental` | Regex pattern |
|
||||
| `run-flags` | Flags passed to the test executable | `ui` | Arbitrary flags |
|
||||
| `known-bug` | No error annotation needed due to known bug | `ui`, `crashes`, `incremental` | Issue number `#123456` |
|
||||
| `compare-output-by-lines` | Compare the output by lines, rather than as a single string | All | N/A |
|
||||
|
||||
[^check_stdout]: presently <!-- date-check: Oct 2024 --> this has a weird quirk
|
||||
where the test binary's stdout and stderr gets concatenated and then
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ will check for output files:
|
|||
[Normalization](#normalization)).
|
||||
- `dont-check-compiler-stderr` — Ignores stderr from the compiler.
|
||||
- `dont-check-compiler-stdout` — Ignores stdout from the compiler.
|
||||
- `compare-output-by-lines` — Some tests have non-deterministic orders of output, so we need to compare by lines.
|
||||
|
||||
UI tests run with `-Zdeduplicate-diagnostics=no` flag which disables rustc's
|
||||
built-in diagnostic deduplication mechanism. This means you may see some
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ pub struct TestProps {
|
|||
pub dont_require_annotations: HashSet<ErrorKind>,
|
||||
/// Whether pretty printers should be disabled in gdb.
|
||||
pub disable_gdb_pretty_printers: bool,
|
||||
/// Compare the output by lines, rather than as a single string.
|
||||
pub compare_output_by_lines: bool,
|
||||
}
|
||||
|
||||
mod directives {
|
||||
|
|
@ -254,6 +256,7 @@ mod directives {
|
|||
// This isn't a real directive, just one that is probably mistyped often
|
||||
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
|
||||
pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers";
|
||||
pub const COMPARE_OUTPUT_BY_LINES: &'static str = "compare-output-by-lines";
|
||||
}
|
||||
|
||||
impl TestProps {
|
||||
|
|
@ -310,6 +313,7 @@ impl TestProps {
|
|||
add_core_stubs: false,
|
||||
dont_require_annotations: Default::default(),
|
||||
disable_gdb_pretty_printers: false,
|
||||
compare_output_by_lines: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,6 +668,11 @@ impl TestProps {
|
|||
DISABLE_GDB_PRETTY_PRINTERS,
|
||||
&mut self.disable_gdb_pretty_printers,
|
||||
);
|
||||
config.set_name_directive(
|
||||
ln,
|
||||
COMPARE_OUTPUT_BY_LINES,
|
||||
&mut self.compare_output_by_lines,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"check-run-results",
|
||||
"check-stdout",
|
||||
"check-test-line-numbers-match",
|
||||
"compare-output-by-lines",
|
||||
"compile-flags",
|
||||
"disable-gdb-pretty-printers",
|
||||
"doc-flags",
|
||||
|
|
|
|||
|
|
@ -2749,7 +2749,11 @@ impl<'test> TestCx<'test> {
|
|||
// Wrapper tools set by `runner` might provide extra output on failure,
|
||||
// for example a WebAssembly runtime might print the stack trace of an
|
||||
// `unreachable` instruction by default.
|
||||
let compare_output_by_lines = self.config.runner.is_some();
|
||||
//
|
||||
// Also, some tests like `ui/parallel-rustc` have non-deterministic
|
||||
// orders of output, so we need to compare by lines.
|
||||
let compare_output_by_lines =
|
||||
self.props.compare_output_by_lines || self.config.runner.is_some();
|
||||
|
||||
let tmp;
|
||||
let (expected, actual): (&str, &str) = if compare_output_by_lines {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
// Test for #111528, the ice issue cause waiting on a query that panicked
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ build-fail
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
#![allow(warnings)]
|
||||
|
||||
#[export_name="fail"]
|
||||
pub fn a() {
|
||||
}
|
||||
#[export_name = "fail"]
|
||||
pub fn a() {}
|
||||
|
||||
#[export_name="fail"]
|
||||
#[export_name = "fail"]
|
||||
pub fn b() {
|
||||
//~^ ERROR symbol `fail` is already defined
|
||||
//~^ ERROR symbol `fail` is already defined
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: symbol `fail` is already defined
|
||||
--> $DIR/cache-after-waiting-issue-111528.rs:12:1
|
||||
--> $DIR/cache-after-waiting-issue-111528.rs:14:1
|
||||
|
|
||||
LL | pub fn b() {
|
||||
| ^^^^^^^^^^
|
||||
|
|
|
|||
8
tests/ui/parallel-rustc/cycle_crash-issue-135870.rs
Normal file
8
tests/ui/parallel-rustc/cycle_crash-issue-135870.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Test for #135870, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags: -Z threads=2
|
||||
//@ compare-output-by-lines
|
||||
|
||||
const FOO: usize = FOO; //~ ERROR cycle detected when simplifying constant for the type system `FOO`
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0391]: cycle detected when simplifying constant for the type system `FOO`
|
||||
--> $DIR/cycle_crash.rs:3:1
|
||||
--> $DIR/cycle_crash-issue-135870.rs:6:1
|
||||
|
|
||||
LL | const FOO: usize = FOO;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires const-evaluating + checking `FOO`...
|
||||
--> $DIR/cycle_crash.rs:3:20
|
||||
--> $DIR/cycle_crash-issue-135870.rs:6:20
|
||||
|
|
||||
LL | const FOO: usize = FOO;
|
||||
| ^^^
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
//@ compile-flags: -Z threads=2
|
||||
|
||||
const FOO: usize = FOO; //~ERROR cycle detected when simplifying constant for the type system `FOO`
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
// Test for #118205, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags:-C extra-filename=-1 -Z threads=16
|
||||
//@ no-prefer-dynamic
|
||||
//@ build-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#![crate_name = "crateresolve1"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
// Test for #118205, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ build-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
pub static GLOBAL: isize = 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
// Test for the basic function of parallel front end
|
||||
//
|
||||
//@ compile-flags: -Z threads=8
|
||||
//@ run-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
fn main() {
|
||||
println!("Hello world!");
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
// Test for #111520, which causes an ice bug cause of reading stolen value
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ run-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#[repr(transparent)]
|
||||
struct Sched {
|
||||
i: i32,
|
||||
}
|
||||
impl Sched {
|
||||
extern "C" fn get(self) -> i32 { self.i }
|
||||
extern "C" fn get(self) -> i32 {
|
||||
self.i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = Sched { i: 4 };
|
||||
let f = || -> i32 {
|
||||
s.get()
|
||||
};
|
||||
let f = || -> i32 { s.get() };
|
||||
println!("f: {}", f());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue