-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use rmake
for windows-
run-make tests
#125613
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1e6544a
Move run-make windows_subsystem tests to ui tests
ChrisDenton f08e00f
Rename run-make/issue-85441 and convert to rmake
ChrisDenton e463f6f
Convert run-make/windows-spawn to rmake
ChrisDenton e03f9cb
Convert run-make/windows-safeseh to rmake
ChrisDenton 5ec0c00
Convert windows-binary-no-external-deps to rmake
ChrisDenton f34bbde
Remove Makefiles from allowed_run_make_makefiles
ChrisDenton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//! Ensure that we aren't relying on any non-system DLLs when running | ||
//! a "hello world" application by setting `PATH` to `C:\Windows\System32`. | ||
//@ only-windows | ||
|
||
use run_make_support::{rustc, tmp_dir}; | ||
use std::env; | ||
use std::path::PathBuf; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
rustc().input("hello.rs").run(); | ||
|
||
let windows_dir = env::var("SystemRoot").unwrap(); | ||
let system32: PathBuf = [&windows_dir, "System32"].iter().collect(); | ||
// Note: This does not use the support wrappers so that we can precisely control the PATH | ||
let exe = tmp_dir().join("hello.exe"); | ||
let status = Command::new(exe).env("PATH", &system32).spawn().unwrap().wait().unwrap(); | ||
if !status.success() { | ||
panic!("Command failed!\noutput status: `{status}`"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@ only-windows | ||
//@ needs-rust-lld | ||
|
||
use run_make_support::rustc; | ||
|
||
fn main() { | ||
// Ensure that LLD can link when an .rlib contains a synthetic object | ||
// file referencing exported or used symbols. | ||
rustc().input("foo.rs").linker("rust-lld").run(); | ||
|
||
// Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib. | ||
// Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware. | ||
rustc().input("baz.rs").run(); | ||
rustc().input("bar.rs").linker("rust-lld").link_arg("/WHOLEARCHIVE:libbaz.rlib").run(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ only-windows | ||
|
||
use run_make_support::{run, rustc, tmp_dir}; | ||
|
||
// On Windows `Command` uses `CreateProcessW` to run a new process. | ||
// However, in the past std used to not pass in the application name, leaving | ||
// `CreateProcessW` to use heuristics to guess the intended name from the | ||
// command line string. Sometimes this could go very wrong. | ||
// E.g. in Rust 1.0 `Command::new("foo").arg("bar").spawn()` will try to launch | ||
// `foo bar.exe` if foo.exe does not exist. Which is clearly not desired. | ||
|
||
fn main() { | ||
let out_dir = tmp_dir(); | ||
rustc().input("hello.rs").output(out_dir.join("hopefullydoesntexist bar.exe")).run(); | ||
rustc().input("spawn.rs").run(); | ||
run("spawn"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//@ only-msvc | ||
|
||
// Tests that WS2_32.dll is not unnecessarily linked, see issue #85441 | ||
|
||
use run_make_support::object::{self, read::Object}; | ||
use run_make_support::{rustc, tmp_dir}; | ||
use std::fs; | ||
|
||
fn main() { | ||
rustc().input("empty.rs").run(); | ||
rustc().input("tcp.rs").run(); | ||
|
||
assert!(!links_ws2_32("empty.exe")); | ||
assert!(links_ws2_32("tcp.exe")); | ||
} | ||
|
||
fn links_ws2_32(exe: &str) -> bool { | ||
let path = tmp_dir().join(exe); | ||
let binary_data = fs::read(path).unwrap(); | ||
let file = object::File::parse(&*binary_data).unwrap(); | ||
for import in file.imports().unwrap() { | ||
if import.library().eq_ignore_ascii_case(b"WS2_32.dll") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like how this test reads :3 |
||
return true; | ||
} | ||
} | ||
false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use std::net::TcpListener; | ||
|
||
fn main() { | ||
TcpListener::bind("127.0.0.1:80").unwrap(); | ||
} |
1 change: 1 addition & 0 deletions
1
tests/run-make/windows-subsystem/console.rs → tests/ui/windows-subsystem/console.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//@ run-pass | ||
#![windows_subsystem = "console"] | ||
|
||
fn main() {} |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/run-make/windows-subsystem/windows.rs → tests/ui/windows-subsystem/windows.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//@ run-pass | ||
#![windows_subsystem = "windows"] | ||
|
||
fn main() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark (to myself): we should probably expose the
handle_failed_output
helper to make this less repetitive.