Skip to content

Commit ef1d03a

Browse files
committed
rewrite raw-dylib-custom-dlltool to rmake
1 parent ae144bf commit ef1d03a

File tree

5 files changed

+32
-20
lines changed

5 files changed

+32
-20
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ run-make/profile/Makefile
119119
run-make/prune-link-args/Makefile
120120
run-make/raw-dylib-alt-calling-convention/Makefile
121121
run-make/raw-dylib-c/Makefile
122-
run-make/raw-dylib-custom-dlltool/Makefile
123122
run-make/raw-dylib-import-name-type/Makefile
124123
run-make/raw-dylib-link-ordinal/Makefile
125124
run-make/raw-dylib-stdcall-ordinal/Makefile

Diff for: tests/run-make/raw-dylib-custom-dlltool/Makefile

-11
This file was deleted.

Diff for: tests/run-make/raw-dylib-custom-dlltool/rmake.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Instead of using the default dlltool, the rust compiler can also accept a custom
2+
// command file with the -C dlltool flag. This test uses it to compile some rust code
3+
// with the raw_dylib Windows-exclusive feature, and checks that the output contains
4+
// the string passed from the custom dlltool, confirming that the default dlltool was
5+
// successfully overridden.
6+
// See https://github.com./rust-lang/rust/pull/109677
7+
8+
//@ only-windows
9+
//@ only-gnu
10+
//@ needs-dlltool
11+
// Reason: this test specifically checks the custom dlltool feature, only
12+
// available on Windows-gnu.
13+
14+
use run_make_support::{diff, rustc};
15+
16+
fn main() {
17+
let out = rustc()
18+
.crate_type("lib")
19+
.crate_name("raw_dylib_test")
20+
.input("lib.rs")
21+
.arg("-Cdlltool=script.cmd")
22+
.run();
23+
diff().expected_file("output.txt").actual_file("actual.txt").normalize(r#"\r"#, "").run();
24+
}

Diff for: tests/run-make/raw-dylib-custom-dlltool/script.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
echo Called dlltool via script.cmd> %TMPDIR%\output.txt
1+
echo Called dlltool via script.cmd> %TMPDIR%\actual.txt
22
dlltool.exe %*

Diff for: tests/run-make/raw-dylib-inline-cross-dylib/rmake.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ fn main() {
3232
// Make sure we do find an import to the functions we expect to be imported.
3333
.assert_stdout_contains("library_function");
3434
if is_msvc() {
35-
cc().arg("-c").out_exe("extern_1.obj").input("extern_1.c").run();
36-
cc().arg("-c").out_exe("extern_2.obj").input("extern_2.c").run();
35+
cc().arg("-c").out_exe("extern_1").input("extern_1.c").run();
36+
cc().arg("-c").out_exe("extern_2").input("extern_2.c").run();
3737
cc().input("extern_1.obj")
3838
.arg("-link")
3939
.arg("-dll")
@@ -47,15 +47,15 @@ fn main() {
4747
.arg("-noimplib")
4848
.run();
4949
} else {
50-
cc().arg("-v").arg("-c").out_exe("extern_1.obj").input("extern_1.c").run();
51-
cc().arg("-v").arg("-c").out_exe("extern_2.obj").input("extern_2.c").run();
52-
cc().input("extern_1.obj").out_exe("extern_1.dll").arg("-shared").run();
53-
cc().input("extern_2.obj").out_exe("extern_2.dll").arg("-shared").run();
50+
cc().arg("-v").arg("-c").out_exe("extern_1").input("extern_1.c").run();
51+
cc().arg("-v").arg("-c").out_exe("extern_2").input("extern_2.c").run();
52+
cc().input("extern_1").out_exe("extern_1.dll").arg("-shared").run();
53+
cc().input("extern_2").out_exe("extern_2.dll").arg("-shared").run();
5454
}
5555
let out = run("driver").stdout_utf8();
5656
diff()
5757
.expected_file("output.txt")
5858
.actual_text("actual_output", out)
59-
.normalize(r#"\\r"#, "")
59+
.normalize(r#"\r"#, "")
6060
.run();
6161
}

0 commit comments

Comments
 (0)