@@ -10,8 +10,8 @@ use crate::core::build_steps::doc::DocumentationFormat;
10
10
use crate :: core:: config:: Config ;
11
11
use crate :: utils:: cache:: ExecutedStep ;
12
12
use crate :: utils:: helpers:: get_host_target;
13
- use crate :: utils:: tests:: ConfigBuilder ;
14
13
use crate :: utils:: tests:: git:: { GitCtx , git_test} ;
14
+ use crate :: utils:: tests:: { ConfigBuilder , TestCtx } ;
15
15
16
16
static TEST_TRIPLE_1 : & str = "i686-unknown-haiku" ;
17
17
static TEST_TRIPLE_2 : & str = "i686-unknown-hurd-gnu" ;
@@ -22,38 +22,13 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
22
22
}
23
23
24
24
fn configure_with_args ( cmd : & [ & str ] , host : & [ & str ] , target : & [ & str ] ) -> Config {
25
- let cmd = cmd. iter ( ) . copied ( ) . map ( String :: from) . collect :: < Vec < _ > > ( ) ;
26
- let mut config = Config :: parse ( Flags :: parse ( & cmd) ) ;
27
- // don't save toolstates
28
- config. save_toolstates = None ;
29
- config. set_dry_run ( DryRun :: SelfCheck ) ;
30
-
31
- // Ignore most submodules, since we don't need them for a dry run, and the
32
- // tests run much faster without them.
33
- //
34
- // The src/doc/book submodule is needed because TheBook step tries to
35
- // access files even during a dry-run (may want to consider just skipping
36
- // that in a dry run).
37
- let submodule_build = Build :: new ( Config {
38
- // don't include LLVM, so CI doesn't require ninja/cmake to be installed
39
- rust_codegen_backends : vec ! [ ] ,
40
- ..Config :: parse ( Flags :: parse ( & [ "check" . to_owned ( ) ] ) )
41
- } ) ;
42
- submodule_build. require_submodule ( "src/doc/book" , None ) ;
43
- config. submodules = Some ( false ) ;
44
-
45
- config. ninja_in_file = false ;
46
- // try to avoid spurious failures in dist where we create/delete each others file
47
- // HACK: rather than pull in `tempdir`, use the one that cargo has conveniently created for us
48
- let dir = Path :: new ( env ! ( "OUT_DIR" ) )
49
- . join ( "tmp-rustbuild-tests" )
50
- . join ( & thread:: current ( ) . name ( ) . unwrap_or ( "unknown" ) . replace ( ":" , "-" ) ) ;
51
- t ! ( fs:: create_dir_all( & dir) ) ;
52
- config. out = dir;
53
- config. host_target = TargetSelection :: from_user ( TEST_TRIPLE_1 ) ;
54
- config. hosts = host. iter ( ) . map ( |s| TargetSelection :: from_user ( s) ) . collect ( ) ;
55
- config. targets = target. iter ( ) . map ( |s| TargetSelection :: from_user ( s) ) . collect ( ) ;
56
- config
25
+ TestCtx :: new ( )
26
+ . config ( cmd[ 0 ] )
27
+ . args ( & cmd[ 1 ..] )
28
+ . hosts ( host)
29
+ . targets ( target)
30
+ . args ( & [ "--build" , TEST_TRIPLE_1 ] )
31
+ . create_config ( )
57
32
}
58
33
59
34
fn first < A , B > ( v : Vec < ( A , B ) > ) -> Vec < A > {
@@ -547,8 +522,8 @@ mod snapshot {
547
522
548
523
use crate :: core:: build_steps:: { compile, dist, doc, test, tool} ;
549
524
use crate :: core:: builder:: tests:: {
550
- RenderConfig , TEST_TRIPLE_1 , TEST_TRIPLE_2 , TEST_TRIPLE_3 , configure, configure_with_args ,
551
- first , host_target , render_steps, run_build,
525
+ RenderConfig , TEST_TRIPLE_1 , TEST_TRIPLE_2 , TEST_TRIPLE_3 , configure, first , host_target ,
526
+ render_steps, run_build,
552
527
} ;
553
528
use crate :: core:: builder:: { Builder , Kind , StepDescription , StepMetadata } ;
554
529
use crate :: core:: config:: TargetSelection ;
0 commit comments