Skip to content

Commit 73ab538

Browse files
Johan-Liebert1cgwalters
authored andcommitted
xtask: Introduce composefs variant
This is the Non UKI version, i.e. version with Type1 bootloader entries Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent dd750c2 commit 73ab538

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

crates/tests-integration/src/container.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub(crate) fn test_bootc_container_inspect() -> Result<()> {
5252
.expect("kernel.unified should be a boolean");
5353
if let Some(variant) = std::env::var("BOOTC_variant").ok() {
5454
match variant.as_str() {
55-
"ostree" => {
56-
assert!(!unified, "Expected unified=false for ostree variant");
55+
v @ "ostree" | v @ "composefs" => {
56+
assert!(!unified, "Expected unified=false for variant {v}");
5757
// For traditional kernels, version should look like a uname (contains digits)
5858
assert!(
5959
version.chars().any(|c| c.is_ascii_digit()),
@@ -159,7 +159,7 @@ fn test_variant_base_crosscheck() -> Result<()> {
159159
// TODO add this to `bootc status` or so?
160160
let boot_efi = Utf8Path::new("/boot/EFI");
161161
match variant.as_str() {
162-
"ostree" => {
162+
"composefs" | "ostree" => {
163163
assert!(!boot_efi.try_exists()?);
164164
}
165165
"composefs-sealeduki-sdboot" => {

crates/xtask/src/tmt.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const ENV_BOOTC_UPGRADE_IMAGE: &str = "BOOTC_upgrade_image";
2929
// Distro identifiers
3030
const DISTRO_CENTOS_9: &str = "centos-9";
3131

32+
const COMPOSEFS_KERNEL_ARGS: [&str; 1] = ["--karg=enforcing=0"];
33+
3234
// Import the argument types from xtask.rs
3335
use crate::{RunTmtArgs, TmtProvisionArgs};
3436

@@ -430,6 +432,19 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
430432
opts.push("--filesystem=xfs".to_string());
431433
}
432434
}
435+
436+
if args.composefs_backend {
437+
// TODO(Johan-Liebert1): Filesystem should be a parameter and we should test
438+
// insecure with xfs
439+
opts.push("--filesystem=ext4".into());
440+
opts.push("--composefs-backend".into());
441+
opts.extend(COMPOSEFS_KERNEL_ARGS.map(|x| x.into()));
442+
}
443+
444+
if let Some(b) = &args.bootloader {
445+
opts.push(format!("--bootloader={b}"));
446+
}
447+
433448
opts
434449
};
435450

crates/xtask/src/xtask.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
//! end up as a lot of nontrivial bash code.
66
77
use std::borrow::Cow;
8+
use std::fmt::Display;
89
use std::fs::File;
910
use std::io::{BufRead, BufReader, BufWriter, Write};
1011
use std::process::Command;
1112

1213
use anyhow::{Context, Result};
1314
use camino::{Utf8Path, Utf8PathBuf};
14-
use clap::{Args, Parser, Subcommand};
15+
use clap::{Args, Parser, Subcommand, ValueEnum};
1516
use fn_error_context::context;
1617
use xshell::{Shell, cmd};
1718

@@ -76,6 +77,25 @@ pub(crate) struct LocalRustDepsArgs {
7677
pub(crate) format: String,
7778
}
7879

80+
/// Bootloader passed as --bootloader param for composefs builds
81+
// TODO: Find a better way to share this Enum between this and crates/lib
82+
#[derive(Debug, Clone, ValueEnum)]
83+
pub enum Bootloader {
84+
/// grub as bootloader
85+
Grub,
86+
/// systemd-boot as bootloader
87+
Systemd,
88+
}
89+
90+
impl Display for Bootloader {
91+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
92+
match self {
93+
Bootloader::Grub => f.write_str("grub"),
94+
Bootloader::Systemd => f.write_str("systemd"),
95+
}
96+
}
97+
}
98+
7999
/// Arguments for run-tmt command
80100
#[derive(Debug, Args)]
81101
pub(crate) struct RunTmtArgs {
@@ -101,6 +121,12 @@ pub(crate) struct RunTmtArgs {
101121
/// Preserve VMs after test completion (useful for debugging)
102122
#[arg(long)]
103123
pub(crate) preserve_vm: bool,
124+
125+
#[arg(long)]
126+
pub(crate) composefs_backend: bool,
127+
128+
#[arg(long, requires = "composefs_backend")]
129+
pub(crate) bootloader: Option<Bootloader>,
104130
}
105131

106132
/// Arguments for tmt-provision command

0 commit comments

Comments
 (0)