@@ -9,11 +9,13 @@ use std::process::Command;
9
9
use tracing:: * ;
10
10
11
11
use crate :: common:: { Config , Debugger , FailMode , Mode , PassMode } ;
12
+ use crate :: header:: auxiliary:: { AuxProps , parse_and_update_aux} ;
12
13
use crate :: header:: cfg:: { MatchOutcome , parse_cfg_name_directive} ;
13
14
use crate :: header:: needs:: CachedNeedsConditions ;
14
15
use crate :: util:: static_regex;
15
16
use crate :: { extract_cdb_version, extract_gdb_version} ;
16
17
18
+ pub ( crate ) mod auxiliary;
17
19
mod cfg;
18
20
mod needs;
19
21
#[ cfg( test) ]
@@ -33,9 +35,10 @@ impl HeadersCache {
33
35
/// the test.
34
36
#[ derive( Default ) ]
35
37
pub struct EarlyProps {
36
- pub aux : Vec < String > ,
37
- pub aux_bin : Vec < String > ,
38
- pub aux_crate : Vec < ( String , String ) > ,
38
+ /// Auxiliary crates that should be built and made available to this test.
39
+ /// Included in [`EarlyProps`] so that the indicated files can participate
40
+ /// in up-to-date checking. Building happens via [`TestProps::aux`] instead.
41
+ pub ( crate ) aux : AuxProps ,
39
42
pub revisions : Vec < String > ,
40
43
}
41
44
@@ -55,21 +58,7 @@ impl EarlyProps {
55
58
testfile,
56
59
rdr,
57
60
& mut |HeaderLine { directive : ln, .. } | {
58
- config. push_name_value_directive ( ln, directives:: AUX_BUILD , & mut props. aux , |r| {
59
- r. trim ( ) . to_string ( )
60
- } ) ;
61
- config. push_name_value_directive (
62
- ln,
63
- directives:: AUX_BIN ,
64
- & mut props. aux_bin ,
65
- |r| r. trim ( ) . to_string ( ) ,
66
- ) ;
67
- config. push_name_value_directive (
68
- ln,
69
- directives:: AUX_CRATE ,
70
- & mut props. aux_crate ,
71
- Config :: parse_aux_crate,
72
- ) ;
61
+ parse_and_update_aux ( config, ln, & mut props. aux ) ;
73
62
config. parse_and_update_revisions ( ln, & mut props. revisions ) ;
74
63
} ,
75
64
) ;
@@ -98,18 +87,8 @@ pub struct TestProps {
98
87
// If present, the name of a file that this test should match when
99
88
// pretty-printed
100
89
pub pp_exact : Option < PathBuf > ,
101
- // Other crates that should be compiled (typically from the same
102
- // directory as the test, but for backwards compatibility reasons
103
- // we also check the auxiliary directory)
104
- pub aux_builds : Vec < String > ,
105
- // Auxiliary crates that should be compiled as `#![crate_type = "bin"]`.
106
- pub aux_bins : Vec < String > ,
107
- // Similar to `aux_builds`, but a list of NAME=somelib.rs of dependencies
108
- // to build and pass with the `--extern` flag.
109
- pub aux_crates : Vec < ( String , String ) > ,
110
- /// Similar to `aux_builds`, but also passes the resulting dylib path to
111
- /// `-Zcodegen-backend`.
112
- pub aux_codegen_backend : Option < String > ,
90
+ /// Auxiliary crates that should be built and made available to this test.
91
+ pub ( crate ) aux : AuxProps ,
113
92
// Environment settings to use for compiling
114
93
pub rustc_env : Vec < ( String , String ) > ,
115
94
// Environment variables to unset prior to compiling.
@@ -276,10 +255,7 @@ impl TestProps {
276
255
run_flags : vec ! [ ] ,
277
256
doc_flags : vec ! [ ] ,
278
257
pp_exact : None ,
279
- aux_builds : vec ! [ ] ,
280
- aux_bins : vec ! [ ] ,
281
- aux_crates : vec ! [ ] ,
282
- aux_codegen_backend : None ,
258
+ aux : Default :: default ( ) ,
283
259
revisions : vec ! [ ] ,
284
260
rustc_env : vec ! [
285
261
( "RUSTC_ICE" . to_string( ) , "0" . to_string( ) ) ,
@@ -454,21 +430,10 @@ impl TestProps {
454
430
PRETTY_COMPARE_ONLY ,
455
431
& mut self . pretty_compare_only ,
456
432
) ;
457
- config. push_name_value_directive ( ln, AUX_BUILD , & mut self . aux_builds , |r| {
458
- r. trim ( ) . to_string ( )
459
- } ) ;
460
- config. push_name_value_directive ( ln, AUX_BIN , & mut self . aux_bins , |r| {
461
- r. trim ( ) . to_string ( )
462
- } ) ;
463
- config. push_name_value_directive (
464
- ln,
465
- AUX_CRATE ,
466
- & mut self . aux_crates ,
467
- Config :: parse_aux_crate,
468
- ) ;
469
- if let Some ( r) = config. parse_name_value_directive ( ln, AUX_CODEGEN_BACKEND ) {
470
- self . aux_codegen_backend = Some ( r. trim ( ) . to_owned ( ) ) ;
471
- }
433
+
434
+ // Call a helper method to deal with aux-related directives.
435
+ parse_and_update_aux ( config, ln, & mut self . aux ) ;
436
+
472
437
config. push_name_value_directive (
473
438
ln,
474
439
EXEC_ENV ,
@@ -942,14 +907,6 @@ fn iter_header(
942
907
}
943
908
944
909
impl Config {
945
- fn parse_aux_crate ( r : String ) -> ( String , String ) {
946
- let mut parts = r. trim ( ) . splitn ( 2 , '=' ) ;
947
- (
948
- parts. next ( ) . expect ( "missing aux-crate name (e.g. log=log.rs)" ) . to_string ( ) ,
949
- parts. next ( ) . expect ( "missing aux-crate value (e.g. log=log.rs)" ) . to_string ( ) ,
950
- )
951
- }
952
-
953
910
fn parse_and_update_revisions ( & self , line : & str , existing : & mut Vec < String > ) {
954
911
if let Some ( raw) = self . parse_name_value_directive ( line, "revisions" ) {
955
912
let mut duplicates: HashSet < _ > = existing. iter ( ) . cloned ( ) . collect ( ) ;
0 commit comments