Convert test to tmt and beakerlib

This commit is contained in:
Petr Šplíchal 2021-06-17 17:28:03 +02:00
parent 06e068bcd1
commit 88d0a1f993
5 changed files with 206 additions and 231 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
plans/basic.fmf Normal file
View File

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

18
tests/smoke/main.fmf Normal file
View File

@ -0,0 +1,18 @@
test: ./runtest.sh
framework: beakerlib
require:
- gcc
- make
- gnome-common
- autoconf
- automake
- gettext-devel
- ibus
- ibus-devel
- gtk3-devel
- pkgconfig
- libtool
- m17n-lib-devel
- m17n-db
- ibus-m17n
- rpm-build

87
tests/smoke/runtest.sh Normal file → Executable file
View File

@ -1,50 +1,27 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
FAIL_COUNTER=0
rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
rlFetchSrcForInstalled "ibus-m17n"
rlRun "rpm --define '_topdir $tmp' -i *src.rpm"
rlRun "mkdir BUILD" 0 "Creating BUILD directory"
rlRun "rpmbuild --nodeps --define '_topdir $tmp' -bp $tmp/SPECS/*spec"
rlRun "pushd BUILD/ibus-m17n*"
rlRun "set -o pipefail"
rlRun "NOCONFIGURE=1 ./autogen.sh"
rlRun "./configure --disable-static --with-gtk=3.0"
rlRun "make check"
rlAssertRpm "ibus"
rlAssertRpm "m17n-db"
rlPhaseEnd
check_pkg() {
local pkg=$1
if rpm -q $pkg
then
echo "PASS"
else
echo "FAIL"
let "FAIL_COUNTER=FAIL_COUNTER+1"
fi
}
check_return_value () {
if [ $1 == 0 ]
then
echo "PASS"
else
echo "FAIL"
let "FAIL_COUNTER=FAIL_COUNTER+1"
fi
}
pushd ../source
echo "---Start autogen.sh---"
NOCONFIGURE=1 ./autogen.sh
echo "---End autogen.sh---"
echo "--------------------"
./configure --disable-static --with-gtk=3.0
make check
check_return_value $?
popd
check_pkg "ibus"
check_pkg "m17n-db"
ibus-daemon -v -r -d
check_return_value $?
echo "give ibus-daemon some time to start properly."
sleep 5
for name in \
rlPhaseStartTest
rlRun "ibus-daemon -v -r -d"
rlRun "sleep 5" 0 "Give ibus-daemon some time to start properly."
for name in \
am:sera \
ar:kbd \
ar:translit \
@ -194,14 +171,16 @@ for name in \
vi:viqr \
vi:vni \
yi:yivo
do
echo "checking whether 'ibus-engine-m17n --xml' can list m17n:${name}:"
/usr/libexec/ibus-engine-m17n --xml 2>/dev/null | grep "<name>m17n:${name}</name>"
check_return_value $?
echo "checking whether ibus can list m17n:${name}:"
ibus list-engine --name-only | grep "m17n:${name}$"
check_return_value $?
done
exit ${FAIL_COUNTER}
do
rlRun "/usr/libexec/ibus-engine-m17n --xml 2>/dev/null | grep '<name>m17n:${name}</name>'" \
0 "checking whether 'ibus-engine-m17n --xml' can list m17n:${name}:"
rlRun "ibus list-engine --name-only | grep 'm17n:${name}$'" \
0 "checking whether ibus can list m17n:${name}:"
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd; popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

View File

@ -1,28 +0,0 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- smoke
required_packages:
- gcc
- make
- gnome-common
- autoconf
- automake
- gettext-devel
- ibus
- ibus-devel
- gtk3-devel
- pkgconfig
- libtool
- m17n-lib-devel
- m17n-db