|
1 | 1 | //! Integration tests: build-list order and markdown stack-diff via library + CLI. |
2 | 2 |
|
3 | | -use eb_stack::{ |
4 | | - classify_stack_diff, dep_map_from_universe, format_build_list, format_stack_diff_markdown, |
5 | | - ordered_build_paths, solve_from_easyconfigs_with_baseline_version_and_extras, |
6 | | - PackageChangeKind, SolveExtraOut, StackLock, Universe, |
7 | | -}; |
| 3 | +use eb_stack::{LockPackage, PackageChangeKind, STACK_LOCK_SCHEMA_VERSION, SolveExtraOut, SolverMeta, StackLock, Toolchain, Universe, classify_stack_diff, dep_map_from_universe, format_build_list, format_stack_diff_markdown, ordered_build_paths, ordered_packages, solve_from_easyconfigs_with_baseline_version_and_extras}; |
8 | 4 | use std::collections::BTreeSet; |
9 | 5 | use std::path::PathBuf; |
10 | 6 | use std::process::Command; |
11 | 7 |
|
| 8 | + |
12 | 9 | fn fixture(rel: &str) -> PathBuf { |
13 | 10 | PathBuf::from(env!("CARGO_MANIFEST_DIR")) |
14 | 11 | .join("fixtures/gromacs_2025_to_next") |
@@ -341,3 +338,52 @@ fn emit_reports_howto_matches_the_gromacs_solve() { |
341 | 338 | "emit-reports.org stack diff drifted from the solve:\n{diff}" |
342 | 339 | ); |
343 | 340 | } |
| 341 | + |
| 342 | +// Ported from develop: tests main lacked by name. |
| 343 | + |
| 344 | +#[test] |
| 345 | +fn ordered_packages_keeps_system_bootstrap_siblings() { |
| 346 | + let system = Toolchain { |
| 347 | + name: "system".into(), |
| 348 | + version: "system".into(), |
| 349 | + }; |
| 350 | + let lock_pkg = |name: &str, version: &str| LockPackage { |
| 351 | + name: name.into(), |
| 352 | + version: version.into(), |
| 353 | + toolchain: system.clone(), |
| 354 | + versionsuffix: None, |
| 355 | + easyconfig_path: format!("{name}-{version}.eb"), |
| 356 | + }; |
| 357 | + let lock = StackLock { |
| 358 | + schema_version: STACK_LOCK_SCHEMA_VERSION, |
| 359 | + toolchain: system.clone(), |
| 360 | + generation_label: None, |
| 361 | + packages: vec![ |
| 362 | + lock_pkg("binutils", "2.40"), |
| 363 | + lock_pkg("binutils", "2.42"), |
| 364 | + lock_pkg("Perl", "5.38.0"), |
| 365 | + ], |
| 366 | + solver: SolverMeta { |
| 367 | + engine: "test".into(), |
| 368 | + engine_version: "0".into(), |
| 369 | + timestamp: "1970-01-01T00:00:00Z".into(), |
| 370 | + }, |
| 371 | + }; |
| 372 | + let mut dep_map = std::collections::HashMap::new(); |
| 373 | + dep_map.insert("Perl".into(), vec!["binutils".into()]); |
| 374 | + dep_map.insert("binutils".into(), vec!["Perl".into()]); |
| 375 | + let ordered = ordered_packages(&lock, &dep_map); |
| 376 | + let paths: Vec<&str> = ordered |
| 377 | + .iter() |
| 378 | + .map(|package| package.easyconfig_path.as_str()) |
| 379 | + .collect(); |
| 380 | + assert!( |
| 381 | + paths.contains(&"binutils-2.40.eb"), |
| 382 | + "missing SYSTEM binutils 2.40: {paths:?}" |
| 383 | + ); |
| 384 | + assert!( |
| 385 | + paths.contains(&"binutils-2.42.eb"), |
| 386 | + "missing SYSTEM binutils 2.42: {paths:?}" |
| 387 | + ); |
| 388 | + assert_eq!(ordered.len(), 3, "Perl plus both binutils rows: {paths:?}"); |
| 389 | +} |
0 commit comments