Skip to content

Commit d8505b7

Browse files
committed
test(spack): cover valued variant dependencies
1 parent cd0c9cc commit d8505b7

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

‎tests/foreign_ingest.rs‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Syntax-adapter regression for conda-forge and Spack inputs.
22
33
use eb_stack::{
4-
detect_foreign_format, inspect_new_package, package_plan_from_foreign, parse_foreign_path,
5-
ForeignFormat, Toolchain,
4+
detect_foreign_format, inspect_new_package, materialize_profile, package_plan_from_foreign,
5+
parse_foreign_path, ForeignFormat, ProfileEnvironment, Toolchain,
66
};
77
use std::path::PathBuf;
88
use std::process::Command;
@@ -197,6 +197,39 @@ fn spack_lammps_splits_compound_when_predicates() {
197197
assert!(!condition.contains("kokkos+kspace"), "{condition}");
198198
}
199199

200+
#[test]
201+
fn spack_valued_variant_conditions_filter_dependencies() {
202+
let recipe = parse_foreign_path(
203+
&root().join("spack_lammps/package.py"),
204+
Some(ForeignFormat::Spack),
205+
)
206+
.expect("parse Spack LAMMPS");
207+
let mut plan = package_plan_from_foreign(&recipe, &toolchain("2025b"));
208+
let profile = plan.profiles.first_mut().expect("default profile");
209+
profile.features.insert("kokkos".into(), true);
210+
profile.features.insert("kspace".into(), true);
211+
assert_eq!(profile.parameters.get("fft").map(String::as_str), Some("fftw3"));
212+
assert_eq!(
213+
profile.parameters.get("fft_kokkos").map(String::as_str),
214+
Some("fftw3")
215+
);
216+
217+
let materialized = materialize_profile(&plan, "default", &ProfileEnvironment::default())
218+
.expect("materialize default profile");
219+
220+
assert!(
221+
materialized
222+
.dependencies
223+
.iter()
224+
.all(|dependency| dependency.name != "mkl"),
225+
"FFTW-valued variants must not activate MKL dependencies"
226+
);
227+
assert!(materialized
228+
.dependencies
229+
.iter()
230+
.any(|dependency| dependency.name == "fftw-api"));
231+
}
232+
200233
#[test]
201234
fn spack_zlib_and_eon_preserve_build_system_information() {
202235
let zlib_path = root().join("spack_zlib/package.py");

0 commit comments

Comments
 (0)