@@ -25,7 +25,6 @@ use crate::core::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
25
25
use crate :: core:: config:: flags:: get_completion;
26
26
use crate :: core:: config:: flags:: Subcommand ;
27
27
use crate :: core:: config:: TargetSelection ;
28
- use crate :: utils;
29
28
use crate :: utils:: cache:: { Interned , INTERNER } ;
30
29
use crate :: utils:: exec:: BootstrapCommand ;
31
30
use crate :: utils:: helpers:: {
@@ -38,23 +37,6 @@ use crate::{envify, CLang, DocTests, GitRepo, Mode};
38
37
39
38
const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
40
39
41
- // mir-opt tests have different variants depending on whether a target is 32bit or 64bit, and
42
- // blessing them requires blessing with each target. To aid developers, when blessing the mir-opt
43
- // test suite the corresponding target of the opposite pointer size is also blessed.
44
- //
45
- // This array serves as the known mappings between 32bit and 64bit targets. If you're developing on
46
- // a target where a target with the opposite pointer size exists, feel free to add it here.
47
- const MIR_OPT_BLESS_TARGET_MAPPING : & [ ( & str , & str ) ] = & [
48
- // (32bit, 64bit)
49
- ( "i686-unknown-linux-gnu" , "x86_64-unknown-linux-gnu" ) ,
50
- ( "i686-unknown-linux-musl" , "x86_64-unknown-linux-musl" ) ,
51
- ( "i686-pc-windows-msvc" , "x86_64-pc-windows-msvc" ) ,
52
- ( "i686-pc-windows-gnu" , "x86_64-pc-windows-gnu" ) ,
53
- // ARM Macs don't have a corresponding 32-bit target that they can (easily)
54
- // build for, so there is no entry for "aarch64-apple-darwin" here.
55
- // Likewise, i686 for macOS is no longer possible to build.
56
- ] ;
57
-
58
40
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
59
41
pub struct CrateBootstrap {
60
42
path : Interned < PathBuf > ,
@@ -1487,46 +1469,19 @@ impl Step for MirOpt {
1487
1469
} )
1488
1470
} ;
1489
1471
1490
- // We use custom logic to bless the mir-opt suite: mir-opt tests have multiple variants
1491
- // (32bit vs 64bit, and panic=abort vs panic=unwind), and all of them needs to be blessed.
1492
- // When blessing, we try best-effort to also bless the other variants, to aid developers.
1493
1472
if builder. config . cmd . bless ( ) {
1494
- let targets = MIR_OPT_BLESS_TARGET_MAPPING
1495
- . iter ( )
1496
- . filter ( |( target_32bit, target_64bit) | {
1497
- * target_32bit == & * self . target . triple || * target_64bit == & * self . target . triple
1498
- } )
1499
- . next ( )
1500
- . map ( |( target_32bit, target_64bit) | {
1501
- let target_32bit = TargetSelection :: from_user ( target_32bit) ;
1502
- let target_64bit = TargetSelection :: from_user ( target_64bit) ;
1503
-
1504
- // Running compiletest requires a C compiler to be available, but it might not
1505
- // have been detected by bootstrap if the target we're testing wasn't in the
1506
- // --target flags.
1507
- if !builder. cc . borrow ( ) . contains_key ( & target_32bit) {
1508
- utils:: cc_detect:: find_target ( builder, target_32bit) ;
1509
- }
1510
- if !builder. cc . borrow ( ) . contains_key ( & target_64bit) {
1511
- utils:: cc_detect:: find_target ( builder, target_64bit) ;
1512
- }
1513
-
1514
- vec ! [ target_32bit, target_64bit]
1515
- } )
1516
- . unwrap_or_else ( || {
1517
- eprintln ! (
1518
- "\
1519
- Note that not all variants of mir-opt tests are going to be blessed, as no mapping between
1520
- a 32bit and a 64bit target was found for {target}.
1521
- You can add that mapping by changing MIR_OPT_BLESS_TARGET_MAPPING in src/bootstrap/test.rs" ,
1522
- target = self . target,
1523
- ) ;
1524
- vec ! [ self . target]
1525
- } ) ;
1526
-
1527
- for target in targets {
1528
- run ( target) ;
1473
+ crate :: utils:: cc_detect:: find_target ( builder, self . compiler . host ) ;
1474
+ // All that we really need to do is cover all combinations of 32/64-bit and unwind/abort,
1475
+ // but while we're at it we might as well flex our cross-compilation support. This
1476
+ // selection covers all our tier 1 operating systems and architectures using only tier
1477
+ // 1 targets.
1478
+
1479
+ for target in [ "aarch64-unknown-linux-gnu" , "i686-pc-windows-msvc" ] {
1480
+ run ( TargetSelection :: from_user ( target) ) ;
1481
+ }
1529
1482
1483
+ for target in [ "x86_64-apple-darwin" , "i686-unknown-linux-musl" ] {
1484
+ let target = TargetSelection :: from_user ( target) ;
1530
1485
let panic_abort_target = builder. ensure ( MirOptPanicAbortSyntheticTarget {
1531
1486
compiler : self . compiler ,
1532
1487
base : target,
@@ -1616,27 +1571,27 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1616
1571
. ensure ( dist:: DebuggerScripts { sysroot : builder. sysroot ( compiler) , host : target } ) ;
1617
1572
}
1618
1573
1619
- if suite == "mir-opt" {
1620
- builder. ensure ( compile:: Std :: new_for_mir_opt_tests ( compiler, target) ) ;
1621
- } else {
1622
- builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
1623
- }
1574
+ // Also provide `rust_test_helpers` for the host.
1575
+ builder. ensure ( TestHelpers { target : compiler. host } ) ;
1624
1576
1625
1577
// ensure that `libproc_macro` is available on the host.
1626
1578
builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
1627
1579
1628
- // Also provide `rust_test_helpers` for the host.
1629
- builder. ensure ( TestHelpers { target : compiler. host } ) ;
1630
-
1631
1580
// As well as the target, except for plain wasm32, which can't build it
1632
1581
if suite != "mir-opt" && !target. contains ( "wasm" ) && !target. contains ( "emscripten" ) {
1633
1582
builder. ensure ( TestHelpers { target } ) ;
1634
1583
}
1635
1584
1636
- builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
1637
-
1638
1585
let mut cmd = builder. tool_cmd ( Tool :: Compiletest ) ;
1639
1586
1587
+ if suite == "mir-opt" {
1588
+ builder. ensure ( compile:: Std :: new_for_mir_opt_tests ( compiler, target) ) ;
1589
+ } else {
1590
+ builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
1591
+ }
1592
+
1593
+ builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
1594
+
1640
1595
// compiletest currently has... a lot of arguments, so let's just pass all
1641
1596
// of them!
1642
1597
@@ -1745,11 +1700,13 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1745
1700
flags. push ( format ! ( "-Cdebuginfo={}" , builder. config. rust_debuginfo_level_tests) ) ;
1746
1701
flags. extend ( builder. config . cmd . rustc_args ( ) . iter ( ) . map ( |s| s. to_string ( ) ) ) ;
1747
1702
1748
- if let Some ( linker) = builder. linker ( target) {
1749
- cmd. arg ( "--target-linker" ) . arg ( linker) ;
1750
- }
1751
- if let Some ( linker) = builder. linker ( compiler. host ) {
1752
- cmd. arg ( "--host-linker" ) . arg ( linker) ;
1703
+ if suite != "mir-opt" {
1704
+ if let Some ( linker) = builder. linker ( target) {
1705
+ cmd. arg ( "--target-linker" ) . arg ( linker) ;
1706
+ }
1707
+ if let Some ( linker) = builder. linker ( compiler. host ) {
1708
+ cmd. arg ( "--host-linker" ) . arg ( linker) ;
1709
+ }
1753
1710
}
1754
1711
1755
1712
let mut hostflags = flags. clone ( ) ;
@@ -1936,15 +1893,17 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1936
1893
cmd. arg ( "--remote-test-client" ) . arg ( builder. tool_exe ( Tool :: RemoteTestClient ) ) ;
1937
1894
}
1938
1895
1939
- // Running a C compiler on MSVC requires a few env vars to be set, to be
1940
- // sure to set them here.
1941
- //
1942
- // Note that if we encounter `PATH` we make sure to append to our own `PATH`
1943
- // rather than stomp over it.
1944
- if !builder. config . dry_run ( ) && target. is_msvc ( ) {
1945
- for & ( ref k, ref v) in builder. cc . borrow ( ) [ & target] . env ( ) {
1946
- if k != "PATH" {
1947
- cmd. env ( k, v) ;
1896
+ if suite != "mir-opt" {
1897
+ // Running a C compiler on MSVC requires a few env vars to be set, to be
1898
+ // sure to set them here.
1899
+ //
1900
+ // Note that if we encounter `PATH` we make sure to append to our own `PATH`
1901
+ // rather than stomp over it.
1902
+ if !builder. config . dry_run ( ) && target. is_msvc ( ) {
1903
+ for & ( ref k, ref v) in builder. cc . borrow ( ) [ & target] . env ( ) {
1904
+ if k != "PATH" {
1905
+ cmd. env ( k, v) ;
1906
+ }
1948
1907
}
1949
1908
}
1950
1909
}
0 commit comments