Skip to content

Commit

Permalink
run-make: port stdin-rustc to Rust-based rmake.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed May 2, 2024
1 parent 0a03b09 commit 619a569
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions tests/run-make/stdin-non-utf8/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion tests/run-make/stdin-non-utf8/non-utf8

This file was deleted.

26 changes: 26 additions & 0 deletions tests/run-make/stdin-rustc/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! This test checks rustc `-` (stdin) support

extern crate run_make_support;

use run_make_support::{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("rust_out").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"));
}

0 comments on commit 619a569

Please sign in to comment.