Skip to content

Commit 1c8f516

Browse files
authored
Unrolled build for rust-lang#125723
Rollup merge of rust-lang#125723 - GuillaumeGomez:migrate-run-make-crate-data-smoke, r=jieyouxu Migrate `run-make/crate-data-smoke` to `rmake.rs` Part of rust-lang#121876. r? ``@jieyouxu``
2 parents 23ea77b + 301d722 commit 1c8f516

File tree

5 files changed

+51
-13
lines changed

5 files changed

+51
-13
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ pub fn dynamic_lib_name(name: &str) -> String {
135135
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
136136
/// path with `$TMPDIR` joined with the library name.
137137
pub fn rust_lib(name: &str) -> PathBuf {
138-
tmp_dir().join(format!("lib{name}.rlib"))
138+
tmp_dir().join(rust_lib_name(name))
139+
}
140+
141+
/// Generate the name a rust library (rlib) would have. If you want the complete path, use
142+
/// [`rust_lib`] instead.
143+
pub fn rust_lib_name(name: &str) -> String {
144+
format!("lib{name}.rlib")
139145
}
140146

141147
/// Construct the binary name based on platform.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl Rustc {
211211

212212
/// Get the [`Output`] of the finished process.
213213
#[track_caller]
214-
pub fn command_output(&mut self) -> ::std::process::Output {
214+
pub fn command_output(&mut self) -> Output {
215215
// let's make sure we piped all the input and outputs
216216
self.cmd.stdin(Stdio::piped());
217217
self.cmd.stdout(Stdio::piped());

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
2323
run-make/compressed-debuginfo/Makefile
2424
run-make/const-prop-lint/Makefile
2525
run-make/const_fn_mir/Makefile
26-
run-make/crate-data-smoke/Makefile
2726
run-make/crate-hash-rustc-version/Makefile
2827
run-make/crate-name-priority/Makefile
2928
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_name, 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_name("mylib"),
38+
);
39+
compare_stdout(
40+
rustc().print("file-names").input("rlib.rs").run(),
41+
rust_lib_name("mylib"),
42+
);
43+
}

0 commit comments

Comments
 (0)