From 0c97e99906460c9aee2c817a1e438b7c0e6ee431 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 23 Jul 2024 17:44:58 -0700 Subject: [PATCH] tests: Add support for testing on aarch64 This changes how tests are run based on the host's arch. Resolves: RHEL-50327 --- tests/scripts/run_tests.sh | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index 9dd5452..884eeac 100755 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -1,6 +1,10 @@ #!/bin/bash set -eux +ARCH=$(uname -m) +[ "$ARCH" == "x86_64" ] || [ "$ARCH" == "aarch64" ] + + FAILANY=0 BOOTISO=/var/tmp/lorax-rhel10-iso/images/boot.iso KSNAME=fedora-minimal.ks @@ -64,6 +68,14 @@ function ks_pos_only { } 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 # Is there a kickstart in / of the iso? [ -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" } +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 function ks_serial { running "Add kickstart and serial cmdline" @@ -103,7 +124,14 @@ function only_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? 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" } +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 function new_volid { running "Use a new VOLID" @@ -126,6 +159,14 @@ function new_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? 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" } +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 function add_files { running "Add files" @@ -161,6 +207,14 @@ function remove_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? ! 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" } +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 function test_two_kickstarts { running "Test two kickstart error"