This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +30
-0
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 5 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -875,6 +875,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
875875 "needs-sanitizer-shadow-call-stack" ,
876876 "needs-sanitizer-support" ,
877877 "needs-sanitizer-thread" ,
878+ "needs-symlink" ,
878879 "needs-threads" ,
879880 "needs-unwind" ,
880881 "needs-wasmtime" ,
Original file line number Diff line number Diff line change @@ -144,6 +144,11 @@ pub(super) fn handle_needs(
144144 condition : config. runner . as_ref ( ) . is_some_and ( |r| r. contains ( "wasmtime" ) ) ,
145145 ignore_reason : "ignored when wasmtime runner is not available" ,
146146 } ,
147+ Need {
148+ name : "needs-symlink" ,
149+ condition : cache. symlinks ,
150+ ignore_reason : "ignored if symlinks are unavailable" ,
151+ } ,
147152 ] ;
148153
149154 let ( name, comment) = match ln. split_once ( [ ':' , ' ' ] ) {
@@ -209,6 +214,7 @@ pub(super) struct CachedNeedsConditions {
209214 xray : bool ,
210215 rust_lld : bool ,
211216 dlltool : bool ,
217+ symlinks : bool ,
212218}
213219
214220impl CachedNeedsConditions {
@@ -253,6 +259,7 @@ impl CachedNeedsConditions {
253259 . exists ( ) ,
254260
255261 dlltool : find_dlltool ( & config) ,
262+ symlinks : has_symlinks ( ) ,
256263 }
257264 }
258265}
@@ -279,3 +286,22 @@ fn find_dlltool(config: &Config) -> bool {
279286 } ;
280287 dlltool_found
281288}
289+
290+ #[ cfg( windows) ]
291+ fn has_symlinks ( ) -> bool {
292+ if std:: env:: var_os ( "CI" ) . is_some ( ) {
293+ return true ;
294+ }
295+ let link = std:: env:: temp_dir ( ) . join ( "RUST_COMPILETEST_SYMLINK_CHECK" ) ;
296+ if std:: os:: windows:: fs:: symlink_file ( "DOES NOT EXIST" , & link) . is_ok ( ) {
297+ std:: fs:: remove_file ( & link) . unwrap ( ) ;
298+ true
299+ } else {
300+ false
301+ }
302+ }
303+
304+ #[ cfg( not( windows) ) ]
305+ fn has_symlinks ( ) -> bool {
306+ true
307+ }
Original file line number Diff line number Diff line change 99// can result in successful compilation.
1010
1111//@ ignore-cross-compile
12+ //@ needs-symlink
1213
1314use run_make_support:: { create_symlink, cwd, fs_wrapper, rustc} ;
1415
Original file line number Diff line number Diff line change 66// See https://github.com/rust-lang/rust/issues/12459
77
88//@ ignore-cross-compile
9+ //@ needs-symlink
910
1011use run_make_support:: { create_symlink, dynamic_lib_name, fs_wrapper, rustc} ;
1112
Original file line number Diff line number Diff line change 66// See https://github.com/rust-lang/rust/pull/32828
77
88//@ ignore-cross-compile
9+ //@ needs-symlink
910
1011use run_make_support:: { create_symlink, cwd, rustc} ;
1112
You can’t perform that action at this time.
0 commit comments