From 74b29666492f7eaa513d1f8abf589137e75c9f33 Mon Sep 17 00:00:00 2001 From: Parag Nemade Date: Fri, 30 Aug 2024 09:24:44 +0530 Subject: [PATCH] Add tmt testcase for CI --- .fmf/version | 1 + plans/aspell.fmf | 5 +++++ tests/main.fmf | 12 ++++++++++++ tests/runtests.sh | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/aspell.fmf create mode 100644 tests/main.fmf create mode 100755 tests/runtests.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/aspell.fmf b/plans/aspell.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/aspell.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..507b196 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,12 @@ +test: ./runtests.sh +duration: 10m +framework: beakerlib +require: + - aspell + - perl + - make + - rpm-build + - chrpath + - gettext + - ncurses-devel + - pkgconfig diff --git a/tests/runtests.sh b/tests/runtests.sh new file mode 100755 index 0000000..551cefa --- /dev/null +++ b/tests/runtests.sh @@ -0,0 +1,38 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +NAME=aspell + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm ${NAME} + rlShowPackageVersion ${NAME} + rlRun -t -l "VERSION=$(rpm -q ${NAME} --queryformat='%{version}')" 0 "Get VERSION" + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "pushd $tmp" + rlFetchSrcForInstalled "${NAME}" + rlRun "rpm --define '_topdir $tmp' -i *src.rpm" + rlRun -t -l "mkdir BUILD" 0 "Creating BUILD directory" + rlRun -t -l "rpmbuild --noclean --nodeps --define '_topdir $tmp' -bp $tmp/SPECS/*spec" + if [ -d BUILD/${NAME}-${VERSION}-build ]; then + rlRun -t -l "pushd BUILD/${NAME}-${VERSION}-build/${NAME}-${VERSION}" + else + rlRun -t -l "pushd BUILD/${NAME}-${VERSION}" + fi + rlPhaseEnd + + rlPhaseStartTest + rlRun "set -o pipefail" + rlRun "pushd test" + rlRun "make sanity" + rlRun "retval=$?" + rlRun "echo $retval" + rlRun "popd" 0 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd +