bootstrap: test target specific config overrides
Debug, PartialEq, and Eq are derived for testing purposes.
This commit is contained in:
parent
9185ddb019
commit
d1f0bc7562
2 changed files with 45 additions and 4 deletions
|
@ -360,7 +360,7 @@ pub enum RustfmtState {
|
||||||
LazyEvaluated,
|
LazyEvaluated,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum LlvmLibunwind {
|
pub enum LlvmLibunwind {
|
||||||
#[default]
|
#[default]
|
||||||
No,
|
No,
|
||||||
|
@ -381,7 +381,7 @@ impl FromStr for LlvmLibunwind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum SplitDebuginfo {
|
pub enum SplitDebuginfo {
|
||||||
Packed,
|
Packed,
|
||||||
Unpacked,
|
Unpacked,
|
||||||
|
@ -542,7 +542,7 @@ impl PartialEq<&str> for TargetSelection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Per-target configuration stored in the global configuration structure.
|
/// Per-target configuration stored in the global configuration structure.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct Target {
|
pub struct Target {
|
||||||
/// Some(path to llvm-config) if using an external LLVM.
|
/// Some(path to llvm-config) if using an external LLVM.
|
||||||
pub llvm_config: Option<PathBuf>,
|
pub llvm_config: Option<PathBuf>,
|
||||||
|
@ -912,7 +912,7 @@ define_config! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum StringOrBool {
|
pub enum StringOrBool {
|
||||||
String(String),
|
String(String),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use super::{flags::Flags, ChangeIdWrapper, Config};
|
use super::{flags::Flags, ChangeIdWrapper, Config};
|
||||||
use crate::core::build_steps::clippy::get_clippy_rules_in_order;
|
use crate::core::build_steps::clippy::get_clippy_rules_in_order;
|
||||||
|
use crate::core::config::Target;
|
||||||
|
use crate::core::config::TargetSelection;
|
||||||
use crate::core::config::{LldMode, TomlConfig};
|
use crate::core::config::{LldMode, TomlConfig};
|
||||||
|
|
||||||
use clap::CommandFactory;
|
use clap::CommandFactory;
|
||||||
|
@ -124,6 +126,10 @@ fn override_toml() {
|
||||||
"--set=build.gdb=\"bar\"".to_owned(),
|
"--set=build.gdb=\"bar\"".to_owned(),
|
||||||
"--set=build.tools=[\"cargo\"]".to_owned(),
|
"--set=build.tools=[\"cargo\"]".to_owned(),
|
||||||
"--set=llvm.build-config={\"foo\" = \"bar\"}".to_owned(),
|
"--set=llvm.build-config={\"foo\" = \"bar\"}".to_owned(),
|
||||||
|
"--set=target.x86_64-unknown-linux-gnu.runner=bar".to_owned(),
|
||||||
|
"--set=target.x86_64-unknown-linux-gnu.rpath=false".to_owned(),
|
||||||
|
"--set=target.aarch64-unknown-linux-gnu.sanitizers=false".to_owned(),
|
||||||
|
"--set=target.aarch64-apple-darwin.runner=apple".to_owned(),
|
||||||
],
|
],
|
||||||
|&_| {
|
|&_| {
|
||||||
toml::from_str(
|
toml::from_str(
|
||||||
|
@ -140,6 +146,17 @@ tools = []
|
||||||
[llvm]
|
[llvm]
|
||||||
download-ci-llvm = false
|
download-ci-llvm = false
|
||||||
build-config = {}
|
build-config = {}
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
sanitizers = true
|
||||||
|
rpath = true
|
||||||
|
runner = "aarch64-runner"
|
||||||
|
|
||||||
|
[target.x86_64-unknown-linux-gnu]
|
||||||
|
sanitizers = true
|
||||||
|
rpath = true
|
||||||
|
runner = "x86_64-runner"
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -163,6 +180,30 @@ build-config = {}
|
||||||
[("foo".to_string(), "bar".to_string())].into_iter().collect(),
|
[("foo".to_string(), "bar".to_string())].into_iter().collect(),
|
||||||
"setting dictionary value"
|
"setting dictionary value"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let x86_64 = TargetSelection::from_user("x86_64-unknown-linux-gnu");
|
||||||
|
let x86_64_values = Target {
|
||||||
|
sanitizers: Some(true),
|
||||||
|
rpath: Some(false),
|
||||||
|
runner: Some("bar".into()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let aarch64 = TargetSelection::from_user("aarch64-unknown-linux-gnu");
|
||||||
|
let aarch64_values = Target {
|
||||||
|
sanitizers: Some(false),
|
||||||
|
rpath: Some(true),
|
||||||
|
runner: Some("aarch64-runner".into()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let darwin = TargetSelection::from_user("aarch64-apple-darwin");
|
||||||
|
let darwin_values = Target { runner: Some("apple".into()), ..Default::default() };
|
||||||
|
assert_eq!(
|
||||||
|
config.target_config,
|
||||||
|
[(x86_64, x86_64_values), (aarch64, aarch64_values), (darwin, darwin_values)]
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
|
"setting dictionary value"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue