mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-29 13:52:20 +00:00
test(install): cover riscv64 boot entries on other disks
The EL10 fix-up must keep the boot entry of a system on another disk, and must remove nothing when lsblk reports no ESP partition GUID. Both cases fail with the earlier code, which removed every matching entry.
This commit is contained in:
@@ -129,6 +129,7 @@ my $findmnt = fake_command('findmnt', <<'SH');
|
||||
printf '/dev/vda1\n'
|
||||
SH
|
||||
my $lsblk = fake_command('lsblk', <<'SH');
|
||||
[ -n "$XCAT_TEST_NO_PARTUUID" ] && case "$*" in *PARTUUID*) exit 0 ;; esac
|
||||
case "$*" in
|
||||
*PKNAME*) printf "vda\n" ;;
|
||||
*PARTN*) printf "1\n" ;;
|
||||
@@ -143,6 +144,7 @@ case "$*" in
|
||||
printf 'Boot0001* Rocky Linux\tHD(1,GPT,0b8f4c1e-6a51-4b4e-9d7e-2f3a1c5d7e90,0x800,0x80000)/File(\\EFI\\rocky\\shimx64.efi)\n'
|
||||
printf 'Boot0002* Rocky Linux\tHD(1,GPT,0B8F4C1E-6A51-4B4E-9D7E-2F3A1C5D7E90,0x800,0x80000)/File(\\EFI\\rocky\\grubriscv64.efi)\n'
|
||||
printf 'Boot0003* Network PXE\n'
|
||||
printf 'Boot0004* Ubuntu\tHD(1,GPT,5d2e8a47-0c3b-4f19-8e6a-91b7c4d2f063,0x800,0x100000)/\\EFI\\ubuntu\\grubriscv64.efi\n'
|
||||
exit 0
|
||||
;;
|
||||
*'-c'*) exit "${XCAT_EFI_CREATE_RC:-0}" ;;
|
||||
@@ -240,6 +242,7 @@ my $efi_calls = read_text($efi_log);
|
||||
like($efi_calls, qr/^-q -b 0001 -B$/m, 'the invalid x86 boot entry is removed');
|
||||
like($efi_calls, qr/^-q -b 0002 -B$/m, 'the prior RISC-V boot entry is removed');
|
||||
unlike($efi_calls, qr/0003/, 'unrelated firmware entries are retained');
|
||||
unlike($efi_calls, qr/-b 0004 /, 'the boot entry of a system on another disk is retained');
|
||||
like(
|
||||
$efi_calls,
|
||||
qr/^-q -c -d \/dev\/vda -p 1 -L Rocky Linux -l \\EFI\\rocky\\grubriscv64\.efi$/m,
|
||||
@@ -263,4 +266,11 @@ unlink($efi_log);
|
||||
is($status, 0, 'an efibootmgr create failure remains nonfatal');
|
||||
like($output, qr/firmware will use \\EFI\\BOOT\\BOOTRISCV64\.EFI/, 'the fallback path is reported after an efibootmgr failure');
|
||||
|
||||
unlink($efi_log);
|
||||
($status, $output) = run_post($root, XCAT_TEST_NO_PARTUUID => 1);
|
||||
is($status, 0, 'the fix-up completes when lsblk reports no ESP partition GUID');
|
||||
my $unknown_calls = read_text($efi_log);
|
||||
unlike($unknown_calls, qr/ -B$/m, 'no boot entry is removed when the ESP partition GUID is unknown');
|
||||
like($unknown_calls, qr/^-q -c -d \/dev\/vda -p 1 -L Rocky Linux /m, 'the boot entry is still registered without the ESP partition GUID');
|
||||
|
||||
done_testing();
|
||||
|
||||
Reference in New Issue
Block a user