Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e707ec7

Browse files
committedApr 25, 2024
Port run-make --print=native-static-libs to rmake.rs
1 parent cb3752d commit e707ec7

File tree

3 files changed

+56
-20
lines changed

3 files changed

+56
-20
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ run-make/pretty-print-to-file/Makefile
221221
run-make/pretty-print-with-dep-file/Makefile
222222
run-make/print-calling-conventions/Makefile
223223
run-make/print-cfg/Makefile
224-
run-make/print-native-static-libs/Makefile
225224
run-make/print-target-list/Makefile
226225
run-make/profile/Makefile
227226
run-make/prune-link-args/Makefile

‎tests/run-make/print-native-static-libs/Makefile

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//! This checks the output of `--print=native-static-libs`
2+
3+
//@ ignore-cross-compile
4+
//@ ignore-wasm
5+
6+
extern crate run_make_support;
7+
8+
use std::io::BufRead;
9+
10+
use run_make_support::rustc;
11+
12+
fn main() {
13+
// build supporting crate
14+
rustc()
15+
.input("bar.rs")
16+
.arg("--crate-type")
17+
.arg("rlib")
18+
.arg("-lbar_cli")
19+
.run();
20+
21+
// build main crate as staticlib
22+
let output = rustc()
23+
.input("foo.rs")
24+
.arg("--crate-type")
25+
.arg("staticlib")
26+
.arg("-lfoo_cli")
27+
.arg("-lfoo_cli") // 2nd time
28+
.arg("--print=native-static-libs")
29+
.run();
30+
31+
let mut found_note = false;
32+
for l in output.stderr.lines() {
33+
let l = l.expect("utf-8 string");
34+
35+
let Some(args) = l.strip_prefix("note: native-static-libs:") else { continue; };
36+
assert!(!found_note);
37+
found_note = true;
38+
39+
let args: Vec<&str> = args.trim().split_ascii_whitespace().collect();
40+
41+
assert!(args.contains(&"-lglib-2.0")); // in bar.rs
42+
assert!(args.contains(&"-lsystemd")); // in foo.rs
43+
assert!(args.contains(&"-lbar_cli"));
44+
assert!(args.contains(&"-lfoo_cli"));
45+
46+
// make sure that no args are consecutively present
47+
let dedup_args: Vec<&str> = {
48+
let mut args = args.clone();
49+
args.dedup();
50+
args
51+
};
52+
assert_eq!(args, dedup_args);
53+
}
54+
55+
assert!(found_note);
56+
}

0 commit comments

Comments
 (0)
Failed to load comments.