From 3c7e256cee075e2c43cd5c9b37142423c9a98342 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 19 Jun 2023 19:02:20 -0400 Subject: [PATCH] tests: Add a sanity check for composefs Prep for adding some coverage of this flow when booting with composefs. --- tests/inst/src/composefs.rs | 31 +++++++++++++++++++++++++++++++ tests/inst/src/insttestmain.rs | 6 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/inst/src/composefs.rs diff --git a/tests/inst/src/composefs.rs b/tests/inst/src/composefs.rs new file mode 100644 index 00000000..a75af870 --- /dev/null +++ b/tests/inst/src/composefs.rs @@ -0,0 +1,31 @@ +use anyhow::Result; +use xshell::cmd; + +pub(crate) fn itest_composefs() -> Result<()> { + let sh = xshell::Shell::new()?; + if !cmd!(sh, "ostree --version").read()?.contains("- composefs") { + println!("SKIP no composefs support"); + return Ok(()); + } + let mark = match crate::test::get_reboot_mark()? { + None => { + cmd!( + sh, + "ostree --repo=/ostree/repo config set ex-integrity.composefs true" + ) + .run()?; + // A dummy change; TODO add an ostree command for this + cmd!(sh, "rpm-ostree kargs --append=foo=bar").run()?; + return Err(crate::test::reboot("1").into()); + } + Some(v) => v, + }; + if mark != "1" { + anyhow::bail!("Invalid reboot mark: {mark}") + } + + let fstype = cmd!(sh, "findmnt -n -o FSTYPE /").read()?; + assert_eq!(fstype.as_str(), "overlay"); + + Ok(()) +} diff --git a/tests/inst/src/insttestmain.rs b/tests/inst/src/insttestmain.rs index e8a7acb9..92ca8e01 100644 --- a/tests/inst/src/insttestmain.rs +++ b/tests/inst/src/insttestmain.rs @@ -2,6 +2,7 @@ use anyhow::{bail, Result}; use libtest_mimic::Trial; use structopt::StructOpt; +mod composefs; mod destructive; mod repobin; mod sysroot; @@ -28,7 +29,10 @@ const TESTS: &[StaticTest] = &[ test!(repobin::itest_extensions), test!(repobin::itest_pull_basicauth), ]; -const DESTRUCTIVE_TESTS: &[StaticTest] = &[test!(destructive::itest_transactionality)]; +const DESTRUCTIVE_TESTS: &[StaticTest] = &[ + test!(destructive::itest_transactionality), + test!(composefs::itest_composefs), +]; #[derive(Debug, StructOpt)] #[structopt(rename_all = "kebab-case")] -- 2.30.2