Add tmt testcase for CI

This commit is contained in:
Parag Nemade 2024-08-28 19:09:04 +05:30
parent 3ac335ee2f
commit 2a5491dd6f
No known key found for this signature in database
GPG Key ID: 71932951EB71E972
10 changed files with 58 additions and 9 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
plans/fontforge.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

5
tests/main.fmf Normal file
View File

@ -0,0 +1,5 @@
require:
- fontforge
test: bash ./run_tests.sh
framework: shell

0
tests/scripts/run_tests.sh → tests/run_tests.sh Normal file → Executable file
View File

47
tests/runtests.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
NAME=fontforge
rlJournalStart
rlPhaseStartSetup
rlAssertRpm ${NAME}
rlAssertRpm ${NAME}-devel
rlShowPackageVersion ${NAME}
rlRun -t -l "VERSION=$(rpm -q ${NAME} --queryformat='%{version}')" 0 "Get VERSION"
FEDORA_VERSION=$(rlGetDistroRelease)
rlLog "FEDORA_VERSION=${DISTRO_RELEASE}"
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
rlRun "set -o pipefail"
rlRun "NOCONFIGURE=1 ./autogen.sh"
rlRun "./configure --disable-static --with-graphite2 --with-gobject --enable-introspection"
rlRun "make check"
rlRun "retval=$?"
rlRun "echo $retval"
rlPhaseEnd
rlPhaseStartTest
rlRun -t -l "INSTALLED_VERSION=$(hb-info --version|awk 'NR==1 {print $3}')" \
0 "Get installed version"
rlAssertEquals "versions should be equal" "${VERSION}" "${INSTALLED_VERSION}"
rlGetTestState
rlLog "Number of failed asserts so far: ${ECODE}"
rlRun "popd" 0
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

View File

@ -1,9 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
tests:
- simple:
dir: scripts/
run: ./run_tests.sh