Add supporting infrastructure for run-make
V2 tests · rust-lang/rust@48e9f92 (original) (raw)
`@@ -1327,6 +1327,52 @@ macro_rules! coverage_test_alias {
`
1327
1327
`};
`
1328
1328
`}
`
1329
1329
``
``
1330
`+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
`
``
1331
`+
pub struct RunMakeSupport {
`
``
1332
`+
pub compiler: Compiler,
`
``
1333
`+
pub target: TargetSelection,
`
``
1334
`+
}
`
``
1335
+
``
1336
`+
impl Step for RunMakeSupport {
`
``
1337
`+
type Output = PathBuf;
`
``
1338
`+
const DEFAULT: bool = true;
`
``
1339
+
``
1340
`+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
`
``
1341
`+
run.never()
`
``
1342
`+
}
`
``
1343
+
``
1344
`+
fn make_run(run: RunConfig<'_>) {
`
``
1345
`+
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
`
``
1346
`+
run.builder.ensure(RunMakeSupport { compiler, target: run.build_triple() });
`
``
1347
`+
}
`
``
1348
+
``
1349
`+
fn run(self, builder: &Builder<'_>) -> PathBuf {
`
``
1350
`+
builder.ensure(compile::Std::new(self.compiler, self.target));
`
``
1351
+
``
1352
`+
let cargo = tool::prepare_tool_cargo(
`
``
1353
`+
builder,
`
``
1354
`+
self.compiler,
`
``
1355
`+
Mode::ToolStd,
`
``
1356
`+
self.target,
`
``
1357
`+
"build",
`
``
1358
`+
"src/tools/run-make-support",
`
``
1359
`+
SourceType::InTree,
`
``
1360
`+
&[],
`
``
1361
`+
);
`
``
1362
+
``
1363
`+
let mut cargo = Command::from(cargo);
`
``
1364
`+
builder.run(&mut cargo);
`
``
1365
+
``
1366
`+
let lib_name = "librun_make_support.rlib";
`
``
1367
`+
let lib = builder.tools_dir(self.compiler).join(&lib_name);
`
``
1368
+
``
1369
`+
let cargo_out =
`
``
1370
`+
builder.cargo_out(self.compiler, Mode::ToolStd, self.target).join(&lib_name);
`
``
1371
`+
builder.copy(&cargo_out, &lib);
`
``
1372
`+
lib
`
``
1373
`+
}
`
``
1374
`+
}
`
``
1375
+
1330
1376
`default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
`
1331
1377
``
1332
1378
`default_test!(RunPassValgrind {
`
`@@ -1361,7 +1407,40 @@ host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite
`
1361
1407
``
1362
1408
`host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });
`
1363
1409
``
1364
``
`-
default_test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make" });
`
``
1410
`` +
// Special-handling is needed for run-make
, so don't use default_test
for defining RunMake
``
``
1411
`+
// tests.
`
``
1412
`+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
`
``
1413
`+
pub struct RunMake {
`
``
1414
`+
pub compiler: Compiler,
`
``
1415
`+
pub target: TargetSelection,
`
``
1416
`+
}
`
``
1417
+
``
1418
`+
impl Step for RunMake {
`
``
1419
`+
type Output = ();
`
``
1420
`+
const DEFAULT: bool = true;
`
``
1421
`+
const ONLY_HOSTS: bool = false;
`
``
1422
+
``
1423
`+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
`
``
1424
`+
run.suite_path("tests/run-make")
`
``
1425
`+
}
`
``
1426
+
``
1427
`+
fn make_run(run: RunConfig<'_>) {
`
``
1428
`+
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
`
``
1429
`+
run.builder.ensure(RunMakeSupport { compiler, target: run.build_triple() });
`
``
1430
`+
run.builder.ensure(RunMake { compiler, target: run.target });
`
``
1431
`+
}
`
``
1432
+
``
1433
`+
fn run(self, builder: &Builder<'_>) {
`
``
1434
`+
builder.ensure(Compiletest {
`
``
1435
`+
compiler: self.compiler,
`
``
1436
`+
target: self.target,
`
``
1437
`+
mode: "run-make",
`
``
1438
`+
suite: "run-make",
`
``
1439
`+
path: "tests/run-make",
`
``
1440
`+
compare_mode: None,
`
``
1441
`+
});
`
``
1442
`+
}
`
``
1443
`+
}
`
1365
1444
``
1366
1445
`host_test!(RunMakeFullDeps {
`
1367
1446
` path: "tests/run-make-fulldeps",
`