File tree 3 files changed +29
-20
lines changed
tests/run-make/env-dep-info
3 files changed +29
-20
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ run-make/dump-mono-stats/Makefile
26
26
run-make/emit-path-unhashed/Makefile
27
27
run-make/emit-shared-files/Makefile
28
28
run-make/emit-to-stdout/Makefile
29
- run-make/env-dep-info/Makefile
30
29
run-make/export-executable-symbols/Makefile
31
30
run-make/extern-diff-internal-name/Makefile
32
31
run-make/extern-flag-disambiguates/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // Inside dep-info emit files, #71858 made it so all accessed environment
2
+ // variables are usefully printed. This test checks that this feature works
3
+ // as intended by checking if the environment variables used in compilation
4
+ // appear in the output dep-info files.
5
+ // See https://github.com/rust-lang/rust/issues/40364
6
+
7
+ use run_make_support:: { fs_wrapper, rustc} ;
8
+
9
+ // FIXME(Oneirical): try on musl
10
+
11
+ fn main ( ) {
12
+ rustc ( )
13
+ . env ( "EXISTING_ENV" , "1" )
14
+ . env ( "EXISTING_OPT_ENV" , "1" )
15
+ . emit ( "dep-info" )
16
+ . input ( "main.rs" )
17
+ . run ( ) ;
18
+ let dep_info = fs_wrapper:: read_to_string ( "main.d" ) ;
19
+ assert ! ( & dep_info. contains( "# env-dep:EXISTING_ENV=1" ) ) ;
20
+ assert ! ( & dep_info. contains( "# env-dep:EXISTING_OPT_ENV=1" ) ) ;
21
+ assert ! ( & dep_info. contains( "# env-dep:NONEXISTENT_OPT_ENV" ) ) ;
22
+ assert ! ( dep_info. contains( r#"# env-dep:ESCAPE\nESCAPE\\"# ) ) ;
23
+ // Procedural macro
24
+ rustc ( ) . input ( "macro_def.rs" ) . run ( ) ;
25
+ rustc ( ) . env ( "EXISTING_PROC_MACRO_ENV" , "1" ) . emit ( "dep-info" ) . input ( "macro_use.rs" ) . run ( ) ;
26
+ let dep_info = fs_wrapper:: read_to_string ( "macro_use.d" ) ;
27
+ assert ! ( & dep_info. contains( "# env-dep:EXISTING_PROC_MACRO_ENV=1" ) ) ;
28
+ assert ! ( dep_info. contains( "# env-dep:NONEXISTENT_PROC_MACEO_ENV" ) ) ;
29
+ }
You can’t perform that action at this time.
0 commit comments