Rollup merge of #133725 - jyn514:remove-compare-output-subset, r=jieyouxu

Remove `//@ compare-output-lines-by-subset`

There was only ever one test which used this flag, and it was removed in https://github.com/rust-lang/rust/pull/132244. I think this is a bad flag that should never have been added; comparing by subset makes the test failures extremely hard to debug. Any test that needs complicated output filtering like this should just use run-make instead.

Note that this does not remove the underlying comparison code, because it's still used if `runner` is set. I don't quite understand what's going on there, but since we still test on other platforms and in CI that the full output is accurate, I think it will be easier to debug than a test that uses compare-by-subset unconditionally.

rustc-dev-guide update PR: https://github.com/rust-lang/rustc-dev-guide/pull/2151
This commit is contained in:
Guillaume Gomez 2024-12-02 17:36:05 +01:00 committed by GitHub
commit 15fda1e90b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 18 deletions

View File

@ -17,7 +17,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"check-run-results",
"check-stdout",
"check-test-line-numbers-match",
"compare-output-lines-by-subset",
"compile-flags",
"doc-flags",
"dont-check-compiler-stderr",

View File

@ -115,9 +115,6 @@ pub struct TestProps {
pub dont_check_compiler_stdout: bool,
// For UI tests, allows compiler to generate arbitrary output to stderr
pub dont_check_compiler_stderr: bool,
// When checking the output of stdout or stderr check
// that the lines of expected output are a subset of the actual output.
pub compare_output_lines_by_subset: bool,
// Don't force a --crate-type=dylib flag on the command line
//
// Set this for example if you have an auxiliary test file that contains
@ -240,7 +237,6 @@ mod directives {
pub const KNOWN_BUG: &'static str = "known-bug";
pub const TEST_MIR_PASS: &'static str = "test-mir-pass";
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
pub const FILECHECK_FLAGS: &'static str = "filecheck-flags";
pub const NO_AUTO_CHECK_CFG: &'static str = "no-auto-check-cfg";
@ -274,7 +270,6 @@ impl TestProps {
check_run_results: false,
dont_check_compiler_stdout: false,
dont_check_compiler_stderr: false,
compare_output_lines_by_subset: false,
no_prefer_dynamic: false,
pretty_mode: "normal".to_string(),
pretty_compare_only: false,
@ -550,11 +545,6 @@ impl TestProps {
|s| s.trim().to_string(),
);
config.set_name_directive(ln, REMAP_SRC_BASE, &mut self.remap_src_base);
config.set_name_directive(
ln,
COMPARE_OUTPUT_LINES_BY_SUBSET,
&mut self.compare_output_lines_by_subset,
);
if let Some(flags) = config.parse_name_value_directive(ln, LLVM_COV_FLAGS) {
self.llvm_cov_flags.extend(split_flags(&flags));

View File

@ -2541,13 +2541,10 @@ impl<'test> TestCx<'test> {
return 0;
}
// If `compare-output-lines-by-subset` is not explicitly enabled then
// auto-enable it when a `runner` is in use since wrapper tools 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.props.compare_output_lines_by_subset || self.config.runner.is_some();
// 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();
let tmp;
let (expected, actual): (&str, &str) = if compare_output_by_lines {