@@ -1239,20 +1239,56 @@ mod staging {
12391239 TEST_TRIPLE_1 , configure, configure_with_args, render_steps, run_build,
12401240 } ;
12411241
1242+ #[ test]
1243+ fn build_compiler_no_stage ( ) {
1244+ insta:: assert_snapshot!( get_steps( "compiler" , "build" , None ) , @r"
1245+ [build] llvm <target1>
1246+ [build] rustc 0 <target1> -> rustc 1 <target1>
1247+ [build] rustc 0 <target1> -> rustc 1 <target1>
1248+ " ) ;
1249+ }
1250+
1251+ #[ test]
1252+ fn build_compiler_stage_0 ( ) {
1253+ insta:: assert_snapshot!( get_steps( "compiler" , "build" , Some ( 0 ) ) , @r"
1254+ [build] llvm <target1>
1255+ [build] rustc 0 <target1> -> rustc 1 <target1>
1256+ " ) ;
1257+ }
1258+
12421259 #[ test]
12431260 fn build_compiler_stage_1 ( ) {
1244- let mut cache = run_build (
1245- & [ "compiler" . into ( ) ] ,
1246- configure_with_args ( & [ "build" , "--stage" , "1" ] , & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ,
1247- ) ;
1248- let steps = cache. into_executed_steps ( ) ;
1249- insta:: assert_snapshot!( render_steps( & steps) , @r"
1250- [build] rustc 0 <target1> -> std 0 <target1>
1261+ insta:: assert_snapshot!( get_steps( "compiler" , "build" , Some ( 1 ) ) , @r"
12511262 [build] llvm <target1>
12521263 [build] rustc 0 <target1> -> rustc 1 <target1>
12531264 [build] rustc 0 <target1> -> rustc 1 <target1>
12541265 " ) ;
12551266 }
1267+
1268+ #[ test]
1269+ fn build_compiler_stage_2 ( ) {
1270+ insta:: assert_snapshot!( get_steps( "compiler" , "build" , Some ( 2 ) ) , @r"
1271+ [build] llvm <target1>
1272+ [build] rustc 0 <target1> -> rustc 1 <target1>
1273+ [build] rustc 1 <target1> -> std 1 <target1>
1274+ [build] rustc 1 <target1> -> rustc 2 <target1>
1275+ [build] rustc 1 <target1> -> rustc 2 <target1>
1276+ " ) ;
1277+ }
1278+
1279+ fn get_steps ( path : & str , kind : & str , stage : Option < u32 > ) -> String {
1280+ let mut args = vec ! [ kind] ;
1281+ let stage_str = stage. map ( |v| v. to_string ( ) ) . unwrap_or_default ( ) ;
1282+ if let Some ( stage) = stage {
1283+ args. push ( "--stage" ) ;
1284+ args. push ( & stage_str) ;
1285+ }
1286+ let mut cache = run_build (
1287+ & [ path. into ( ) ] ,
1288+ configure_with_args ( & args, & [ TEST_TRIPLE_1 ] , & [ TEST_TRIPLE_1 ] ) ,
1289+ ) ;
1290+ render_steps ( & cache. into_executed_steps ( ) )
1291+ }
12561292}
12571293
12581294/// Renders the executed bootstrap steps for usage in snapshot tests with insta.
0 commit comments