File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -1606,6 +1606,19 @@ impl<'test> TestCx<'test> {
1606
1606
rustc. args ( & [ "-Z" , "human_readable_cgu_names" ] ) ;
1607
1607
}
1608
1608
1609
+ let explicit_cgus = self . props
1610
+ . compile_flags
1611
+ . iter ( )
1612
+ . any ( |arg| arg. contains ( "codegen-units" ) ) ;
1613
+
1614
+ // For performance reasons we want to compile tests with just one CGU if
1615
+ // possible.
1616
+ let adapt_cgu_count = |cmd : & mut Command | {
1617
+ if !explicit_cgus {
1618
+ cmd. arg ( "-Ccodegen-units=1" ) ;
1619
+ }
1620
+ } ;
1621
+
1609
1622
match self . config . mode {
1610
1623
CompileFail | ParseFail | Incremental => {
1611
1624
// If we are extracting and matching errors in the new
@@ -1629,6 +1642,8 @@ impl<'test> TestCx<'test> {
1629
1642
"-Zdump-mir-exclude-pass-number" ,
1630
1643
] ) ;
1631
1644
1645
+ adapt_cgu_count ( & mut rustc) ;
1646
+
1632
1647
let mir_dump_dir = self . get_mir_dump_dir ( ) ;
1633
1648
let _ = fs:: remove_dir_all ( & mir_dump_dir) ;
1634
1649
create_dir_all ( mir_dump_dir. as_path ( ) ) . unwrap ( ) ;
@@ -1638,14 +1653,16 @@ impl<'test> TestCx<'test> {
1638
1653
1639
1654
rustc. arg ( dir_opt) ;
1640
1655
}
1641
- RunPass |
1642
- RunFail |
1643
- RunPassValgrind |
1644
- Pretty |
1645
1656
DebugInfoGdb |
1646
1657
DebugInfoLldb |
1647
1658
Codegen |
1648
1659
Rustdoc |
1660
+ RunPassValgrind |
1661
+ RunFail |
1662
+ RunPass => {
1663
+ adapt_cgu_count ( & mut rustc) ;
1664
+ }
1665
+ Pretty |
1649
1666
RunMake |
1650
1667
CodegenUnits => {
1651
1668
// do not use JSON output
You can’t perform that action at this time.
0 commit comments