Skip to content

Commit 3a14ef0

Browse files
committed
rewrite archive-duplicate-names to rmake
1 parent bfa10ac commit 3a14ef0

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
run-make/archive-duplicate-names/Makefile
21
run-make/atomic-lock-free/Makefile
32
run-make/branch-protection-check-IBT/Makefile
43
run-make/c-dynamic-dylib/Makefile

tests/run-make/archive-duplicate-names/Makefile

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// When two object archives with the same filename are present, an iterator is supposed to
2+
// inspect each object, recognize the duplication and extract each one to a different directory.
3+
// This test checks that this duplicate handling behaviour has not been broken.
4+
// See https://github.com/rust-lang/rust/pull/24439
5+
6+
//@ ignore-cross-compile
7+
// Reason: the compiled binary is executed
8+
9+
use run_make_support::{cc, fs_wrapper, is_msvc, llvm_ar, run, rustc};
10+
11+
fn main() {
12+
fs_wrapper::create_dir("a");
13+
fs_wrapper::create_dir("b");
14+
compile_obj_force_foo("a", "foo");
15+
compile_obj_force_foo("b", "bar");
16+
let mut ar = llvm_ar();
17+
ar.obj_to_ar().arg("libfoo.a");
18+
if is_msvc() {
19+
ar.arg("a/foo.obj").arg("b/foo.obj").run();
20+
} else {
21+
ar.arg("a/foo.o").arg("b/foo.o").run();
22+
}
23+
rustc().input("foo.rs").run();
24+
rustc().input("bar.rs").run();
25+
run("bar");
26+
}
27+
28+
#[track_caller]
29+
pub fn compile_obj_force_foo(dir: &str, lib_name: &str) {
30+
let obj_file = if is_msvc() { format!("{dir}/foo") } else { format!("{dir}/foo.o") };
31+
let src = format!("{lib_name}.c");
32+
if is_msvc() {
33+
cc().arg("-c").out_exe(&obj_file).input(src).run();
34+
} else {
35+
cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run();
36+
};
37+
}

0 commit comments

Comments
 (0)