Add tmt testcase for CI

This commit is contained in:
Parag Nemade 2024-08-28 13:31:47 +05:30
parent 530f21bb97
commit 4ed1eb9d75
No known key found for this signature in database
GPG Key ID: 71932951EB71E972
6 changed files with 51 additions and 20 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
plans/convmv.fmf Normal file
View File

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

8
tests/main.fmf Normal file
View File

@ -0,0 +1,8 @@
test: ./runtests.sh
duration: 10m
framework: beakerlib
require:
- convmv
- perl
- make
- rpm-build

37
tests/runtests.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
NAME=convmv
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 "make V=1 test"
rlRun "retval=$?"
rlRun "echo $retval"
rlRun "popd" 0
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd ../source
make V=1 test

View File

@ -1,17 +0,0 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- smoke
required_packages:
- perl
- make