diff options
| author | Urgau <urgau@numericable.fr> | 2024-05-02 12:04:20 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-05-03 08:09:57 +0200 |
| commit | 2c4214e0a00287be39c2b8d5331b4fa4f88b1390 (patch) | |
| tree | c6eecc3fc929edab41ded2bc90d6030f12b14dc9 | |
| parent | 0a03b0961a3a10a8ff5613f5500f8d1eef836f08 (diff) | |
| download | rust-2c4214e0a00287be39c2b8d5331b4fa4f88b1390.tar.gz rust-2c4214e0a00287be39c2b8d5331b4fa4f88b1390.zip | |
run-make: port stdin-rustc to Rust-based rmake.rs
| -rw-r--r-- | src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 | ||||
| -rw-r--r-- | tests/run-make/stdin-non-utf8/Makefile | 6 | ||||
| -rw-r--r-- | tests/run-make/stdin-non-utf8/non-utf8 | 1 | ||||
| -rw-r--r-- | tests/run-make/stdin-rustc/rmake.rs | 26 |
4 files changed, 26 insertions, 8 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 69c6dda4b19..4b79b910ec3 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -288,7 +288,6 @@ run-make/static-unwinding/Makefile run-make/staticlib-blank-lib/Makefile run-make/staticlib-dylib-linkage/Makefile run-make/std-core-cycle/Makefile -run-make/stdin-non-utf8/Makefile run-make/suspicious-library/Makefile run-make/symbol-mangling-hashed/Makefile run-make/symbol-visibility/Makefile diff --git a/tests/run-make/stdin-non-utf8/Makefile b/tests/run-make/stdin-non-utf8/Makefile deleted file mode 100644 index 709d4cf1408..00000000000 --- a/tests/run-make/stdin-non-utf8/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - cp non-utf8 $(TMPDIR)/non-utf.rs - cat $(TMPDIR)/non-utf.rs | $(RUSTC) - 2>&1 \ - | $(CGREP) "error: couldn't read from stdin, as it did not contain valid UTF-8" diff --git a/tests/run-make/stdin-non-utf8/non-utf8 b/tests/run-make/stdin-non-utf8/non-utf8 deleted file mode 100644 index bc87051a852..00000000000 --- a/tests/run-make/stdin-non-utf8/non-utf8 +++ /dev/null @@ -1 +0,0 @@ -Ò diff --git a/tests/run-make/stdin-rustc/rmake.rs b/tests/run-make/stdin-rustc/rmake.rs new file mode 100644 index 00000000000..c07a6df4d84 --- /dev/null +++ b/tests/run-make/stdin-rustc/rmake.rs @@ -0,0 +1,26 @@ +//! This test checks rustc `-` (stdin) support + +use run_make_support::{is_windows, rustc, tmp_dir}; + +const HELLO_WORLD: &str = r#" +fn main() { + println!("Hello world!"); +} +"#; + +const NOT_UTF8: &[u8] = &[0xff, 0xff, 0xff]; + +fn main() { + let out_dir = tmp_dir(); + + // echo $HELLO_WORLD | rustc - + rustc().arg("-").stdin(HELLO_WORLD).run(); + assert!( + out_dir.join(if !is_windows() { "rust_out" } else { "rust_out.exe" }).try_exists().unwrap() + ); + + // echo $NOT_UTF8 | rustc - + let output = rustc().arg("-").stdin(NOT_UTF8).run_fail(); + let stderr = String::from_utf8(output.stderr).unwrap(); + assert!(stderr.contains("error: couldn't read from stdin, as it did not contain valid UTF-8")); +} |
