@@ -1133,69 +1133,19 @@ fn testdir(builder: &Builder<'_>, host: TargetSelection) -> PathBuf {
1133
1133
builder. out . join ( host) . join ( "test" )
1134
1134
}
1135
1135
1136
- macro_rules! default_test {
1137
- ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr } ) => {
1138
- test!( $name { path: $path, mode: $mode, suite: $suite, default : true , host: false } ) ;
1139
- } ;
1140
- }
1141
-
1142
- macro_rules! default_test_with_compare_mode {
1143
- ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr,
1144
- compare_mode: $compare_mode: expr } ) => {
1145
- test_with_compare_mode!( $name {
1146
- path: $path,
1147
- mode: $mode,
1148
- suite: $suite,
1149
- default : true ,
1150
- host: false ,
1151
- compare_mode: $compare_mode
1152
- } ) ;
1153
- } ;
1154
- }
1155
-
1156
- macro_rules! host_test {
1157
- ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr } ) => {
1158
- test!( $name { path: $path, mode: $mode, suite: $suite, default : true , host: true } ) ;
1159
- } ;
1160
- }
1161
-
1136
+ /// Declares a test step that invokes compiletest on a particular test suite.
1162
1137
macro_rules! test {
1163
- ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr, default : $default: expr,
1164
- host: $host: expr } ) => {
1165
- test_definitions!( $name {
1166
- path: $path,
1167
- mode: $mode,
1168
- suite: $suite,
1169
- default : $default,
1170
- host: $host,
1171
- compare_mode: None
1172
- } ) ;
1173
- } ;
1174
- }
1175
-
1176
- macro_rules! test_with_compare_mode {
1177
- ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr, default : $default: expr,
1178
- host: $host: expr, compare_mode: $compare_mode: expr } ) => {
1179
- test_definitions!( $name {
1180
- path: $path,
1181
- mode: $mode,
1182
- suite: $suite,
1183
- default : $default,
1184
- host: $host,
1185
- compare_mode: Some ( $compare_mode)
1186
- } ) ;
1187
- } ;
1188
- }
1189
-
1190
- macro_rules! test_definitions {
1191
- ( $name: ident {
1192
- path: $path: expr,
1193
- mode: $mode: expr,
1194
- suite: $suite: expr,
1195
- default : $default: expr,
1196
- host: $host: expr,
1197
- compare_mode: $compare_mode: expr
1198
- } ) => {
1138
+ (
1139
+ $name: ident {
1140
+ path: $path: expr,
1141
+ mode: $mode: expr,
1142
+ suite: $suite: expr,
1143
+ default : $default: expr
1144
+ $( , only_hosts: $only_hosts: expr ) ? // default: false
1145
+ $( , compare_mode: $compare_mode: expr ) ? // default: None
1146
+ $( , ) ? // optional trailing comma
1147
+ }
1148
+ ) => {
1199
1149
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1200
1150
pub struct $name {
1201
1151
pub compiler: Compiler ,
@@ -1205,7 +1155,12 @@ macro_rules! test_definitions {
1205
1155
impl Step for $name {
1206
1156
type Output = ( ) ;
1207
1157
const DEFAULT : bool = $default;
1208
- const ONLY_HOSTS : bool = $host;
1158
+ const ONLY_HOSTS : bool = ( const {
1159
+ #[ allow( unused_assignments, unused_mut) ]
1160
+ let mut value = false ;
1161
+ $( value = $only_hosts; ) ?
1162
+ value
1163
+ } ) ;
1209
1164
1210
1165
fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
1211
1166
run. suite_path( $path)
@@ -1224,15 +1179,20 @@ macro_rules! test_definitions {
1224
1179
mode: $mode,
1225
1180
suite: $suite,
1226
1181
path: $path,
1227
- compare_mode: $compare_mode,
1182
+ compare_mode: ( const {
1183
+ #[ allow( unused_assignments, unused_mut) ]
1184
+ let mut value = None ;
1185
+ $( value = $compare_mode; ) ?
1186
+ value
1187
+ } ) ,
1228
1188
} )
1229
1189
}
1230
1190
}
1231
1191
} ;
1232
1192
}
1233
1193
1234
1194
/// Declares an alias for running the [`Coverage`] tests in only one mode.
1235
- /// Adapted from [`test_definitions `].
1195
+ /// Adapted from [`test `].
1236
1196
macro_rules! coverage_test_alias {
1237
1197
( $name: ident {
1238
1198
alias_and_mode: $alias_and_mode: expr, // &'static str
@@ -1410,37 +1370,74 @@ impl Step for CrateBuildHelper {
1410
1370
}
1411
1371
}
1412
1372
1413
- default_test ! ( Ui { path: "tests/ui" , mode: "ui" , suite: "ui" } ) ;
1373
+ test ! ( Ui { path: "tests/ui" , mode: "ui" , suite: "ui" , default : true } ) ;
1414
1374
1415
- default_test ! ( Crashes { path: "tests/crashes" , mode: "crashes" , suite: "crashes" } ) ;
1375
+ test ! ( Crashes { path: "tests/crashes" , mode: "crashes" , suite: "crashes" , default : true } ) ;
1416
1376
1417
- default_test ! ( Codegen { path: "tests/codegen" , mode: "codegen" , suite: "codegen" } ) ;
1377
+ test ! ( Codegen { path: "tests/codegen" , mode: "codegen" , suite: "codegen" , default : true } ) ;
1418
1378
1419
- default_test ! ( CodegenUnits {
1379
+ test ! ( CodegenUnits {
1420
1380
path: "tests/codegen-units" ,
1421
1381
mode: "codegen-units" ,
1422
- suite: "codegen-units"
1382
+ suite: "codegen-units" ,
1383
+ default : true ,
1423
1384
} ) ;
1424
1385
1425
- default_test ! ( Incremental { path: "tests/incremental" , mode: "incremental" , suite: "incremental" } ) ;
1386
+ test ! ( Incremental {
1387
+ path: "tests/incremental" ,
1388
+ mode: "incremental" ,
1389
+ suite: "incremental" ,
1390
+ default : true ,
1391
+ } ) ;
1426
1392
1427
- default_test_with_compare_mode ! ( Debuginfo {
1393
+ test ! ( Debuginfo {
1428
1394
path: "tests/debuginfo" ,
1429
1395
mode: "debuginfo" ,
1430
1396
suite: "debuginfo" ,
1431
- compare_mode: "split-dwarf"
1397
+ default : true ,
1398
+ compare_mode: Some ( "split-dwarf" ) ,
1432
1399
} ) ;
1433
1400
1434
- host_test ! ( UiFullDeps { path: "tests/ui-fulldeps" , mode: "ui" , suite: "ui-fulldeps" } ) ;
1401
+ test ! ( UiFullDeps {
1402
+ path: "tests/ui-fulldeps" ,
1403
+ mode: "ui" ,
1404
+ suite: "ui-fulldeps" ,
1405
+ default : true ,
1406
+ only_hosts: true ,
1407
+ } ) ;
1435
1408
1436
- host_test ! ( Rustdoc { path: "tests/rustdoc" , mode: "rustdoc" , suite: "rustdoc" } ) ;
1437
- host_test ! ( RustdocUi { path: "tests/rustdoc-ui" , mode: "ui" , suite: "rustdoc-ui" } ) ;
1409
+ test ! ( Rustdoc {
1410
+ path: "tests/rustdoc" ,
1411
+ mode: "rustdoc" ,
1412
+ suite: "rustdoc" ,
1413
+ default : true ,
1414
+ only_hosts: true ,
1415
+ } ) ;
1416
+ test ! ( RustdocUi {
1417
+ path: "tests/rustdoc-ui" ,
1418
+ mode: "ui" ,
1419
+ suite: "rustdoc-ui" ,
1420
+ default : true ,
1421
+ only_hosts: true ,
1422
+ } ) ;
1438
1423
1439
- host_test ! ( RustdocJson { path: "tests/rustdoc-json" , mode: "rustdoc-json" , suite: "rustdoc-json" } ) ;
1424
+ test ! ( RustdocJson {
1425
+ path: "tests/rustdoc-json" ,
1426
+ mode: "rustdoc-json" ,
1427
+ suite: "rustdoc-json" ,
1428
+ default : true ,
1429
+ only_hosts: true ,
1430
+ } ) ;
1440
1431
1441
- host_test ! ( Pretty { path: "tests/pretty" , mode: "pretty" , suite: "pretty" } ) ;
1432
+ test ! ( Pretty {
1433
+ path: "tests/pretty" ,
1434
+ mode: "pretty" ,
1435
+ suite: "pretty" ,
1436
+ default : true ,
1437
+ only_hosts: true ,
1438
+ } ) ;
1442
1439
1443
- /// Special-handling is needed for `run-make`, so don't use `default_test ` for defining `RunMake`
1440
+ /// Special-handling is needed for `run-make`, so don't use `test! ` for defining `RunMake`
1444
1441
/// tests.
1445
1442
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
1446
1443
pub struct RunMake {
@@ -1475,7 +1472,7 @@ impl Step for RunMake {
1475
1472
}
1476
1473
}
1477
1474
1478
- default_test ! ( Assembly { path: "tests/assembly" , mode: "assembly" , suite: "assembly" } ) ;
1475
+ test ! ( Assembly { path: "tests/assembly" , mode: "assembly" , suite: "assembly" , default : true } ) ;
1479
1476
1480
1477
/// Coverage tests are a bit more complicated than other test suites, because
1481
1478
/// we want to run the same set of test files in multiple different modes,
@@ -1569,10 +1566,12 @@ coverage_test_alias!(CoverageRun {
1569
1566
only_hosts: true ,
1570
1567
} ) ;
1571
1568
1572
- host_test ! ( CoverageRunRustdoc {
1569
+ test ! ( CoverageRunRustdoc {
1573
1570
path: "tests/coverage-run-rustdoc" ,
1574
1571
mode: "coverage-run" ,
1575
- suite: "coverage-run-rustdoc"
1572
+ suite: "coverage-run-rustdoc" ,
1573
+ default : true ,
1574
+ only_hosts: true ,
1576
1575
} ) ;
1577
1576
1578
1577
// For the mir-opt suite we do not use macros, as we need custom behavior when blessing.
0 commit comments