rewrite unknown-mod-stdin to rmake

This commit is contained in:
Oneirical 2024-06-19 10:45:45 -04:00
parent c4c0897a26
commit 55b581689d
3 changed files with 25 additions and 9 deletions

View File

@ -187,7 +187,6 @@ run-make/track-path-dep-info/Makefile
run-make/track-pgo-dep-info/Makefile
run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unknown-mod-stdin/Makefile
run-make/unstable-flag-required/Makefile
run-make/used-cdylib-macos/Makefile
run-make/volatile-intrinsics/Makefile

View File

@ -1,8 +0,0 @@
# ignore-windows
include ../tools.mk
all:
echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully"
$(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
$(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr

View File

@ -0,0 +1,25 @@
// Rustc displays a compilation error when it finds a `mod` (module)
// statement referencing a file that does not exist. However, a bug from 2019
// caused invalid `mod` statements to silently insert empty inline modules
// instead of showing an error if the invalid `mod` statement had been passed
// through standard input. This test checks that this bug does not make a resurgence.
// See https://github.com/rust-lang/rust/issues/65601
// NOTE: This is not a UI test, because the bug which this test
// is checking for is specifically tied to passing
// `mod unknown;` through standard input.
use run_make_support::{diff, rustc};
fn main() {
let out = rustc().crate_type("rlib").stdin(b"mod unknown;").arg("-").run_fail();
diff()
.actual_text("actual-stdout", out.stdout_utf8())
.expected_file("unknown-mod.stdout")
.run();
diff()
.actual_text("actual-stderr", out.stderr_utf8())
.expected_file("unknown-mod.stderr")
.normalize(r#"\\"#, "/")
.run();
}