Skip to content

Commit dce71a7

Browse files
committed
Use rmake for windows- run-make tests
1 parent fec98b3 commit dce71a7

File tree

12 files changed

+73
-57
lines changed

12 files changed

+73
-57
lines changed

Diff for: tests/run-make/issue-85441/Makefile

-9
This file was deleted.

Diff for: tests/run-make/windows-binary-no-external-deps/Makefile

-9
This file was deleted.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ only-windows
2+
3+
// Ensure that we aren't relying on any non-system DLLs when compiling and running
4+
// a "hello world" application by setting `PATH` to `C:\Windows\System32`.
5+
6+
use run_make_support::{run, rustc};
7+
use std::env;
8+
use std::path::PathBuf;
9+
10+
fn main() {
11+
let windows_dir = env::var("SystemRoot").unwrap();
12+
let system32: PathBuf = [&windows_dir, "System32"].iter().collect();
13+
rustc().input("hello.rs").env("PATH", system32).run();
14+
run("hello");
15+
}

Diff for: tests/run-make/windows-safeseh/Makefile

-19
This file was deleted.

Diff for: tests/run-make/windows-safeseh/rmake.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ only-windows
2+
//@ needs-rust-lld
3+
4+
use run_make_support::rustc;
5+
6+
fn main() {
7+
// Ensure that LLD can link when an .rlib contains a synthetic object
8+
// file referencing exported or used symbols.
9+
rustc().input("foo.rs").arg("-Clinker=rust-lld").run();
10+
11+
// Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
12+
// Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
13+
rustc().input("baz.rs").run();
14+
rustc().input("bar.rs").arg("-Clinker=rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run();
15+
}

Diff for: tests/run-make/windows-spawn/Makefile

-8
This file was deleted.

Diff for: tests/run-make/windows-spawn/rmake.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ only-windows
2+
3+
use run_make_support::{run, rustc, tmp_dir};
4+
5+
// On Windows `Command` uses `CreateProcessW` to run a new process.
6+
// However, in the past std used to not pass in the application name, leaving
7+
// `CreateProcessW` to use heuristics to guess the intended name from the
8+
// command line string. Sometimes this could go very wrong.
9+
// E.g. in Rust 1.0 `Command::new("foo").arg("bar").spawn()` will try to launch
10+
// `foo bar.exe` if foo.exe does not exist. Which is clearly not desired.
11+
12+
fn main() {
13+
let out_dir = tmp_dir();
14+
rustc().input("hello.rs").output(out_dir.join("hopefullydoesntexist bar.exe")).run();
15+
rustc().input("spawn.rs").run();
16+
run("spawn");
17+
}

Diff for: tests/run-make/windows-spawn/spawn.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ use std::process::Command;
33

44
fn main() {
55
// Make sure it doesn't try to run "hopefullydoesntexist bar.exe".
6-
assert_eq!(Command::new("hopefullydoesntexist")
7-
.arg("bar")
8-
.spawn()
9-
.unwrap_err()
10-
.kind(),
11-
ErrorKind::NotFound);
6+
assert_eq!(
7+
Command::new("hopefullydoesntexist").arg("bar").spawn().unwrap_err().kind(),
8+
ErrorKind::NotFound
9+
)
1210
}

Diff for: tests/run-make/windows-subsystem/Makefile

-6
This file was deleted.

Diff for: tests/run-make/windows-subsystem/rmake.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ ignore-cross-compile
2+
3+
use run_make_support::rustc;
4+
5+
fn main() {
6+
rustc().input("windows.rs").run();
7+
rustc().input("console.rs").run();
8+
}
File renamed without changes.

Diff for: tests/run-make/windows-ws2_32/rmake.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ only-msvc
2+
3+
// Tests that WS2_32.dll is not unnecessarily linked, see issue #85441
4+
5+
use run_make_support::{rustc, tmp_dir};
6+
use std::process::Command;
7+
8+
fn main() {
9+
rustc().input("empty.rs").run();
10+
let empty = tmp_dir().join("empty.exe");
11+
let output = Command::new("dumpbin").arg("/imports").arg(&empty).output().unwrap();
12+
let output = String::from_utf8(output.stdout).unwrap();
13+
assert!(!output.to_ascii_uppercase().contains("WS2_32.DLL"));
14+
}

0 commit comments

Comments
 (0)