Skip to content

Commit 082fa3e

Browse files
test: Skip soft-reboot-selinux-policy for UKI
We skip this test for UKI as the container image that's built has different mtime for /var and /etc which results in different digests inside the UKI (computed with stitched overlayfs) vs in the final layer ``` 5c5 < /etc 0 40755 94 0 0 0 1776409773.0 - - - security.selinux=system_u:object_r:etc_t:s0 --- > /etc 0 40755 94 0 0 0 1776409786.0 - - - security.selinux=system_u:object_r:etc_t:s0 55015c55015 < /var 0 40755 7 0 0 0 1776409756.0 - - - security.selinux=system_u:object_r:var_t:s0 --- > /var 0 40755 7 0 0 0 1776409786.0 - - - security.selinux=system_u:object_r:var_t:s0 ``` Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent cf9885b commit 082fa3e

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

crates/xtask/src/tmt.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const FIELD_SUMMARY: &str = "summary";
2323
const FIELD_ADJUST: &str = "adjust";
2424

2525
const FIELD_FIXME_SKIP_IF_COMPOSEFS: &str = "fixme_skip_if_composefs";
26+
const FIELD_FIXME_SKIP_IF_UKI: &str = "fixme_skip_if_uki";
2627

2728
// bcvk options
2829
const BCVK_OPT_BIND_STORAGE_RO: &str = "--bind-storage-ro";
@@ -246,6 +247,7 @@ fn verify_ssh_connectivity(sh: &Shell, port: u16, key_path: &Utf8Path) -> Result
246247
struct PlanMetadata {
247248
try_bind_storage: bool,
248249
skip_if_composefs: bool,
250+
skip_if_uki: bool,
249251
}
250252

251253
/// Parse integration.fmf to extract extra-try_bind_storage for all plans
@@ -286,6 +288,7 @@ fn parse_plan_metadata(
286288
.and_modify(|m| m.try_bind_storage = b)
287289
.or_insert(PlanMetadata {
288290
try_bind_storage: b,
291+
skip_if_uki: false,
289292
skip_if_composefs: false,
290293
});
291294
}
@@ -301,6 +304,23 @@ fn parse_plan_metadata(
301304
.and_modify(|m| m.skip_if_composefs = b)
302305
.or_insert(PlanMetadata {
303306
skip_if_composefs: b,
307+
skip_if_uki: false,
308+
try_bind_storage: false,
309+
});
310+
}
311+
}
312+
313+
if let Some(skip_if_uki) = plan_data.get(&serde_yaml::Value::String(format!(
314+
"extra-{}",
315+
FIELD_FIXME_SKIP_IF_UKI
316+
))) {
317+
if let Some(b) = skip_if_uki.as_bool() {
318+
plan_metadata
319+
.entry(plan_name.to_string())
320+
.and_modify(|m| m.skip_if_uki = b)
321+
.or_insert(PlanMetadata {
322+
skip_if_uki: b,
323+
skip_if_composefs: false,
304324
try_bind_storage: false,
305325
});
306326
}
@@ -407,6 +427,16 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
407427
});
408428
}
409429

430+
if matches!(args.boot_type, crate::BootType::Uki) {
431+
plans.retain(|plan| {
432+
!plan_metadata
433+
.iter()
434+
.find(|(key, _)| plan.ends_with(key.as_str()))
435+
.map(|(_, v)| v.skip_if_uki)
436+
.unwrap_or(false)
437+
});
438+
}
439+
410440
if plans.len() < original_plans_count {
411441
println!(
412442
"Filtered from {} to {} plan(s) based on arguments: {:?}",
@@ -910,6 +940,8 @@ struct TestDef {
910940
try_bind_storage: bool,
911941
/// Whether to skip this test for composefs backend
912942
skip_if_composefs: bool,
943+
/// Whether to skip this test for images with UKI
944+
skip_if_uki: bool,
913945
/// TMT fmf attributes to pass through (summary, duration, adjust, etc.)
914946
tmt: serde_yaml::Value,
915947
}
@@ -1011,12 +1043,24 @@ pub(crate) fn update_integration() -> Result<()> {
10111043
.and_then(|v| v.as_bool())
10121044
.unwrap_or(false);
10131045

1046+
let skip_if_uki = metadata
1047+
.extra
1048+
.as_mapping()
1049+
.and_then(|m| {
1050+
m.get(&serde_yaml::Value::String(
1051+
FIELD_FIXME_SKIP_IF_UKI.to_string(),
1052+
))
1053+
})
1054+
.and_then(|v| v.as_bool())
1055+
.unwrap_or(false);
1056+
10141057
tests.push(TestDef {
10151058
number: metadata.number,
10161059
name: display_name,
10171060
test_command,
10181061
try_bind_storage,
10191062
skip_if_composefs,
1063+
skip_if_uki,
10201064
tmt: metadata.tmt,
10211065
});
10221066
}
@@ -1154,6 +1198,13 @@ pub(crate) fn update_integration() -> Result<()> {
11541198
);
11551199
}
11561200

1201+
if test.skip_if_uki {
1202+
plan_value.insert(
1203+
serde_yaml::Value::String(format!("extra-{}", FIELD_FIXME_SKIP_IF_UKI)),
1204+
serde_yaml::Value::Bool(true),
1205+
);
1206+
}
1207+
11571208
plans_mapping.insert(
11581209
serde_yaml::Value::String(plan_key),
11591210
serde_yaml::Value::Mapping(plan_value),

tmt/tests/booted/test-soft-reboot-selinux-policy.nu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
# tmt:
33
# summary: Test soft reboot with SELinux policy changes
44
# duration: 30m
5+
# extra:
6+
# fixme_skip_if_uki: true
57
#
68
# Verify that soft reboot is blocked when SELinux policies differ
9+
710
use std assert
811
use tap.nu
912

0 commit comments

Comments
 (0)