tests: Add support for testing on aarch64

This changes how tests are run based on the host's arch.

Resolves: RHEL-50327
This commit is contained in:
Brian C. Lane 2024-07-23 17:44:58 -07:00
parent 3654057762
commit 0c97e99906

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
set -eux set -eux
ARCH=$(uname -m)
[ "$ARCH" == "x86_64" ] || [ "$ARCH" == "aarch64" ]
FAILANY=0 FAILANY=0
BOOTISO=/var/tmp/lorax-rhel10-iso/images/boot.iso BOOTISO=/var/tmp/lorax-rhel10-iso/images/boot.iso
KSNAME=fedora-minimal.ks KSNAME=fedora-minimal.ks
@ -64,6 +68,14 @@ function ks_pos_only {
} }
function test_ks { function test_ks {
if [ "$ARCH" == "x86_64" ]; then
test_ks_x86
elif [ "$ARCH" == "aarch64" ]; then
test_ks_aarch64
fi
}
function test_ks_x86 {
## This all needs to be another function ## This all needs to be another function
# Is there a kickstart in / of the iso? # Is there a kickstart in / of the iso?
[ -e "$ISODIR/$KSNAME" ] || fail "Missing kickstart" [ -e "$ISODIR/$KSNAME" ] || fail "Missing kickstart"
@ -75,6 +87,15 @@ function test_ks {
grep "inst.ks=.*$KSNAME" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry" grep "inst.ks=.*$KSNAME" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry"
} }
function test_ks_aarch64 {
## This all needs to be another function
# Is there a kickstart in / of the iso?
[ -e "$ISODIR/$KSNAME" ] || fail "Missing kickstart"
# Is the kickstart in the UEFI config?
grep "inst.ks=.*$KSNAME" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry"
}
# Add ks and cmdline # Add ks and cmdline
function ks_serial { function ks_serial {
running "Add kickstart and serial cmdline" running "Add kickstart and serial cmdline"
@ -103,7 +124,14 @@ function only_serial {
} }
function test_serial { function test_serial {
if [ "$ARCH" == "x86_64" ]; then
test_serial_x86
elif [ "$ARCH" == "aarch64" ]; then
test_serial_aarch64
fi
}
function test_serial_x86 {
# Is the serial in the BIOS config? # Is the serial in the BIOS config?
grep "console=ttyS0,115200n8" "$ISODIR/boot/grub2/grub.cfg" || fail "Missing BIOS grub.cfg cmdline entry" grep "console=ttyS0,115200n8" "$ISODIR/boot/grub2/grub.cfg" || fail "Missing BIOS grub.cfg cmdline entry"
@ -111,6 +139,11 @@ function test_serial {
grep "console=ttyS0,115200n8" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg cmdline entry" grep "console=ttyS0,115200n8" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg cmdline entry"
} }
function test_serial_aarch64 {
# Is the serial in the UEFI config?
grep "console=ttyS0,115200n8" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg cmdline entry"
}
# New VOLID # New VOLID
function new_volid { function new_volid {
running "Use a new VOLID" running "Use a new VOLID"
@ -126,6 +159,14 @@ function new_volid {
} }
function test_volid { function test_volid {
if [ "$ARCH" == "x86_64" ]; then
test_volid_x86
elif [ "$ARCH" == "aarch64" ]; then
test_volid_aarch64
fi
}
function test_volid_x86 {
# Is the VOLID in the BIOS config? # Is the VOLID in the BIOS config?
grep "hd:LABEL=mkksiso-test" "$ISODIR/boot/grub2/grub.cfg" || fail "Missing BIOS grub.cfg kickstart entry" grep "hd:LABEL=mkksiso-test" "$ISODIR/boot/grub2/grub.cfg" || fail "Missing BIOS grub.cfg kickstart entry"
@ -133,6 +174,11 @@ function test_volid {
grep "hd:LABEL=mkksiso-test" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry" grep "hd:LABEL=mkksiso-test" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry"
} }
function test_volid_aarch64 {
# Is the VOLID in the UEFI config?
grep "hd:LABEL=mkksiso-test" "$ISODIR/EFI/BOOT/grub.cfg" || fail "Missing UEFI grub.cfg kickstart entry"
}
# Add extra files # Add extra files
function add_files { function add_files {
running "Add files" running "Add files"
@ -161,6 +207,14 @@ function remove_quiet {
} }
function test_quiet { function test_quiet {
if [ "$ARCH" == "x86_64" ]; then
test_quiet_x86
elif [ "$ARCH" == "aarch64" ]; then
test_quiet_aarch64
fi
}
function test_quiet_x86 {
# Is quiet in the BIOS config? # Is quiet in the BIOS config?
! grep "append.*quiet" "$ISODIR/boot/grub2/grub.cfg" || fail "quiet not removed from BIOS grub.cfg cmdline entry" ! grep "append.*quiet" "$ISODIR/boot/grub2/grub.cfg" || fail "quiet not removed from BIOS grub.cfg cmdline entry"
@ -168,6 +222,11 @@ function test_quiet {
! grep "linux.*quiet" "$ISODIR/EFI/BOOT/grub.cfg" || fail "quiet not removed from UEFI grub.cfg cmdline entry" ! grep "linux.*quiet" "$ISODIR/EFI/BOOT/grub.cfg" || fail "quiet not removed from UEFI grub.cfg cmdline entry"
} }
function test_quiet_aarch64 {
# Is quiet in the UEFI config?
! grep "linux.*quiet" "$ISODIR/EFI/BOOT/grub.cfg" || fail "quiet not removed from UEFI grub.cfg cmdline entry"
}
# Test error if passing both --ks FILE and 3 arguments # Test error if passing both --ks FILE and 3 arguments
function test_two_kickstarts { function test_two_kickstarts {
running "Test two kickstart error" running "Test two kickstart error"