Skip to content

Commit

Permalink
Fixes bug in 'spk test package.spk.yaml@install ...' by ensuring host…
Browse files Browse the repository at this point in the history
… options are passed into the test build as var requests.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
  • Loading branch information
dcookspi committed Mar 8, 2024
1 parent f271c2b commit 7291910
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/spk-cli/cmd-test/src/cmd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use spk_schema::foundation::format::FormatOptionMap;
use spk_schema::foundation::ident_build::Build;
use spk_schema::foundation::option_map::{OptionMap, HOST_OPTIONS};
use spk_schema::prelude::*;
use spk_schema::{Recipe, TestStage};
use spk_schema::{Recipe, Request, TestStage};

use crate::test::{PackageBuildTester, PackageInstallTester, PackageSourceTester, Tester};

Expand Down Expand Up @@ -79,6 +79,15 @@ impl Run for CmdTest {
let opt_host_options =
(!self.options.no_host).then(|| HOST_OPTIONS.get().unwrap_or_default());

// This includes any host options added by command line flag,
// or not if --nohost was used.
let options_reqs: Vec<Request> = self
.options
.get_var_requests()?
.into_iter()
.map(Request::Var)
.collect();

for package in &self.packages {
let (name, stages) = match package.split_once('@') {
Some((name, stage)) => {
Expand Down Expand Up @@ -203,6 +212,7 @@ impl Run for CmdTest {
.with_options(variant.options().into_owned())
.with_repositories(repos.iter().cloned())
.with_requirements(test.additional_requirements())
.with_requirements(options_reqs.clone())
.with_source(source.clone())
.watch_environment_resolve(&install_formatter);

Expand Down

0 comments on commit 7291910

Please sign in to comment.