File tree 12 files changed +73
-57
lines changed
windows-binary-no-external-deps
12 files changed +73
-57
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -3,10 +3,8 @@ use std::process::Command;
3
3
4
4
fn main ( ) {
5
5
// 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
+ )
12
10
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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.
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments