1- // This is a test which attempts to blow out the system limit with how many
2- // arguments can be passed to a process. This'll successively call rustc with
3- // larger and larger argument lists in an attempt to find one that's way too
4- // big for the system at hand. This file itself is then used as a "linker" to
5- // detect when the process creation succeeds.
6- //
7- // Eventually we should see an argument that looks like `@` as we switch from
8- // passing literal arguments to passing everything in the file.
9-
101use std:: collections:: HashSet ;
112use std:: env;
123use std:: fs:: { self , File } ;
@@ -43,8 +34,7 @@ fn read_linker_args(path: &Path) -> String {
4334}
4435
4536fn main ( ) {
46- let tmpdir = PathBuf :: from ( env:: var_os ( "TMPDIR" ) . unwrap ( ) ) ;
47- let ok = tmpdir. join ( "ok" ) ;
37+ let ok = PathBuf :: from ( "ok" ) ;
4838 if env:: var ( "YOU_ARE_A_LINKER" ) . is_ok ( ) {
4939 if let Some ( file) = env:: args_os ( ) . find ( |a| a. to_string_lossy ( ) . contains ( "@" ) ) {
5040 let file = file. to_str ( ) . expect ( "non-utf8 file argument" ) ;
@@ -57,16 +47,14 @@ fn main() {
5747 let me_as_linker = format ! ( "linker={}" , env:: current_exe( ) . unwrap( ) . display( ) ) ;
5848 for i in ( 1 ..) . map ( |i| i * 100 ) {
5949 println ! ( "attempt: {}" , i) ;
60- let file = tmpdir . join ( "bar.rs" ) ;
50+ let file = PathBuf :: from ( "bar.rs" ) ;
6151 let mut expected_libs = write_test_case ( & file, i) ;
6252
6353 drop ( fs:: remove_file ( & ok) ) ;
6454 let output = Command :: new ( & rustc)
6555 . arg ( & file)
6656 . arg ( "-C" )
6757 . arg ( & me_as_linker)
68- . arg ( "--out-dir" )
69- . arg ( & tmpdir)
7058 . env ( "YOU_ARE_A_LINKER" , "1" )
7159 . output ( )
7260 . unwrap ( ) ;
0 commit comments