compiletest: use --stage number directly instead of deriving from --stage-id
Notably, this avoids having to do hacky string splitting based on `--stage-id`.
This commit is contained in:
parent
7d29a2e692
commit
8a0dc27d57
5 changed files with 28 additions and 30 deletions
|
|
@ -224,7 +224,9 @@ pub struct Config {
|
|||
/// The directory containing the compiler sysroot
|
||||
pub sysroot_base: PathBuf,
|
||||
|
||||
/// The name of the stage being built (stage1, etc)
|
||||
/// The number of the stage under test.
|
||||
pub stage: u32,
|
||||
/// The id of the stage under test (stage1-xxx, etc).
|
||||
pub stage_id: String,
|
||||
|
||||
/// The test mode, e.g. ui or debuginfo.
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ fn parse_cfg_name_directive<'a>(
|
|||
message: "on big-endian targets",
|
||||
}
|
||||
condition! {
|
||||
name: config.stage_id.split('-').next().unwrap(),
|
||||
name: format!("stage{}", config.stage).as_str(),
|
||||
allowed_names: &["stage0", "stage1", "stage2"],
|
||||
message: "when the bootstrapping stage is {name}",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ struct ConfigBuilder {
|
|||
channel: Option<String>,
|
||||
host: Option<String>,
|
||||
target: Option<String>,
|
||||
stage: Option<u32>,
|
||||
stage_id: Option<String>,
|
||||
llvm_version: Option<String>,
|
||||
git_hash: bool,
|
||||
|
|
@ -102,6 +103,11 @@ impl ConfigBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
fn stage(&mut self, n: u32) -> &mut Self {
|
||||
self.stage = Some(n);
|
||||
self
|
||||
}
|
||||
|
||||
fn stage_id(&mut self, s: &str) -> &mut Self {
|
||||
self.stage_id = Some(s.to_owned());
|
||||
self
|
||||
|
|
@ -156,6 +162,8 @@ impl ConfigBuilder {
|
|||
"--cxxflags=",
|
||||
"--llvm-components=",
|
||||
"--android-cross-path=",
|
||||
"--stage",
|
||||
&self.stage.unwrap_or(2).to_string(),
|
||||
"--stage-id",
|
||||
self.stage_id.as_deref().unwrap_or("stage2-x86_64-unknown-linux-gnu"),
|
||||
"--channel",
|
||||
|
|
@ -387,7 +395,7 @@ fn std_debug_assertions() {
|
|||
|
||||
#[test]
|
||||
fn stage() {
|
||||
let config: Config = cfg().stage_id("stage1-x86_64-unknown-linux-gnu").build();
|
||||
let config: Config = cfg().stage(1).stage_id("stage1-x86_64-unknown-linux-gnu").build();
|
||||
|
||||
assert!(check_ignore(&config, "//@ ignore-stage1"));
|
||||
assert!(!check_ignore(&config, "//@ ignore-stage2"));
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
.reqopt("", "src-base", "directory to scan for test files", "PATH")
|
||||
.reqopt("", "build-base", "directory to deposit test outputs", "PATH")
|
||||
.reqopt("", "sysroot-base", "directory containing the compiler sysroot", "PATH")
|
||||
.reqopt("", "stage", "stage number under test", "N")
|
||||
.reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET")
|
||||
.reqopt(
|
||||
"",
|
||||
|
|
@ -294,6 +295,11 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
panic!("`--nocapture` is deprecated; please use `--no-capture`");
|
||||
}
|
||||
|
||||
let stage = match matches.opt_str("stage") {
|
||||
Some(stage) => stage.parse::<u32>().expect("expected `--stage` to be an unsigned integer"),
|
||||
None => panic!("`--stage` is required"),
|
||||
};
|
||||
|
||||
Config {
|
||||
bless: matches.opt_present("bless"),
|
||||
compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")),
|
||||
|
|
@ -311,7 +317,10 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
src_base,
|
||||
build_base: opt_path(matches, "build-base"),
|
||||
sysroot_base: opt_path(matches, "sysroot-base"),
|
||||
|
||||
stage,
|
||||
stage_id: matches.opt_str("stage-id").unwrap(),
|
||||
|
||||
mode,
|
||||
suite: matches.opt_str("suite").unwrap(),
|
||||
debugger: matches.opt_str("debugger").map(|debugger| {
|
||||
|
|
@ -415,6 +424,7 @@ pub fn log_config(config: &Config) {
|
|||
logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path));
|
||||
logv(c, format!("src_base: {:?}", config.src_base.display()));
|
||||
logv(c, format!("build_base: {:?}", config.build_base.display()));
|
||||
logv(c, format!("stage: {}", config.stage));
|
||||
logv(c, format!("stage_id: {}", config.stage_id));
|
||||
logv(c, format!("mode: {}", config.mode));
|
||||
logv(c, format!("run_ignored: {}", config.run_ignored));
|
||||
|
|
|
|||
|
|
@ -239,30 +239,6 @@ impl TestCx<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
// `self.config.stage_id` looks like `stage1-<target_triple>`, but we only want
|
||||
// the `stage1` part as that is what the output directories of bootstrap are prefixed with.
|
||||
// Note that this *assumes* build layout from bootstrap is produced as:
|
||||
//
|
||||
// ```
|
||||
// build/<target_triple>/ // <- this is `build_root`
|
||||
// ├── stage0
|
||||
// ├── stage0-bootstrap-tools
|
||||
// ├── stage0-codegen
|
||||
// ├── stage0-rustc
|
||||
// ├── stage0-std
|
||||
// ├── stage0-sysroot
|
||||
// ├── stage0-tools
|
||||
// ├── stage0-tools-bin
|
||||
// ├── stage1
|
||||
// ├── stage1-std
|
||||
// ├── stage1-tools
|
||||
// ├── stage1-tools-bin
|
||||
// └── test
|
||||
// ```
|
||||
// FIXME(jieyouxu): improve the communication between bootstrap and compiletest here so
|
||||
// we don't have to hack out a `stageN`.
|
||||
let stage = self.config.stage_id.split('-').next().unwrap();
|
||||
|
||||
// In order to link in the support library as a rlib when compiling recipes, we need three
|
||||
// paths:
|
||||
// 1. Path of the built support library rlib itself.
|
||||
|
|
@ -284,10 +260,12 @@ impl TestCx<'_> {
|
|||
// support lib and its deps are organized, can't we copy them to the tools-bin dir as
|
||||
// well?), but this seems to work for now.
|
||||
|
||||
let stage_tools_bin = build_root.join(format!("{stage}-tools-bin"));
|
||||
let stage_number = self.config.stage;
|
||||
|
||||
let stage_tools_bin = build_root.join(format!("stage{stage_number}-tools-bin"));
|
||||
let support_lib_path = stage_tools_bin.join("librun_make_support.rlib");
|
||||
|
||||
let stage_tools = build_root.join(format!("{stage}-tools"));
|
||||
let stage_tools = build_root.join(format!("stage{stage_number}-tools"));
|
||||
let support_lib_deps = stage_tools.join(&self.config.host).join("release").join("deps");
|
||||
let support_lib_deps_deps = stage_tools.join("release").join("deps");
|
||||
|
||||
|
|
@ -368,7 +346,7 @@ impl TestCx<'_> {
|
|||
// provided through env vars.
|
||||
|
||||
// Compute stage-specific standard library paths.
|
||||
let stage_std_path = build_root.join(&stage).join("lib");
|
||||
let stage_std_path = build_root.join(format!("stage{stage_number}")).join("lib");
|
||||
|
||||
// Compute dynamic library search paths for recipes.
|
||||
let recipe_dylib_search_paths = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue