compiletest: add {ignore,only}-rustc_abi-x86-sse2
directives
This commit is contained in:
parent
8c07d140e0
commit
880d8c0000
4 changed files with 36 additions and 1 deletions
|
@ -517,6 +517,7 @@ pub struct TargetCfgs {
|
||||||
pub all_abis: HashSet<String>,
|
pub all_abis: HashSet<String>,
|
||||||
pub all_families: HashSet<String>,
|
pub all_families: HashSet<String>,
|
||||||
pub all_pointer_widths: HashSet<String>,
|
pub all_pointer_widths: HashSet<String>,
|
||||||
|
pub all_rustc_abis: HashSet<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TargetCfgs {
|
impl TargetCfgs {
|
||||||
|
@ -536,6 +537,9 @@ impl TargetCfgs {
|
||||||
let mut all_abis = HashSet::new();
|
let mut all_abis = HashSet::new();
|
||||||
let mut all_families = HashSet::new();
|
let mut all_families = HashSet::new();
|
||||||
let mut all_pointer_widths = HashSet::new();
|
let mut all_pointer_widths = HashSet::new();
|
||||||
|
// NOTE: for distinction between `abi` and `rustc_abi`, see comment on
|
||||||
|
// `TargetCfg::rustc_abi`.
|
||||||
|
let mut all_rustc_abis = HashSet::new();
|
||||||
|
|
||||||
// If current target is not included in the `--print=all-target-specs-json` output,
|
// If current target is not included in the `--print=all-target-specs-json` output,
|
||||||
// we check whether it is a custom target from the user or a synthetic target from bootstrap.
|
// we check whether it is a custom target from the user or a synthetic target from bootstrap.
|
||||||
|
@ -576,7 +580,9 @@ impl TargetCfgs {
|
||||||
all_families.insert(family.clone());
|
all_families.insert(family.clone());
|
||||||
}
|
}
|
||||||
all_pointer_widths.insert(format!("{}bit", cfg.pointer_width));
|
all_pointer_widths.insert(format!("{}bit", cfg.pointer_width));
|
||||||
|
if let Some(rustc_abi) = &cfg.rustc_abi {
|
||||||
|
all_rustc_abis.insert(rustc_abi.clone());
|
||||||
|
}
|
||||||
all_targets.insert(target.clone());
|
all_targets.insert(target.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,6 +596,7 @@ impl TargetCfgs {
|
||||||
all_abis,
|
all_abis,
|
||||||
all_families,
|
all_families,
|
||||||
all_pointer_widths,
|
all_pointer_widths,
|
||||||
|
all_rustc_abis,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,6 +683,10 @@ pub struct TargetCfg {
|
||||||
pub(crate) xray: bool,
|
pub(crate) xray: bool,
|
||||||
#[serde(default = "default_reloc_model")]
|
#[serde(default = "default_reloc_model")]
|
||||||
pub(crate) relocation_model: String,
|
pub(crate) relocation_model: String,
|
||||||
|
// NOTE: `rustc_abi` should not be confused with `abi`. `rustc_abi` was introduced in #137037 to
|
||||||
|
// make SSE2 *required* by the ABI (kind of a hack to make a target feature *required* via the
|
||||||
|
// target spec).
|
||||||
|
pub(crate) rustc_abi: Option<String>,
|
||||||
|
|
||||||
// Not present in target cfg json output, additional derived information.
|
// Not present in target cfg json output, additional derived information.
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
|
|
|
@ -87,6 +87,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
||||||
"ignore-remote",
|
"ignore-remote",
|
||||||
"ignore-riscv64",
|
"ignore-riscv64",
|
||||||
"ignore-rustc-debug-assertions",
|
"ignore-rustc-debug-assertions",
|
||||||
|
"ignore-rustc_abi-x86-sse2",
|
||||||
"ignore-s390x",
|
"ignore-s390x",
|
||||||
"ignore-sgx",
|
"ignore-sgx",
|
||||||
"ignore-sparc64",
|
"ignore-sparc64",
|
||||||
|
@ -198,6 +199,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
||||||
"only-nvptx64",
|
"only-nvptx64",
|
||||||
"only-powerpc",
|
"only-powerpc",
|
||||||
"only-riscv64",
|
"only-riscv64",
|
||||||
|
"only-rustc_abi-x86-sse2",
|
||||||
"only-s390x",
|
"only-s390x",
|
||||||
"only-sparc",
|
"only-sparc",
|
||||||
"only-sparc64",
|
"only-sparc64",
|
||||||
|
|
|
@ -234,6 +234,14 @@ fn parse_cfg_name_directive<'a>(
|
||||||
allowed_names: ["coverage-map", "coverage-run"],
|
allowed_names: ["coverage-map", "coverage-run"],
|
||||||
message: "when the test mode is {name}",
|
message: "when the test mode is {name}",
|
||||||
}
|
}
|
||||||
|
condition! {
|
||||||
|
name: target_cfg.rustc_abi.as_ref().map(|abi| format!("rustc_abi-{abi}")).unwrap_or_default(),
|
||||||
|
allowed_names: ContainsPrefixed {
|
||||||
|
prefix: "rustc_abi-",
|
||||||
|
inner: target_cfgs.all_rustc_abis.clone(),
|
||||||
|
},
|
||||||
|
message: "when the target `rustc_abi` is {name}",
|
||||||
|
}
|
||||||
|
|
||||||
condition! {
|
condition! {
|
||||||
name: "dist",
|
name: "dist",
|
||||||
|
|
|
@ -889,3 +889,17 @@ fn test_needs_target_has_atomic() {
|
||||||
assert!(!check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr"));
|
assert!(!check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr"));
|
||||||
assert!(check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr, 128"));
|
assert!(check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr, 128"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
// FIXME: this test will fail against stage 0 until #137037 changes reach beta.
|
||||||
|
#[cfg_attr(bootstrap, ignore)]
|
||||||
|
fn test_rustc_abi() {
|
||||||
|
let config = cfg().target("i686-unknown-linux-gnu").build();
|
||||||
|
assert_eq!(config.target_cfg().rustc_abi, Some("x86-sse2".to_string()));
|
||||||
|
assert!(check_ignore(&config, "//@ ignore-rustc_abi-x86-sse2"));
|
||||||
|
assert!(!check_ignore(&config, "//@ only-rustc_abi-x86-sse2"));
|
||||||
|
let config = cfg().target("x86_64-unknown-linux-gnu").build();
|
||||||
|
assert_eq!(config.target_cfg().rustc_abi, None);
|
||||||
|
assert!(!check_ignore(&config, "//@ ignore-rustc_abi-x86-sse2"));
|
||||||
|
assert!(check_ignore(&config, "//@ only-rustc_abi-x86-sse2"));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue