Skip to content

Commit de1d0e0

Browse files
Migrate run-make/crate-data-smoke to rmake.rs
1 parent c0d6003 commit de1d0e0

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

src/tools/run-make-support/src/rustc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl Rustc {
205205

206206
/// Get the [`Output`][::std::process::Output] of the finished process.
207207
#[track_caller]
208-
pub fn command_output(&mut self) -> ::std::process::Output {
208+
pub fn command_output(&mut self) -> Output {
209209
// let's make sure we piped all the input and outputs
210210
self.cmd.stdin(Stdio::piped());
211211
self.cmd.stdout(Stdio::piped());

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
2424
run-make/compressed-debuginfo/Makefile
2525
run-make/const-prop-lint/Makefile
2626
run-make/const_fn_mir/Makefile
27-
run-make/crate-data-smoke/Makefile
2827
run-make/crate-hash-rustc-version/Makefile
2928
run-make/crate-name-priority/Makefile
3029
run-make/cross-lang-lto-clang/Makefile

tests/run-make/crate-data-smoke/Makefile

-10
This file was deleted.
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
use std::process::Output;
2+
3+
use run_make_support::{bin_name, rust_lib, rustc};
4+
5+
fn compare_stdout<S: AsRef<str>>(output: Output, expected: S) {
6+
assert_eq!(
7+
String::from_utf8(output.stdout).unwrap().trim(),
8+
expected.as_ref()
9+
);
10+
}
11+
12+
fn main() {
13+
compare_stdout(rustc().print("crate-name").input("crate.rs").run(), "foo");
14+
compare_stdout(
15+
rustc().print("file-names").input("crate.rs").run(),
16+
bin_name("foo"),
17+
);
18+
compare_stdout(
19+
rustc()
20+
.print("file-names")
21+
.crate_type("lib")
22+
.arg("--test")
23+
.input("crate.rs")
24+
.run(),
25+
bin_name("foo"),
26+
);
27+
compare_stdout(
28+
rustc()
29+
.print("file-names")
30+
.arg("--test")
31+
.input("lib.rs")
32+
.run(),
33+
bin_name("mylib"),
34+
);
35+
compare_stdout(
36+
rustc().print("file-names").input("lib.rs").run(),
37+
rust_lib("mylib").file_name().unwrap().to_string_lossy(),
38+
);
39+
compare_stdout(
40+
rustc().print("file-names").input("rlib.rs").run(),
41+
rust_lib("mylib").file_name().unwrap().to_string_lossy(),
42+
);
43+
}

0 commit comments

Comments
 (0)