@@ -9,11 +9,13 @@ use std::process::Command;
99use tracing:: * ;
1010
1111use crate :: common:: { Config , Debugger , FailMode , Mode , PassMode } ;
12+ use crate :: header:: auxiliary:: { AuxProps , parse_and_update_aux} ;
1213use crate :: header:: cfg:: { MatchOutcome , parse_cfg_name_directive} ;
1314use crate :: header:: needs:: CachedNeedsConditions ;
1415use crate :: util:: static_regex;
1516use crate :: { extract_cdb_version, extract_gdb_version} ;
1617
18+ pub ( crate ) mod auxiliary;
1719mod cfg;
1820mod needs;
1921#[ cfg( test) ]
@@ -33,9 +35,10 @@ impl HeadersCache {
3335/// the test.
3436#[ derive( Default ) ]
3537pub 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 ,
3942 pub revisions : Vec < String > ,
4043}
4144
@@ -55,21 +58,7 @@ impl EarlyProps {
5558 testfile,
5659 rdr,
5760 & 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 ) ;
7362 config. parse_and_update_revisions ( ln, & mut props. revisions ) ;
7463 } ,
7564 ) ;
@@ -98,18 +87,8 @@ pub struct TestProps {
9887 // If present, the name of a file that this test should match when
9988 // pretty-printed
10089 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 ,
11392 // Environment settings to use for compiling
11493 pub rustc_env : Vec < ( String , String ) > ,
11594 // Environment variables to unset prior to compiling.
@@ -276,10 +255,7 @@ impl TestProps {
276255 run_flags : vec ! [ ] ,
277256 doc_flags : vec ! [ ] ,
278257 pp_exact : None ,
279- aux_builds : vec ! [ ] ,
280- aux_bins : vec ! [ ] ,
281- aux_crates : vec ! [ ] ,
282- aux_codegen_backend : None ,
258+ aux : Default :: default ( ) ,
283259 revisions : vec ! [ ] ,
284260 rustc_env : vec ! [
285261 ( "RUSTC_ICE" . to_string( ) , "0" . to_string( ) ) ,
@@ -454,21 +430,10 @@ impl TestProps {
454430 PRETTY_COMPARE_ONLY ,
455431 & mut self . pretty_compare_only ,
456432 ) ;
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+
472437 config. push_name_value_directive (
473438 ln,
474439 EXEC_ENV ,
@@ -942,14 +907,6 @@ fn iter_header(
942907}
943908
944909impl 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-
953910 fn parse_and_update_revisions ( & self , line : & str , existing : & mut Vec < String > ) {
954911 if let Some ( raw) = self . parse_name_value_directive ( line, "revisions" ) {
955912 let mut duplicates: HashSet < _ > = existing. iter ( ) . cloned ( ) . collect ( ) ;
0 commit comments