Skip to content

Commit

Permalink
rewrite raw-dylib-custom-dlltool to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 12, 2024
1 parent ae144bf commit ef1d03a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ run-make/profile/Makefile
run-make/prune-link-args/Makefile
run-make/raw-dylib-alt-calling-convention/Makefile
run-make/raw-dylib-c/Makefile
run-make/raw-dylib-custom-dlltool/Makefile
run-make/raw-dylib-import-name-type/Makefile
run-make/raw-dylib-link-ordinal/Makefile
run-make/raw-dylib-stdcall-ordinal/Makefile
Expand Down
11 changes: 0 additions & 11 deletions tests/run-make/raw-dylib-custom-dlltool/Makefile

This file was deleted.

24 changes: 24 additions & 0 deletions tests/run-make/raw-dylib-custom-dlltool/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Instead of using the default dlltool, the rust compiler can also accept a custom
// command file with the -C dlltool flag. This test uses it to compile some rust code
// with the raw_dylib Windows-exclusive feature, and checks that the output contains
// the string passed from the custom dlltool, confirming that the default dlltool was
// successfully overridden.
// See https://github.com/rust-lang/rust/pull/109677

//@ only-windows
//@ only-gnu
//@ needs-dlltool
// Reason: this test specifically checks the custom dlltool feature, only
// available on Windows-gnu.

use run_make_support::{diff, rustc};

fn main() {
let out = rustc()
.crate_type("lib")
.crate_name("raw_dylib_test")
.input("lib.rs")
.arg("-Cdlltool=script.cmd")
.run();
diff().expected_file("output.txt").actual_file("actual.txt").normalize(r#"\r"#, "").run();
}
2 changes: 1 addition & 1 deletion tests/run-make/raw-dylib-custom-dlltool/script.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
echo Called dlltool via script.cmd> %TMPDIR%\output.txt
echo Called dlltool via script.cmd> %TMPDIR%\actual.txt
dlltool.exe %*
14 changes: 7 additions & 7 deletions tests/run-make/raw-dylib-inline-cross-dylib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ fn main() {
// Make sure we do find an import to the functions we expect to be imported.
.assert_stdout_contains("library_function");
if is_msvc() {
cc().arg("-c").out_exe("extern_1.obj").input("extern_1.c").run();
cc().arg("-c").out_exe("extern_2.obj").input("extern_2.c").run();
cc().arg("-c").out_exe("extern_1").input("extern_1.c").run();
cc().arg("-c").out_exe("extern_2").input("extern_2.c").run();
cc().input("extern_1.obj")
.arg("-link")
.arg("-dll")
Expand All @@ -47,15 +47,15 @@ fn main() {
.arg("-noimplib")
.run();
} else {
cc().arg("-v").arg("-c").out_exe("extern_1.obj").input("extern_1.c").run();
cc().arg("-v").arg("-c").out_exe("extern_2.obj").input("extern_2.c").run();
cc().input("extern_1.obj").out_exe("extern_1.dll").arg("-shared").run();
cc().input("extern_2.obj").out_exe("extern_2.dll").arg("-shared").run();
cc().arg("-v").arg("-c").out_exe("extern_1").input("extern_1.c").run();
cc().arg("-v").arg("-c").out_exe("extern_2").input("extern_2.c").run();
cc().input("extern_1").out_exe("extern_1.dll").arg("-shared").run();
cc().input("extern_2").out_exe("extern_2.dll").arg("-shared").run();
}
let out = run("driver").stdout_utf8();
diff()
.expected_file("output.txt")
.actual_text("actual_output", out)
.normalize(r#"\\r"#, "")
.normalize(r#"\r"#, "")
.run();
}

0 comments on commit ef1d03a

Please sign in to comment.