diff --git a/tests/lib.sh b/tests/lib.sh new file mode 100644 index 0000000..acf7482 --- /dev/null +++ b/tests/lib.sh @@ -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" +} diff --git a/tests/rebuild-qemu/main.fmf b/tests/rebuild-qemu/main.fmf new file mode 100644 index 0000000..6e4b838 --- /dev/null +++ b/tests/rebuild-qemu/main.fmf @@ -0,0 +1,11 @@ +summary: Rebuild the qemu package +framework: beakerlib +duration: 5h +tier: 1 + +require+: + - clang + - rpm-build + - type: file + pattern: + - lib.sh diff --git a/tests/rebuild-qemu/test.sh b/tests/rebuild-qemu/test.sh new file mode 100755 index 0000000..17cc6a2 --- /dev/null +++ b/tests/rebuild-qemu/test.sh @@ -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