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
-
14
1
use std:: env;
15
2
use std:: fs:: { self , File } ;
16
3
use std:: io:: { BufWriter , Read , Write } ;
17
4
use std:: path:: PathBuf ;
18
5
use std:: process:: Command ;
19
6
20
7
fn 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" ) ;
28
10
if env:: var ( "YOU_ARE_A_LINKER" ) . is_ok ( ) {
29
11
match env:: args_os ( ) . find ( |a| a. to_string_lossy ( ) . contains ( "@" ) ) {
30
12
Some ( file) => {
@@ -45,7 +27,7 @@ fn main() {
45
27
for i in ( 1 ..) . map ( |i| i * 10 ) {
46
28
println ! ( "attempt: {}" , i) ;
47
29
48
- let file = tmpdir . join ( "bar.rs" ) ;
30
+ let file = PathBuf :: from ( "bar.rs" ) ;
49
31
let mut f = BufWriter :: new ( File :: create ( & file) . unwrap ( ) ) ;
50
32
let mut lib_name = String :: new ( ) ;
51
33
for _ in 0 ..i {
@@ -63,8 +45,6 @@ fn main() {
63
45
. arg ( & file)
64
46
. arg ( "-C" )
65
47
. arg ( & bat_linker)
66
- . arg ( "--out-dir" )
67
- . arg ( & tmpdir)
68
48
. env ( "YOU_ARE_A_LINKER" , "1" )
69
49
. env ( "MY_LINKER" , & me)
70
50
. status ( )
0 commit comments