rewrite overwrite-input to rmake

This commit is contained in:
Oneirical 2024-06-26 13:11:46 -04:00
parent bfc8dc8e5f
commit a6bb92ada7
6 changed files with 15 additions and 20 deletions

View File

@ -119,7 +119,6 @@ run-make/optimization-remarks-dir-pgo/Makefile
run-make/optimization-remarks-dir/Makefile run-make/optimization-remarks-dir/Makefile
run-make/output-type-permutations/Makefile run-make/output-type-permutations/Makefile
run-make/override-aliased-flags/Makefile run-make/override-aliased-flags/Makefile
run-make/overwrite-input/Makefile
run-make/panic-abort-eh_frame/Makefile run-make/panic-abort-eh_frame/Makefile
run-make/pass-linker-flags-flavor/Makefile run-make/pass-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile run-make/pass-linker-flags-from-dep/Makefile

View File

@ -1,7 +0,0 @@
include ../tools.mk
all:
$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
$(RUSTC_TEST_OP) "$(TMPDIR)"/file.stderr file.stderr
$(RUSTC_TEST_OP) "$(TMPDIR)"/folder.stderr folder.stderr

View File

@ -1,6 +1,4 @@
warning: ignoring --out-dir flag due to -o flag
error: the input file "main.rs" would be overwritten by the generated executable error: the input file "main.rs" would be overwritten by the generated executable
error: aborting due to 1 previous error; 1 warning emitted error: aborting due to 1 previous error

View File

@ -1,6 +1,4 @@
warning: ignoring --out-dir flag due to -o flag
error: the generated executable for the input file "main.rs" conflicts with the existing directory "." error: the generated executable for the input file "main.rs" conflicts with the existing directory "."
error: aborting due to 1 previous error; 1 warning emitted error: aborting due to 1 previous error

View File

@ -1,6 +0,0 @@
warning: ignoring --out-dir flag due to -o flag
error: the input file "main.rs" would be overwritten by the generated executable
error: aborting due to 1 previous error; 1 warning emitted

View File

@ -0,0 +1,13 @@
// An attempt to set the output `-o` into a directory or a file we cannot write into should indeed
// be an error; but not an ICE (Internal Compiler Error). This test attempts both and checks
// that the standard error matches what is expected.
// See https://github.com/rust-lang/rust/issues/66530
use run_make_support::{diff, rustc};
fn main() {
let file_out = rustc().input("main.rs").output("main.rs").run_fail().stderr_utf8();
let folder_out = rustc().input("main.rs").output(".").run_fail().stderr_utf8();
diff().expected_file("file.stderr").actual_text("actual-file-stderr", file_out).run();
diff().expected_file("folder.stderr").actual_text("actual-folder-stderr", folder_out).run();
}