From aaf44f4dba3b2596401254993690b243d8256be3 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Tue, 3 Nov 2026 19:58:33 +0200 Subject: [PATCH 1/6] refactor(cases): model optional CPU profiles separately from base ISAs Keep the enabled base-ISA matrices while resolving profile-specific case suites and rejecting contradictory profile declarations Signed-off-by: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> --- tools/src/cases.rs | 154 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 143 insertions(+), 11 deletions(-) diff --git a/tools/src/cases.rs b/tools/src/cases.rs index b55ce582..5ba0cde1 100644 --- a/tools/src/cases.rs +++ b/tools/src/cases.rs @@ -14,7 +14,9 @@ const CAPABILITIES: &[&str] = pub struct Target { pub id: String, pub os: String, + /// Base ISA, independent of the optional processor profile. pub arch: String, + pub profile: Option, pub executor: String, pub runner: Option, pub group: Option, @@ -29,7 +31,15 @@ pub struct Target { impl Target { pub fn suites(&self) -> Vec { - vec!["shared".into(), format!("shared/{}", self.arch), format!("{}/{}", self.os, self.arch)] + let mut suites = vec!["shared".into(), format!("shared/{}", self.arch)]; + if let Some(profile) = &self.profile { + suites.push(format!("shared/{profile}")); + } + suites.push(format!("{}/{}", self.os, self.arch)); + if let Some(profile) = &self.profile { + suites.push(format!("{}/{profile}", self.os)); + } + suites } pub fn rust_target(&self) -> Result { @@ -62,8 +72,13 @@ impl Target { ("id", Value::string(&self.id)), ("os", Value::string(&self.os)), ("arch", Value::string(&self.arch)), + ("profile", Value::optional_string(self.profile.as_deref())), ("executor", Value::string(&self.executor)), - ("suite", Value::string(format!("{}/{}", self.os, self.arch))), + ("suite", Value::string(format!( + "{}/{}", + self.os, + self.profile.as_deref().unwrap_or(&self.arch) + ))), ("suites", Value::strings(self.suites())), ( "status", @@ -94,6 +109,14 @@ pub struct Manifest { pub root: PathBuf, } +#[derive(Debug)] +struct Profile { + os: String, + arch: String, + enabled: bool, + ci: bool, +} + fn name(value: &str) -> bool { !value.is_empty() && value.bytes().enumerate().all(|(i, b)| { @@ -162,8 +185,11 @@ fn matrix(value: &toml::Value, key: &str) -> Result Result, +) -> Result> { + let table = data + .get("profiles") + .and_then(toml::Value::as_table) + .ok_or_else(|| error("missing [profiles] table"))?; + let mut result = BTreeMap::new(); + for (profile, fields) in table { + let base_arch = match profile.as_str() { + "rhea" => "arm64", + "shakti" | "xiangshan" | "t-head" => "riscv64", + _ => return Err(error(format!("unknown CPU profile: {profile}"))), + }; + let fields = + fields.as_table().ok_or_else(|| error(format!("invalid CPU profile: {profile}")))?; + if fields.keys().any(|key| { + !matches!(key.as_str(), "os" | "arch" | "supported" | "ci") + }) { + return Err(error(format!("unknown field in CPU profile: {profile}"))); + } + let os = required(fields, "os")?; + let arch = required(fields, "arch")?; + let enabled = fields + .get("supported") + .and_then(toml::Value::as_bool) + .ok_or_else(|| error(format!("missing boolean support for profile: {profile}")))?; + let ci = fields + .get("ci") + .and_then(toml::Value::as_bool) + .ok_or_else(|| error(format!("missing boolean CI for profile: {profile}")))?; + if os != "linux" + || arch != base_arch + || !supported.contains_key(&(os.clone(), arch.clone())) + || enabled && !supported[&(os.clone(), arch.clone())] + || ci && !enabled + { + return Err(error(format!("invalid base architecture or status for profile: {profile}"))); + } + result.insert(profile.clone(), Profile { os, arch, enabled, ci }); + } + Ok(result) +} + impl Manifest { pub fn load(root: &Path, validate_layout: bool) -> Result { Self::parse( @@ -188,8 +260,8 @@ impl Manifest { let table = data.as_table().ok_or_else(|| error("manifest must be a table"))?; if table .keys() - .any(|key| !matches!(key.as_str(), "version" | "supported" | "ci" | "target")) - || data.get("version").and_then(toml::Value::as_integer) != Some(2) + .any(|key| !matches!(key.as_str(), "version" | "supported" | "ci" | "profiles" | "target")) + || data.get("version").and_then(toml::Value::as_integer) != Some(3) { return Err(error("unknown manifest fields or unsupported version")); } @@ -198,6 +270,7 @@ impl Manifest { if supported.keys().ne(ci.keys()) || supported.iter().any(|(k, v)| ci[k] && !*v) { return Err(error("support/CI matrices disagree")); } + let profiles = profiles(&data, &supported)?; let mut targets = Vec::new(); let mut configured = BTreeSet::new(); let mut ids = BTreeSet::new(); @@ -212,6 +285,7 @@ impl Manifest { k.as_str(), "id" | "os" | "arch" + | "profile" | "executor" | "runner" | "ci_group" @@ -227,11 +301,25 @@ impl Manifest { let id = required(raw, "id")?; let os = required(raw, "os")?; let arch = required(raw, "arch")?; + let profile = optional(raw, "profile")?; let pair = (os.clone(), arch.clone()); + let (enabled, target_ci) = if let Some(profile_name) = &profile { + let defined = profiles.get(profile_name).ok_or_else(|| { + error(format!("unknown CPU profile: {profile_name}")) + })?; + if defined.os != os || defined.arch != arch { + return Err(error(format!( + "profile {profile_name} does not match target {id} base architecture" + ))); + } + (defined.enabled, defined.ci) + } else { + (supported.get(&pair) == Some(&true), ci.get(&pair).copied().unwrap_or(false)) + }; if !name(&id) || !ids.insert(id.clone()) - || !configured.insert(pair.clone()) - || supported.get(&pair) != Some(&true) + || !configured.insert((os.clone(), arch.clone(), profile.clone())) + || !enabled { return Err(error(format!("invalid/duplicate/unsupported target {id}"))); } @@ -240,6 +328,7 @@ impl Manifest { id, os, arch, + profile, executor, runner: optional(raw, "runner")?, group: optional(raw, "ci_group")?, @@ -249,7 +338,7 @@ impl Manifest { exclude: strings(raw, "exclude")?, capabilities: strings(raw, "capabilities")?, enabled: true, - ci: ci[&pair], + ci: target_ci, }; if !["native", "compile", "qemu", "wasm"].contains(&target.executor.as_str()) || target.executor != "native" && target.triple.is_none() @@ -297,7 +386,7 @@ impl Manifest { targets.push(target); } for ((os, arch), enabled) in &supported { - if *enabled && !configured.contains(&(os.clone(), arch.clone())) { + if *enabled && !configured.contains(&(os.clone(), arch.clone(), None)) { return Err(error("supported target has no execution table")); } if !enabled { @@ -309,6 +398,42 @@ impl Manifest { id, os: os.clone(), arch: arch.clone(), + profile: None, + executor: "none".into(), + runner: None, + group: None, + triple: None, + smoke_case: None, + smoke_stdout: None, + exclude: vec![], + capabilities: vec![], + enabled: false, + ci: false, + }); + } + } + for (profile_name, profile) in &profiles { + if profile.enabled + && !configured.contains(&( + profile.os.clone(), + profile.arch.clone(), + Some(profile_name.clone()), + )) + { + return Err(error(format!( + "supported CPU profile has no execution table: {profile_name}" + ))); + } + if !profile.enabled { + let id = format!("{}-{profile_name}", profile.os); + if !ids.insert(id.clone()) { + return Err(error("duplicate planned CPU profile ID")); + } + targets.push(Target { + id, + os: profile.os.clone(), + arch: profile.arch.clone(), + profile: Some(profile_name.clone()), executor: "none".into(), runner: None, group: None, @@ -343,7 +468,11 @@ impl Manifest { let matches: Vec<_> = self .targets .iter() - .filter(|t| t.enabled && t.executor == "native" && t.os == os && t.arch == arch) + .filter(|t| t.enabled + && t.profile.is_none() + && t.executor == "native" + && t.os == os + && t.arch == arch) .collect(); if matches.len() != 1 { return Err(error("expected one native target for this host")); @@ -546,6 +675,9 @@ impl Manifest { ("shard_index", Value::integer(index)), ("shard_count", Value::integer(2)), ]); + if let Some(profile) = &target.profile { + config::field(&mut value, "profile", Value::string(profile))?; + } for (key, item) in [ ("target", &target.triple), ("smoke_case", &target.smoke_case), From 9b9eb9596559bab7e91d879cec09ef2c4857a8d7 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Tue, 3 Nov 2026 19:59:17 +0200 Subject: [PATCH 2/6] test(cases): migrate planned processor profiles and verify target identity Move profile settings out of architecture matrices and document inheritance of base case suites Add manifest rejection cases and protect the existing thirty enabled CI matrix entries Signed-off-by: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> --- tests/cases/README.md | 17 +++++ tests/cases/cases.toml | 19 ++++-- tools/tests/case_profiles.rs | 117 +++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 tools/tests/case_profiles.rs diff --git a/tests/cases/README.md b/tests/cases/README.md index 361d21b9..6206caec 100644 --- a/tests/cases/README.md +++ b/tests/cases/README.md @@ -14,3 +14,20 @@ Bare WebAssembly and freestanding targets exclude this case in `cases.toml` because they have no process environment provider. WASI still compiles it; its runtime selector classifies this native-only case as unsupported rather than counting it as executed. + +## Target identities and CPU profiles + +`cases.toml` version 3 separates base architectures in `[supported]` and +`[ci]` from optional processor profiles in `[profiles]` + +Rhea uses the `arm64` base ISA; SHAKTI, XiangShan and T-Head use `riscv64` +These Linux profiles remain disabled until their compiler/runtime contracts exist + +A base target runs `shared`, `shared/`, then `/` +A profile target also inherits `shared/` and `/` +after the corresponding base-architecture suite of each kind + +A supported profile requires an explicit `[[target]]` entry with matching +`os`, base `arch` and `profile` fields, plus an explicit target runner +Profile identity does not imply new compiler target triples or ISA support +Existing CI-enabled base targets and their matrices are unchanged diff --git a/tests/cases/cases.toml b/tests/cases/cases.toml index 61438113..cab7956a 100644 --- a/tests/cases/cases.toml +++ b/tests/cases/cases.toml @@ -1,4 +1,4 @@ -version = 2 +version = 3 # List only existing OS ports or publicly documented porting work. Every listed # cell must appear in both tables; false means planned in Wave, not an invented @@ -13,7 +13,7 @@ version = 2 # Fuchsia RISC-V: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0211_fuchsia_on_risc-v # iOS amd64 is reserved for the simulator, not physical iOS devices (Wave #473). [supported] -linux = { amd64 = true, arm64 = true, riscv64 = true, loong64 = true, rhea = false, shakti = false, xiangshan = false, t-head = false } +linux = { amd64 = true, arm64 = true, riscv64 = true, loong64 = true } macos = { amd64 = true, arm64 = true } windows = { amd64 = true, arm64 = true } freebsd = { amd64 = true, arm64 = true, riscv64 = true } @@ -28,7 +28,7 @@ wasm = { wasm32 = true, wasm64 = true } wasi = { wasm32 = true, wasm64 = false } [ci] -linux = { amd64 = true, arm64 = true, riscv64 = true, loong64 = true, rhea = false, shakti = false, xiangshan = false, t-head = false } +linux = { amd64 = true, arm64 = true, riscv64 = true, loong64 = true } macos = { amd64 = true, arm64 = true } windows = { amd64 = true, arm64 = true } freebsd = { amd64 = true, arm64 = true, riscv64 = true } @@ -42,9 +42,18 @@ ios = { amd64 = false, arm64 = false } wasm = { wasm32 = true, wasm64 = true } wasi = { wasm32 = true, wasm64 = false } +# Processor names are profiles of base ISAs, not architectures or compiler +# targets. They remain disabled until the compiler and runtime support them. +[profiles] +rhea = { os = "linux", arch = "arm64", supported = false, ci = false } +shakti = { os = "linux", arch = "riscv64", supported = false, ci = false } +xiangshan = { os = "linux", arch = "riscv64", supported = false, ci = false } +t-head = { os = "linux", arch = "riscv64", supported = false, ci = false } + # Only supported=true cells need execution details below. Every target gets -# shared, shared/, and / suites automatically. Support=false -# cells become disabled planned targets. +# shared, shared/, and / suites automatically. Profile targets +# also get shared/ and / after the base suites. +# Support=false entries remain disabled planned targets. [[target]] id = "linux-amd64" diff --git a/tools/tests/case_profiles.rs b/tools/tests/case_profiles.rs new file mode 100644 index 00000000..885038c8 --- /dev/null +++ b/tools/tests/case_profiles.rs @@ -0,0 +1,117 @@ +//! CPU profiles refine base architectures without changing enabled CI cells. +use std::path::PathBuf; +use wave_tools::cases::Manifest; + +const MANIFEST: &str = r#" +version = 3 +[supported] +linux = { arm64 = true, riscv64 = true } +[ci] +linux = { arm64 = false, riscv64 = false } +[profiles] +rhea = { os = "linux", arch = "arm64", supported = false, ci = false } +shakti = { os = "linux", arch = "riscv64", supported = false, ci = false } +xiangshan = { os = "linux", arch = "riscv64", supported = false, ci = false } +t-head = { os = "linux", arch = "riscv64", supported = false, ci = false } +[[target]] +id = "linux-arm64" +os = "linux" +arch = "arm64" +executor = "native" +[[target]] +id = "linux-riscv64" +os = "linux" +arch = "riscv64" +executor = "native" +"#; + +fn parse(value: &str) -> Result { + Manifest::parse(value, PathBuf::from("not-used"), false).map_err(|e| e.to_string()) +} + +#[test] +fn profiles_inherit_base_suites_and_retain_separate_identities() { + let manifest = parse(MANIFEST).unwrap(); + let base = manifest.target("linux-arm64").unwrap(); + assert_eq!(base.suites(), ["shared", "shared/arm64", "linux/arm64"]); + assert_eq!(base.profile, None); + let expected = [ + ("rhea", "arm64"), + ("shakti", "riscv64"), + ("xiangshan", "riscv64"), + ("t-head", "riscv64"), + ]; + for (name, arch) in expected { + let target = manifest.target(&format!("linux-{name}")).unwrap(); + assert_eq!(target.arch, arch); + assert_eq!(target.profile.as_deref(), Some(name)); + assert_eq!( + target.suites(), + [ + "shared".to_string(), + format!("shared/{arch}"), + format!("shared/{name}"), + format!("linux/{arch}"), + format!("linux/{name}"), + ] + ); + assert!(!target.enabled); + assert!(!target.ci); + assert!(target.rust_target().is_err()); + let value = target.value(); + assert_eq!(value.get_str("arch"), Some(arch)); + assert_eq!(value.get_str("profile"), Some(name)); + assert_eq!(value.get_str("suite"), Some(format!("linux/{name}").as_str())); + } +} + +#[test] +fn invalid_profile_architecture_status_and_names_are_rejected() { + for invalid in [ + MANIFEST.replace("rhea = { os = \"linux\", arch = \"arm64\"", + "rhea = { os = \"linux\", arch = \"riscv64\""), + MANIFEST.replace("rhea = {", "unknown = {"), + MANIFEST.replace("shakti = { os = \"linux\"", "shakti = { os = \"windows\""), + MANIFEST.replace("supported = false, ci = false }", "supported = false, ci = true }"), + MANIFEST.replace("rhea = { os = \"linux\", arch = \"arm64\", supported = false", + "rhea = { os = \"linux\", arch = \"arm64\", supported = true"), + MANIFEST.replace("arch = \"arm64\"\nexecutor", "arch = \"rhea\"\nexecutor"), + MANIFEST.replace("version = 3", "version = 2"), + ] { + assert!(parse(&invalid).is_err(), "accepted invalid manifest: {invalid}"); + } +} + +#[test] +fn profile_target_tables_must_match_the_profile_mapping() { + let invalid = format!( + "{MANIFEST} +[[target]] +id = \"linux-rhea\" +os = \"linux\" +arch = \"riscv64\" +profile = \"rhea\" +executor = \"native\" +" + ); + assert!(parse(&invalid).is_err()); + let invalid = MANIFEST.replace( + "rhea = { os = \"linux\", arch = \"arm64\", supported = false", + "rhea = { os = \"linux\", arch = \"arm64\", supported = true", + ); + assert!(parse(&invalid).is_err(), "enabled profile without execution table"); +} + +#[test] +fn repository_enabled_matrices_remain_at_thirty_jobs() { + let manifest = Manifest::load(&wave_tools::root(), true).unwrap(); + let matrix = manifest.matrices().unwrap(); + let utils::wson::Value::Object(groups) = matrix else { panic!("matrix groups") }; + assert_eq!( + groups.iter().map(|(_, v)| v.get_arr("include").unwrap().len()).sum::(), + 30 + ); + let rhea = manifest.target("linux-rhea").unwrap(); + assert_eq!(rhea.profile.as_deref(), Some("rhea")); + assert!(!rhea.enabled); +} From 23afce6c5151771bec60bb8ee75f4450a068f49d Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Tue, 3 Nov 2026 20:00:40 +0200 Subject: [PATCH 3/6] test(cases): cover enabled profile identity and invalid target mappings Exercise a supported profile with an explicit compiler triple and reject inconsistent or unknown target profile names Signed-off-by: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> --- tools/src/cases.rs | 8 ++++++-- tools/tests/case_profiles.rs | 33 ++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/tools/src/cases.rs b/tools/src/cases.rs index 5ba0cde1..a664389d 100644 --- a/tools/src/cases.rs +++ b/tools/src/cases.rs @@ -239,7 +239,9 @@ fn profiles( || enabled && !supported[&(os.clone(), arch.clone())] || ci && !enabled { - return Err(error(format!("invalid base architecture or status for profile: {profile}"))); + return Err(error(format!( + "invalid base architecture or status for profile: {profile}" + ))); } result.insert(profile.clone(), Profile { os, arch, enabled, ci }); } @@ -260,7 +262,9 @@ impl Manifest { let table = data.as_table().ok_or_else(|| error("manifest must be a table"))?; if table .keys() - .any(|key| !matches!(key.as_str(), "version" | "supported" | "ci" | "profiles" | "target")) + .any(|key| { + !matches!(key.as_str(), "version" | "supported" | "ci" | "profiles" | "target") + }) || data.get("version").and_then(toml::Value::as_integer) != Some(3) { return Err(error("unknown manifest fields or unsupported version")); diff --git a/tools/tests/case_profiles.rs b/tools/tests/case_profiles.rs index 885038c8..26515cc7 100644 --- a/tools/tests/case_profiles.rs +++ b/tools/tests/case_profiles.rs @@ -84,22 +84,37 @@ fn invalid_profile_architecture_status_and_names_are_rejected() { #[test] fn profile_target_tables_must_match_the_profile_mapping() { - let invalid = format!( - "{MANIFEST} + let enabled = MANIFEST.replace( + "rhea = { os = \"linux\", arch = \"arm64\", supported = false", + "rhea = { os = \"linux\", arch = \"arm64\", supported = true", + ); + assert!(parse(&enabled).is_err(), "enabled profile without execution table"); + + let valid = format!( + "{enabled} [[target]] id = \"linux-rhea\" os = \"linux\" -arch = \"riscv64\" +arch = \"arm64\" profile = \"rhea\" -executor = \"native\" +executor = \"compile\" +target = \"aarch64-unknown-linux-gnu\" " ); - assert!(parse(&invalid).is_err()); - let invalid = MANIFEST.replace( - "rhea = { os = \"linux\", arch = \"arm64\", supported = false", - "rhea = { os = \"linux\", arch = \"arm64\", supported = true", + let parsed = parse(&valid).unwrap(); + let target = parsed.target("linux-rhea").unwrap(); + assert!(target.enabled); + assert_eq!(target.profile.as_deref(), Some("rhea")); + assert_eq!(target.arch, "arm64"); + assert_eq!(target.rust_target().unwrap(), "aarch64-unknown-linux-gnu"); + + let mismatch = valid.replace( + "arch = \"arm64\"\nprofile = \"rhea\"", + "arch = \"riscv64\"\nprofile = \"rhea\"", ); - assert!(parse(&invalid).is_err(), "enabled profile without execution table"); + assert!(parse(&mismatch).is_err(), "accepted mismatched profile base"); + let unknown = valid.replace("profile = \"rhea\"", "profile = \"other\""); + assert!(parse(&unknown).is_err(), "accepted unknown target profile"); } #[test] From c2edd4d4ccef5e47b04bb76b05604b30b21f70dc Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:42:18 +0200 Subject: [PATCH 4/6] style(cases): format profile parsing and target selection --- tools/src/cases.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/src/cases.rs b/tools/src/cases.rs index a664389d..9eabe425 100644 --- a/tools/src/cases.rs +++ b/tools/src/cases.rs @@ -74,11 +74,14 @@ impl Target { ("arch", Value::string(&self.arch)), ("profile", Value::optional_string(self.profile.as_deref())), ("executor", Value::string(&self.executor)), - ("suite", Value::string(format!( - "{}/{}", - self.os, - self.profile.as_deref().unwrap_or(&self.arch) - ))), + ( + "suite", + Value::string(format!( + "{}/{}", + self.os, + self.profile.as_deref().unwrap_or(&self.arch) + )), + ), ("suites", Value::strings(self.suites())), ( "status", @@ -200,7 +203,6 @@ fn matrix(value: &toml::Value, key: &str) -> Result, @@ -216,11 +218,13 @@ fn profiles( "shakti" | "xiangshan" | "t-head" => "riscv64", _ => return Err(error(format!("unknown CPU profile: {profile}"))), }; - let fields = - fields.as_table().ok_or_else(|| error(format!("invalid CPU profile: {profile}")))?; - if fields.keys().any(|key| { - !matches!(key.as_str(), "os" | "arch" | "supported" | "ci") - }) { + let fields = fields + .as_table() + .ok_or_else(|| error(format!("invalid CPU profile: {profile}")))?; + if fields + .keys() + .any(|key| !matches!(key.as_str(), "os" | "arch" | "supported" | "ci")) + { return Err(error(format!("unknown field in CPU profile: {profile}"))); } let os = required(fields, "os")?; @@ -472,11 +476,13 @@ impl Manifest { let matches: Vec<_> = self .targets .iter() - .filter(|t| t.enabled + .filter(|t| { + t.enabled && t.profile.is_none() && t.executor == "native" && t.os == os - && t.arch == arch) + && t.arch == arch + }) .collect(); if matches.len() != 1 { return Err(error("expected one native target for this host")); From 784009df18e2347042784f86b75a65928be19d24 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:42:31 +0200 Subject: [PATCH 5/6] style(cases): format CPU profile regression tests --- tools/tests/case_profiles.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/tests/case_profiles.rs b/tools/tests/case_profiles.rs index 26515cc7..7bc14aa3 100644 --- a/tools/tests/case_profiles.rs +++ b/tools/tests/case_profiles.rs @@ -68,13 +68,17 @@ fn profiles_inherit_base_suites_and_retain_separate_identities() { #[test] fn invalid_profile_architecture_status_and_names_are_rejected() { for invalid in [ - MANIFEST.replace("rhea = { os = \"linux\", arch = \"arm64\"", - "rhea = { os = \"linux\", arch = \"riscv64\""), + MANIFEST.replace( + "rhea = { os = \"linux\", arch = \"arm64\"", + "rhea = { os = \"linux\", arch = \"riscv64\"", + ), MANIFEST.replace("rhea = {", "unknown = {"), MANIFEST.replace("shakti = { os = \"linux\"", "shakti = { os = \"windows\""), MANIFEST.replace("supported = false, ci = false }", "supported = false, ci = true }"), - MANIFEST.replace("rhea = { os = \"linux\", arch = \"arm64\", supported = false", - "rhea = { os = \"linux\", arch = \"arm64\", supported = true"), + MANIFEST.replace( + "rhea = { os = \"linux\", arch = \"arm64\", supported = false", + "rhea = { os = \"linux\", arch = \"arm64\", supported = true", + ), MANIFEST.replace("arch = \"arm64\"\nexecutor", "arch = \"rhea\"\nexecutor"), MANIFEST.replace("version = 3", "version = 2"), ] { @@ -121,9 +125,14 @@ target = \"aarch64-unknown-linux-gnu\" fn repository_enabled_matrices_remain_at_thirty_jobs() { let manifest = Manifest::load(&wave_tools::root(), true).unwrap(); let matrix = manifest.matrices().unwrap(); - let utils::wson::Value::Object(groups) = matrix else { panic!("matrix groups") }; + let utils::wson::Value::Object(groups) = matrix else { + panic!("matrix groups") + }; assert_eq!( - groups.iter().map(|(_, v)| v.get_arr("include").unwrap().len()).sum::(), + groups + .iter() + .map(|(_, v)| v.get_arr("include").unwrap().len()) + .sum::(), 30 ); let rhea = manifest.target("linux-rhea").unwrap(); From 11b028b3eff5c3e3b2d8e4b2a5a70d31cee467f7 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:43:12 +0200 Subject: [PATCH 6/6] style(cases): apply pinned rustfmt --- tools/src/cases.rs | 25 +++++++++---------------- tools/tests/case_profiles.rs | 26 ++++++-------------------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/tools/src/cases.rs b/tools/src/cases.rs index 9eabe425..297ea5cc 100644 --- a/tools/src/cases.rs +++ b/tools/src/cases.rs @@ -218,13 +218,9 @@ fn profiles( "shakti" | "xiangshan" | "t-head" => "riscv64", _ => return Err(error(format!("unknown CPU profile: {profile}"))), }; - let fields = fields - .as_table() - .ok_or_else(|| error(format!("invalid CPU profile: {profile}")))?; - if fields - .keys() - .any(|key| !matches!(key.as_str(), "os" | "arch" | "supported" | "ci")) - { + let fields = + fields.as_table().ok_or_else(|| error(format!("invalid CPU profile: {profile}")))?; + if fields.keys().any(|key| !matches!(key.as_str(), "os" | "arch" | "supported" | "ci")) { return Err(error(format!("unknown field in CPU profile: {profile}"))); } let os = required(fields, "os")?; @@ -264,12 +260,9 @@ impl Manifest { pub fn parse(text: &str, root: PathBuf, validate_layout: bool) -> Result { let data: toml::Value = text.parse()?; let table = data.as_table().ok_or_else(|| error("manifest must be a table"))?; - if table - .keys() - .any(|key| { - !matches!(key.as_str(), "version" | "supported" | "ci" | "profiles" | "target") - }) - || data.get("version").and_then(toml::Value::as_integer) != Some(3) + if table.keys().any(|key| { + !matches!(key.as_str(), "version" | "supported" | "ci" | "profiles" | "target") + }) || data.get("version").and_then(toml::Value::as_integer) != Some(3) { return Err(error("unknown manifest fields or unsupported version")); } @@ -312,9 +305,9 @@ impl Manifest { let profile = optional(raw, "profile")?; let pair = (os.clone(), arch.clone()); let (enabled, target_ci) = if let Some(profile_name) = &profile { - let defined = profiles.get(profile_name).ok_or_else(|| { - error(format!("unknown CPU profile: {profile_name}")) - })?; + let defined = profiles + .get(profile_name) + .ok_or_else(|| error(format!("unknown CPU profile: {profile_name}")))?; if defined.os != os || defined.arch != arch { return Err(error(format!( "profile {profile_name} does not match target {id} base architecture" diff --git a/tools/tests/case_profiles.rs b/tools/tests/case_profiles.rs index 7bc14aa3..9399c5d5 100644 --- a/tools/tests/case_profiles.rs +++ b/tools/tests/case_profiles.rs @@ -35,12 +35,8 @@ fn profiles_inherit_base_suites_and_retain_separate_identities() { let base = manifest.target("linux-arm64").unwrap(); assert_eq!(base.suites(), ["shared", "shared/arm64", "linux/arm64"]); assert_eq!(base.profile, None); - let expected = [ - ("rhea", "arm64"), - ("shakti", "riscv64"), - ("xiangshan", "riscv64"), - ("t-head", "riscv64"), - ]; + let expected = + [("rhea", "arm64"), ("shakti", "riscv64"), ("xiangshan", "riscv64"), ("t-head", "riscv64")]; for (name, arch) in expected { let target = manifest.target(&format!("linux-{name}")).unwrap(); assert_eq!(target.arch, arch); @@ -112,10 +108,8 @@ target = \"aarch64-unknown-linux-gnu\" assert_eq!(target.arch, "arm64"); assert_eq!(target.rust_target().unwrap(), "aarch64-unknown-linux-gnu"); - let mismatch = valid.replace( - "arch = \"arm64\"\nprofile = \"rhea\"", - "arch = \"riscv64\"\nprofile = \"rhea\"", - ); + let mismatch = valid + .replace("arch = \"arm64\"\nprofile = \"rhea\"", "arch = \"riscv64\"\nprofile = \"rhea\""); assert!(parse(&mismatch).is_err(), "accepted mismatched profile base"); let unknown = valid.replace("profile = \"rhea\"", "profile = \"other\""); assert!(parse(&unknown).is_err(), "accepted unknown target profile"); @@ -125,16 +119,8 @@ target = \"aarch64-unknown-linux-gnu\" fn repository_enabled_matrices_remain_at_thirty_jobs() { let manifest = Manifest::load(&wave_tools::root(), true).unwrap(); let matrix = manifest.matrices().unwrap(); - let utils::wson::Value::Object(groups) = matrix else { - panic!("matrix groups") - }; - assert_eq!( - groups - .iter() - .map(|(_, v)| v.get_arr("include").unwrap().len()) - .sum::(), - 30 - ); + let utils::wson::Value::Object(groups) = matrix else { panic!("matrix groups") }; + assert_eq!(groups.iter().map(|(_, v)| v.get_arr("include").unwrap().len()).sum::(), 30); let rhea = manifest.target("linux-rhea").unwrap(); assert_eq!(rhea.profile.as_deref(), Some("rhea")); assert!(!rhea.enabled);