Skip to content

Commit 1bcce9f

Browse files
tmt: Add tests for .boot images and UKI asset cleanup
Test whether UKI assets are being cleaned up from the objects directory during GC Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent edb2ef0 commit 1bcce9f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tmt/tests/booted/test-composefs-gc-uki.nu

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,30 @@ def first_boot [] {
3838

3939
bootc switch --transport containers-storage localhost/bootc-first
4040

41+
# Make sure we have the .boot EROFS
42+
let st = bootc status --json | from json
43+
let staged_verity = $st.status.staged.composefs.verity
44+
let booted_verity = $st.status.booted.composefs.verity
45+
46+
assert ($"/sysroot/composefs/images/refs/($staged_verity).boot" | path exists)
47+
assert ($"/sysroot/composefs/images/refs/($booted_verity).boot" | path exists)
48+
4149
# Find the large file's verity and save it
4250
let new_st = bootc status --json | from json
4351
let path = bootc internals cfs dump-files $new_st.status.staged.composefs.verity /usr/share/large-test-file --backing-path-only | awk '{print $2}'
4452
echo $"/sysroot/composefs/objects/($path)" | save /var/large-file-marker-objpath
4553

54+
mkdir /var/tmp/efi
55+
mount /dev/disk/by-partlabel/EFI-SYSTEM /var/tmp/efi
56+
57+
# Find the UKI in the objects directory
58+
# Intentionally not using the dump-files API here
59+
# min/max depth = 1 to not include addons (for now)
60+
let uki_sha = sha512sum $"/var/tmp/efi/EFI/Linux/bootc/($uki_prefix)($st.status.booted.composefs.verity).efi" | awk '{print $1}'
61+
let uki_in_objs = ^find /sysroot/composefs/objects -type f -exec sha512sum {} + | grep ($uki_sha) | awk '{print $2}'
62+
4663
echo $st.status.booted.composefs.verity | save /var/boot0-verity
64+
echo $uki_in_objs | save /var/boot0-uki-in-objs
4765

4866
tmt-reboot
4967
}
@@ -100,6 +118,11 @@ def third_boot [] {
100118

101119
bootc switch --transport containers-storage localhost/bootc-third
102120

121+
# Make sure the .boot image is removed
122+
assert (not ($"/sysroot/composefs/images/refs/(cat /var/boot0-verity).boot" | path exists))
123+
# Now also make sure the UKI doesn't exist in the objects directory either
124+
assert (not (cat /var/boot0-uki-in-objs | path exists))
125+
103126
tmt-reboot
104127
}
105128

0 commit comments

Comments
 (0)