summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/inst/Cargo.toml1
-rw-r--r--tests/inst/src/treegen.rs10
2 files changed, 5 insertions, 6 deletions
diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml
index 02fc3cbf..c8773ad3 100644
--- a/tests/inst/Cargo.toml
+++ b/tests/inst/Cargo.toml
@@ -37,6 +37,7 @@ strum = "0.18.0"
strum_macros = "0.18.0"
# See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188
rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" }
+xshell = "0.2.3"
# This one I might publish to crates.io, not sure yet
with-procspawn-tempdir = { git = "https://github.com/cgwalters/with-procspawn-tempdir" }
diff --git a/tests/inst/src/treegen.rs b/tests/inst/src/treegen.rs
index 77161140..88bd0b7a 100644
--- a/tests/inst/src/treegen.rs
+++ b/tests/inst/src/treegen.rs
@@ -4,11 +4,11 @@ use cap_std_ext::cap_std;
use cap_std_ext::dirext::*;
use cap_std_ext::rustix::fs::MetadataExt;
use rand::Rng;
-use sh_inline::bash;
use std::fs::File;
use std::io::prelude::*;
use std::os::unix::fs::FileExt as UnixFileExt;
use std::path::Path;
+use xshell::cmd;
use crate::test::*;
@@ -129,6 +129,7 @@ pub(crate) fn update_os_tree<P: AsRef<Path>>(
ostref: &str,
percentage: u32,
) -> Result<()> {
+ let sh = xshell::Shell::new()?;
assert!(percentage > 0 && percentage <= 100);
let repo_path = repo_path.as_ref();
let tempdir = tempfile::tempdir_in(repo_path.join("tmp"))?;
@@ -149,9 +150,6 @@ pub(crate) fn update_os_tree<P: AsRef<Path>>(
}
assert!(mutated > 0);
println!("Mutated ELF files: {}", mutated);
- bash!("ostree --repo=${repo} commit --consume -b ${ostref} --base=${ostref} --tree=dir=${tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs",
- repo = repo_path,
- ostref = ostref,
- tempdir = tempdir.path()).context("Failed to commit updated content")?;
- Ok(())
+ let tempdir = tempdir.path();
+ cmd!(sh, "ostree --repo={repo_path} commit --consume -b {ostref} --base={ostref} --tree=dir={tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs").run().context("Failed to commit updated content")
}