tests: Use tmt testing instead of STI

This also supports running the tests on aarch64.

Resolves: RHEL-50326
This commit is contained in:
Brian C. Lane 2022-01-31 16:33:53 -08:00
parent 095714aa20
commit 2c05da4ca9
5 changed files with 66 additions and 21 deletions

7
plans/build-iso.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: Run Lorax tests (build an iso, run mkksiso on it)
prepare:
how: install
package:
- lorax-templates-rhel
execute:
script: ./tests/scripts/run_tests.sh

View File

@ -1,5 +0,0 @@
---
standard-inventory-qcow2:
qemu:
m: 4G

View File

@ -1,6 +1,10 @@
#!/bin/bash
set -eux
ARCH=$(uname -m)
[ "$ARCH" == "x86_64" ] || [ "$ARCH" == "aarch64" ]
FAILANY=0
BOOTISO=/var/tmp/lorax-rhel9-iso/images/boot.iso
KSNAME=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/isolinux/isolinux.cfg" || fail "Missing isolinux.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/isolinux/isolinux.cfg" || fail "Missing isolinux.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"
@ -165,6 +211,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/isolinux/isolinux.cfg" || fail "quiet not removed from BIOS grub.cfg cmdline entry"
@ -172,6 +226,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"

View File

@ -1,16 +0,0 @@
---
# Run lorax with the new templates
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- lorax
- lorax-templates-rhel
tests:
- simple:
dir: scripts
run: ./run_tests.sh