@@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
9
9
use std::{env, fs, iter};
10
10
11
11
use clap_complete::shells;
12
+ use build_helper::compiletest::Mode as CtMode;
12
13
13
14
use crate::core::build_steps::compile::run_cargo;
14
15
use crate::core::build_steps::doc::DocumentationFormat;
@@ -915,7 +916,7 @@ impl Step for RustdocJSNotStd {
915
916
builder.ensure(Compiletest {
916
917
compiler: self.compiler,
917
918
target: self.target,
918
- mode: "rustdoc-js" ,
919
+ mode: CtMode::RustdocJs ,
919
920
suite: "rustdoc-js",
920
921
path: "tests/rustdoc-js",
921
922
compare_mode: None,
@@ -1347,68 +1348,68 @@ impl Step for CrateBuildHelper {
1347
1348
}
1348
1349
}
1349
1350
1350
- test!(Ui { path: "tests/ui", mode: "ui" , suite: "ui", default: true });
1351
+ test!(Ui { path: "tests/ui", mode: CtMode::Ui , suite: "ui", default: true });
1351
1352
1352
- test!(Crashes { path: "tests/crashes", mode: "crashes" , suite: "crashes", default: true });
1353
+ test!(Crashes { path: "tests/crashes", mode: CtMode::Crashes , suite: "crashes", default: true });
1353
1354
1354
- test!(Codegen { path: "tests/codegen", mode: "codegen" , suite: "codegen", default: true });
1355
+ test!(Codegen { path: "tests/codegen", mode: CtMode::Codegen , suite: "codegen", default: true });
1355
1356
1356
1357
test!(CodegenUnits {
1357
1358
path: "tests/codegen-units",
1358
- mode: "codegen-units" ,
1359
+ mode: CtMode::CodegenUnits ,
1359
1360
suite: "codegen-units",
1360
1361
default: true,
1361
1362
});
1362
1363
1363
1364
test!(Incremental {
1364
1365
path: "tests/incremental",
1365
- mode: "incremental" ,
1366
+ mode: CtMode::Incremental ,
1366
1367
suite: "incremental",
1367
1368
default: true,
1368
1369
});
1369
1370
1370
1371
test!(Debuginfo {
1371
1372
path: "tests/debuginfo",
1372
- mode: "debuginfo" ,
1373
+ mode: CtMode::DebugInfo ,
1373
1374
suite: "debuginfo",
1374
1375
default: true,
1375
1376
compare_mode: Some("split-dwarf"),
1376
1377
});
1377
1378
1378
1379
test!(UiFullDeps {
1379
1380
path: "tests/ui-fulldeps",
1380
- mode: "ui" ,
1381
+ mode: CtMode::Ui ,
1381
1382
suite: "ui-fulldeps",
1382
1383
default: true,
1383
1384
only_hosts: true,
1384
1385
});
1385
1386
1386
1387
test!(Rustdoc {
1387
1388
path: "tests/rustdoc",
1388
- mode: "rustdoc" ,
1389
+ mode: CtMode::Rustdoc ,
1389
1390
suite: "rustdoc",
1390
1391
default: true,
1391
1392
only_hosts: true,
1392
1393
});
1393
1394
test!(RustdocUi {
1394
1395
path: "tests/rustdoc-ui",
1395
- mode: "ui" ,
1396
+ mode: CtMode::Ui ,
1396
1397
suite: "rustdoc-ui",
1397
1398
default: true,
1398
1399
only_hosts: true,
1399
1400
});
1400
1401
1401
1402
test!(RustdocJson {
1402
1403
path: "tests/rustdoc-json",
1403
- mode: "rustdoc-json" ,
1404
+ mode: CtMode::RustdocJson ,
1404
1405
suite: "rustdoc-json",
1405
1406
default: true,
1406
1407
only_hosts: true,
1407
1408
});
1408
1409
1409
1410
test!(Pretty {
1410
1411
path: "tests/pretty",
1411
- mode: "pretty" ,
1412
+ mode: CtMode::Pretty ,
1412
1413
suite: "pretty",
1413
1414
default: true,
1414
1415
only_hosts: true,
@@ -1441,15 +1442,15 @@ impl Step for RunMake {
1441
1442
builder.ensure(Compiletest {
1442
1443
compiler: self.compiler,
1443
1444
target: self.target,
1444
- mode: "run-make" ,
1445
+ mode: CtMode::RunMake ,
1445
1446
suite: "run-make",
1446
1447
path: "tests/run-make",
1447
1448
compare_mode: None,
1448
1449
});
1449
1450
}
1450
1451
}
1451
1452
1452
- test!(Assembly { path: "tests/assembly", mode: "assembly" , suite: "assembly", default: true });
1453
+ test!(Assembly { path: "tests/assembly", mode: CtMode::Assembly , suite: "assembly", default: true });
1453
1454
1454
1455
/// Runs the coverage test suite at `tests/coverage` in some or all of the
1455
1456
/// coverage test modes.
@@ -1536,7 +1537,7 @@ impl Step for Coverage {
1536
1537
builder.ensure(Compiletest {
1537
1538
compiler,
1538
1539
target,
1539
- mode,
1540
+ mode: mode.parse().unwrap() ,
1540
1541
suite: Self::SUITE,
1541
1542
path: Self::PATH,
1542
1543
compare_mode: None,
@@ -1546,7 +1547,7 @@ impl Step for Coverage {
1546
1547
1547
1548
test!(CoverageRunRustdoc {
1548
1549
path: "tests/coverage-run-rustdoc",
1549
- mode: "coverage-run" ,
1550
+ mode: CtMode::CoverageRun ,
1550
1551
suite: "coverage-run-rustdoc",
1551
1552
default: true,
1552
1553
only_hosts: true,
@@ -1578,7 +1579,7 @@ impl Step for MirOpt {
1578
1579
builder.ensure(Compiletest {
1579
1580
compiler: self.compiler,
1580
1581
target,
1581
- mode: "mir-opt" ,
1582
+ mode: CtMode::MirOpt ,
1582
1583
suite: "mir-opt",
1583
1584
path: "tests/mir-opt",
1584
1585
compare_mode: None,
@@ -1615,7 +1616,7 @@ impl Step for MirOpt {
1615
1616
struct Compiletest {
1616
1617
compiler: Compiler,
1617
1618
target: TargetSelection,
1618
- mode: &'static str ,
1619
+ mode: CtMode ,
1619
1620
suite: &'static str,
1620
1621
path: &'static str,
1621
1622
compare_mode: Option<&'static str>,
@@ -1729,7 +1730,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1729
1730
1730
1731
let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js";
1731
1732
1732
- if mode == "run-make" {
1733
+ if mode == CtMode::RunMake {
1733
1734
let cargo_path = if builder.top_stage == 0 {
1734
1735
// If we're using `--stage 0`, we should provide the bootstrap cargo.
1735
1736
builder.initial_cargo.clone()
@@ -1752,17 +1753,17 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1752
1753
}
1753
1754
1754
1755
// Avoid depending on rustdoc when we don't need it.
1755
- if mode == "rustdoc"
1756
- || mode == "run-make"
1757
- || (mode == "ui" && is_rustdoc)
1758
- || mode == "rustdoc-js"
1759
- || mode == "rustdoc-json"
1756
+ if mode == CtMode::Rustdoc
1757
+ || mode == CtMode::RunMake
1758
+ || (mode == CtMode::Ui && is_rustdoc)
1759
+ || mode == CtMode::RustdocJs
1760
+ || mode == CtMode::RustdocJson
1760
1761
|| suite == "coverage-run-rustdoc"
1761
1762
{
1762
1763
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
1763
1764
}
1764
1765
1765
- if mode == "rustdoc-json" {
1766
+ if mode == CtMode::RustdocJson {
1766
1767
// Use the beta compiler for jsondocck
1767
1768
let json_compiler = compiler.with_stage(0);
1768
1769
cmd.arg("--jsondocck-path")
@@ -1771,7 +1772,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1771
1772
.arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target }));
1772
1773
}
1773
1774
1774
- if matches!(mode, "coverage-map" | "coverage-run" ) {
1775
+ if matches!(mode, CtMode::CoverageMap | CtMode::CoverageRun ) {
1775
1776
let coverage_dump = builder.tool_exe(Tool::CoverageDump);
1776
1777
cmd.arg("--coverage-dump-path").arg(coverage_dump);
1777
1778
}
@@ -1789,7 +1790,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1789
1790
cmd.arg("--sysroot-base").arg(sysroot);
1790
1791
cmd.arg("--stage-id").arg(stage_id);
1791
1792
cmd.arg("--suite").arg(suite);
1792
- cmd.arg("--mode").arg(mode);
1793
+ cmd.arg("--mode").arg(mode.to_str() );
1793
1794
cmd.arg("--target").arg(target.rustc_target_arg());
1794
1795
cmd.arg("--host").arg(&*compiler.host.triple);
1795
1796
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
@@ -1827,7 +1828,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1827
1828
1828
1829
if let Some(ref nodejs) = builder.config.nodejs {
1829
1830
cmd.arg("--nodejs").arg(nodejs);
1830
- } else if mode == "rustdoc-js" {
1831
+ } else if mode == CtMode::RustdocJs {
1831
1832
panic!("need nodejs to run rustdoc-js suite");
1832
1833
}
1833
1834
if let Some(ref npm) = builder.config.npm {
@@ -1985,7 +1986,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1985
1986
cmd.env("RUSTFLAGS", rustflags);
1986
1987
}
1987
1988
1988
- if !builder.config.dry_run() && matches!(mode, "run-make" | "coverage-run" ) {
1989
+ if !builder.config.dry_run() && matches!(mode, CtMode::RunMake | CtMode::CoverageRun ) {
1989
1990
// The llvm/bin directory contains many useful cross-platform
1990
1991
// tools. Pass the path to run-make tests so they can use them.
1991
1992
// (The coverage-run tests also need these tools to process
@@ -1997,7 +1998,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
1997
1998
cmd.arg("--llvm-bin-dir").arg(llvm_bin_path);
1998
1999
}
1999
2000
2000
- if !builder.config.dry_run() && mode == "run-make" {
2001
+ if !builder.config.dry_run() && mode == CtMode::RunMake {
2001
2002
// If LLD is available, add it to the PATH
2002
2003
if builder.config.lld_enabled {
2003
2004
let lld_install_root =
@@ -2017,7 +2018,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
2017
2018
2018
2019
// Only pass correct values for these flags for the `run-make` suite as it
2019
2020
// requires that a C++ compiler was configured which isn't always the case.
2020
- if !builder.config.dry_run() && mode == "run-make" {
2021
+ if !builder.config.dry_run() && mode == CtMode::RunMake {
2021
2022
cmd.arg("--cc")
2022
2023
.arg(builder.cc(target))
2023
2024
.arg("--cxx")
0 commit comments