Skip to content

Commit 852aae4

Browse files
Migrate run-make/cdylib to rmake.rs
1 parent 44b628d commit 852aae4

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ run-make/c-unwind-abi-catch-panic/Makefile
1515
run-make/cat-and-grep-sanity-check/Makefile
1616
run-make/cdylib-dylib-linkage/Makefile
1717
run-make/cdylib-fewer-symbols/Makefile
18-
run-make/cdylib/Makefile
1918
run-make/codegen-options-parsing/Makefile
2019
run-make/comment-section/Makefile
2120
run-make/compiler-lookup-paths-2/Makefile

tests/run-make/cdylib/Makefile

-23
This file was deleted.

tests/run-make/cdylib/rmake.rs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// When the cdylib crate type was added as a variation of dylib, it needed a test to check its function.
2+
// See https://github.com/rust-lang/rust/pull/33553
3+
4+
// @ignore-cross-compile
5+
6+
use std::fs::remove_file;
7+
8+
use run_make_support::{dynamic_lib, is_msvc, run, rustc, tmp_dir, Cc};
9+
10+
fn main() {
11+
rustc().input("bar.rs").run();
12+
rustc().input("foo.rs").run();
13+
14+
if is_msvc() {
15+
Cc::new()
16+
.input("foo.c")
17+
.arg(tmp_dir().join("foo.dll.lib"))
18+
.out_exe("foo")
19+
.run();
20+
} else {
21+
Cc::new()
22+
.input("foo.c")
23+
.arg("-lfoo")
24+
.output(tmp_dir().join("foo"))
25+
.library_search_path(tmp_dir())
26+
.run();
27+
}
28+
29+
run("foo");
30+
remove_file(dynamic_lib("foo")).unwrap();
31+
32+
rustc().input("foo.rs").arg("-Clto").run();
33+
run("foo");
34+
}

0 commit comments

Comments
 (0)