about summary refs log tree commit diff
path: root/tests/run-make/raw-dylib-cross-compilation/rmake.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/raw-dylib-cross-compilation/rmake.rs')
-rw-r--r--tests/run-make/raw-dylib-cross-compilation/rmake.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/run-make/raw-dylib-cross-compilation/rmake.rs b/tests/run-make/raw-dylib-cross-compilation/rmake.rs
new file mode 100644
index 00000000000..3eb55546314
--- /dev/null
+++ b/tests/run-make/raw-dylib-cross-compilation/rmake.rs
@@ -0,0 +1,41 @@
+// When cross-compiling using `raw-dylib`, rustc would try to fetch some
+// very specific `dlltool` to complete the cross-compilation (such as `i686-w64-mingw32-dlltool`)
+// when Windows only calls it `dlltool`. This test performs some cross-compilation in a
+// way that previously failed due to this bug, and checks that it succeeds.
+// See https://github.com/rust-lang/rust/pull/108355
+
+//@ ignore-i686-pc-windows-gnu
+// Reason: dlltool on this distribution is unable to produce x64 binaries
+//@ needs-dlltool
+// Reason: this is the utility being checked by this test
+
+use run_make_support::{llvm_objdump, rust_lib_name, rustc};
+
+fn main() {
+    // Build as x86 and make sure that we have x86 objects only.
+    rustc()
+        .crate_type("lib")
+        .crate_name("i686_raw_dylib_test")
+        .target("i686-pc-windows-gnu")
+        .input("lib.rs")
+        .run();
+    llvm_objdump()
+        .arg("-a")
+        .input(rust_lib_name("i686_raw_dylib_test"))
+        .run()
+        .assert_stdout_contains("file format coff-i386")
+        .assert_stdout_not_contains("file format coff-x86-64");
+    // Build as x64 and make sure that we have x64 objects only.
+    rustc()
+        .crate_type("lib")
+        .crate_name("x64_raw_dylib_test")
+        .target("x86_64-pc-windows-gnu")
+        .input("lib.rs")
+        .run();
+    llvm_objdump()
+        .arg("-a")
+        .input(rust_lib_name("x64_raw_dylib_test"))
+        .run()
+        .assert_stdout_not_contains("file format coff-i386")
+        .assert_stdout_contains("file format coff-x86-64");
+}