|
1 | 1 | //! Syntax-adapter regression for conda-forge and Spack inputs. |
2 | 2 |
|
3 | 3 | 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, |
6 | 6 | }; |
7 | 7 | use std::path::PathBuf; |
8 | 8 | use std::process::Command; |
@@ -197,6 +197,39 @@ fn spack_lammps_splits_compound_when_predicates() { |
197 | 197 | assert!(!condition.contains("kokkos+kspace"), "{condition}"); |
198 | 198 | } |
199 | 199 |
|
| 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 | + |
200 | 233 | #[test] |
201 | 234 | fn spack_zlib_and_eon_preserve_build_system_information() { |
202 | 235 | let zlib_path = root().join("spack_zlib/package.py"); |
|
0 commit comments