Add test for rebuilding qmeu

This commit is contained in:
Tom Stellard 2024-11-02 21:24:47 +00:00
commit dec0f4d3da
3 changed files with 41 additions and 0 deletions

17
tests/lib.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
function llvmRebuildPackage() {
local pkg=$1
rlRun "dnf download --source $pkg"
rlRun "koji_srpm=$(ls $pkg*.src.rpm)"
# We need to rebuild the source RPM, so that we get the correct BuildRequires
# for this platform.
rlRun "rpmbuild -D 'toolchain clang' -rs --nodeps $koji_srpm"
rlRun "srpm=$(ls $HOME/rpmbuild/SRPMS/$pkg*.src.rpm)"
rlRun "dnf builddep -y $srpm"
rlRun "rpmbuild -D 'toolchain clang' --rebuild $srpm"
}

View file

@ -0,0 +1,11 @@
summary: Rebuild the qemu package
framework: beakerlib
duration: 5h
tier: 1
require+:
- clang
- rpm-build
- type: file
pattern:
- lib.sh

13
tests/rebuild-qemu/test.sh Executable file
View file

@ -0,0 +1,13 @@
# This also sources the beakerlib helpers
. "$TMT_TREE/tests/lib.sh" || exit 1
rlJournalStart
rlPhaseStartTest
rlRun "env"
# TODO: I think it would be better to pass the $distro variable here
# explicitly, but I couldn't figure out how to put the distro context
# value from tmt into an environment variable.
rlRun "llvmRebuildPackage qemu"
rlPhaseEnd
rlJournalEnd