Skip to content

Commit

Permalink
fix loading target specs in compiletest not working with custom targets
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Jun 30, 2023
1 parent af9df2f commit 00cc815
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ pub struct TargetCfgs {

impl TargetCfgs {
fn new(config: &Config) -> TargetCfgs {
let targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
let mut targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
config,
&["--print=all-target-specs-json", "-Zunstable-options"],
))
Expand All @@ -454,6 +454,18 @@ impl TargetCfgs {
let mut all_families = HashSet::new();
let mut all_pointer_widths = HashSet::new();

// Handle custom target specs, which are not included in `--print=all-target-specs-json`.
if config.target.ends_with(".json") {
targets.insert(
config.target.clone(),
serde_json::from_str(&rustc_output(
config,
&["--print=target-spec-json", "-Zunstable-options", "--target", &config.target],
))
.unwrap(),
);
}

for (target, cfg) in targets.iter() {
all_archs.insert(cfg.arch.clone());
all_oses.insert(cfg.os.clone());
Expand Down

0 comments on commit 00cc815

Please sign in to comment.