Skip to content

Commit 94cc06c

Browse files
tests: Add tmt test for 'uki'/'efi' key
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 628e3b3 commit 94cc06c

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
use std assert
2+
use tap.nu
3+
4+
tap begin "Test EFI/UKI key"
5+
6+
let st = bootc status --json | from json
7+
8+
if not (tap is_composefs) {
9+
exit 0
10+
}
11+
12+
let bootloader = $st.status.booted.composefs.bootloader
13+
14+
# Only for UKIs
15+
if ($st.status.booted.composefs.bootType | str downcase) != "uki" {
16+
exit 0
17+
}
18+
19+
let systemd_version = systemctl --version | lines | first | awk '{print $2}' | into int
20+
21+
echo $"($systemd_version)"
22+
23+
echo "BLS entry"
24+
echo (cat /boot/loader/entries/*)
25+
26+
# Both bootloaders support BLI so EFI should be mounted at /boot
27+
let efi_line = (
28+
open /boot/loader/entries/*
29+
| lines
30+
| where $it =~ '^efi'
31+
)
32+
33+
let uki_line = (
34+
open /boot/loader/entries/*
35+
| lines
36+
| where $it =~ '^uki'
37+
)
38+
39+
if $bootloader == "grub-cc" {
40+
assert equal ($efi_line | length) 1
41+
assert equal ($uki_line | length) 0
42+
} else {
43+
44+
if $systemd_version >= 258 {
45+
assert equal ($efi_line | length) 0
46+
assert equal ($uki_line | length) 1
47+
} else {
48+
assert equal ($efi_line | length) 1
49+
assert equal ($uki_line | length) 0
50+
}
51+
}
52+
53+
tap ok

0 commit comments

Comments
 (0)