1- // Like the `long-linker-command-lines` test this test attempts to blow
2- // a command line limit for running the linker. Unlike that test, however,
3- // this test is testing `cmd.exe` specifically rather than the OS.
4- //
5- // Unfortunately `cmd.exe` has a 8192 limit which is relatively small
6- // in the grand scheme of things and anyone sripting rustc's linker
7- // is probably using a `*.bat` script and is likely to hit this limit.
8- //
9- // This test uses a `foo.bat` script as the linker which just simply
10- // delegates back to this program. The compiler should use a lower
11- // limit for arguments before passing everything via `@`, which
12- // means that everything should still succeed here.
13-
141use std:: env;
152use std:: fs:: { self , File } ;
163use std:: io:: { BufWriter , Read , Write } ;
174use std:: path:: PathBuf ;
185use std:: process:: Command ;
196
207fn main ( ) {
21- if !cfg ! ( windows) {
22- return ;
23- }
24-
25- let tmpdir = PathBuf :: from ( env:: var_os ( "OUT_DIR" ) . unwrap ( ) ) ;
26- let ok = tmpdir. join ( "ok" ) ;
27- let not_ok = tmpdir. join ( "not_ok" ) ;
8+ let ok = PathBuf :: from ( "ok" ) ;
9+ let not_ok = PathBuf :: from ( "not_ok" ) ;
2810 if env:: var ( "YOU_ARE_A_LINKER" ) . is_ok ( ) {
2911 match env:: args_os ( ) . find ( |a| a. to_string_lossy ( ) . contains ( "@" ) ) {
3012 Some ( file) => {
@@ -45,7 +27,7 @@ fn main() {
4527 for i in ( 1 ..) . map ( |i| i * 10 ) {
4628 println ! ( "attempt: {}" , i) ;
4729
48- let file = tmpdir . join ( "bar.rs" ) ;
30+ let file = PathBuf :: from ( "bar.rs" ) ;
4931 let mut f = BufWriter :: new ( File :: create ( & file) . unwrap ( ) ) ;
5032 let mut lib_name = String :: new ( ) ;
5133 for _ in 0 ..i {
@@ -63,8 +45,6 @@ fn main() {
6345 . arg ( & file)
6446 . arg ( "-C" )
6547 . arg ( & bat_linker)
66- . arg ( "--out-dir" )
67- . arg ( & tmpdir)
6848 . env ( "YOU_ARE_A_LINKER" , "1" )
6949 . env ( "MY_LINKER" , & me)
7050 . status ( )
0 commit comments