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 c0646f7

Browse files
committedMay 31, 2024
Migrate run-make/cdylib to rmake.rs
1 parent 2ecb08a commit c0646f7

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed
 

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

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

‎tests/run-make/cdylib/Makefile

-23
This file was deleted.

‎tests/run-make/cdylib/rmake.rs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This test tries to check that basic cdylib libraries can be compiled and linked successfully
2+
// with C code, that the cdylib itself can depend on another rlib, and that the library can be built
3+
// with LTO.
4+
//
5+
// - `bar.rs` is a rlib
6+
// - `foo.rs` is a cdylib that relies on an extern crate `bar` and defines two `extern "C"`
7+
// functions:
8+
// - `foo()` which calls `bar::bar()`.
9+
// - `bar()` which implements basic addition.
10+
11+
//@ ignore-cross-compile
12+
13+
use std::fs::remove_file;
14+
15+
use run_make_support::{cc, dynamic_lib, is_msvc, run, rustc, tmp_dir};
16+
17+
fn main() {
18+
rustc().input("bar.rs").run();
19+
rustc().input("foo.rs").run();
20+
21+
if is_msvc() {
22+
cc().input("foo.c")
23+
.arg(tmp_dir().join("foo.dll.lib"))
24+
.out_exe("foo")
25+
.run();
26+
} else {
27+
cc().input("foo.c")
28+
.arg("-lfoo")
29+
.output(tmp_dir().join("foo"))
30+
.library_search_path(tmp_dir())
31+
.run();
32+
}
33+
34+
run("foo");
35+
remove_file(dynamic_lib("foo")).unwrap();
36+
37+
rustc().input("foo.rs").arg("-Clto").run();
38+
run("foo");
39+
}

0 commit comments

Comments
 (0)
Failed to load comments.