From b1e9101ac82897cf3aecb223a1f6f9e0154ada02 Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Thu, 1 Jul 2021 14:27:31 +0200 Subject: [PATCH] Convert CI tests to tmt --- .fmf/version | 1 + plans/basic.fmf | 5 ++++ tests/main.fmf | 13 ++++++++ tests/runtest.sh | 52 ++++++++++++++++++++++++++++++++ tests/scripts/run.sh | 70 -------------------------------------------- tests/tests.yml | 18 ------------ 6 files changed, 71 insertions(+), 88 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/basic.fmf create mode 100644 tests/main.fmf create mode 100755 tests/runtest.sh delete mode 100644 tests/scripts/run.sh delete mode 100644 tests/tests.yml 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/basic.fmf b/plans/basic.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/basic.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..788122c --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,13 @@ +test: ./runtest.sh +framework: beakerlib +duration: 10m +require: + - ibus + - ibus-table + - ibus-table-others + - ibus-table-code + - ibus-table-cyrillic + - ibus-table-latin + - ibus-table-translit + - ibus-table-tv + - ibus-table-mathwriter diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100755 index 0000000..b61cab7 --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,52 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "pushd $tmp" + rlAssertRpm "ibus" + rlAssertRpm "ibus-table" + rlAssertRpm "ibus-table-others" + rlAssertRpm "ibus-table-code" + rlAssertRpm "ibus-table-cyrillic" + rlAssertRpm "ibus-table-latin" + rlAssertRpm "ibus-table-translit" + rlAssertRpm "ibus-table-tv" + rlAssertRpm "ibus-table-mathwriter" + rlPhaseEnd + + rlPhaseStartTest + rlRun "ibus-daemon -v -r -d" + rlRun "sleep 5" 0 "Give ibus-daemon some time to start properly." + for name in \ + cns11643 \ + emoji-table \ + latex \ + rusle \ + rustrad \ + yawerty \ + compose \ + hu-old-hungarian-rovas \ + ipa-x-sampa \ + translit-ua \ + translit \ + telex \ + thai \ + viqr \ + vni \ + mathwriter-ibus + do + rlRun "/usr/libexec/ibus-engine-table --xml 2>/dev/null | grep 'table:${name}'" \ + 0 "checking whether 'ibus-engine-table --xml' can list table:${name}:" + + rlRun "ibus list-engine --name-only | grep 'table:${name}$'" \ + 0 "checking whether ibus can list table:${name}:" + done + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd diff --git a/tests/scripts/run.sh b/tests/scripts/run.sh deleted file mode 100644 index e96ab56..0000000 --- a/tests/scripts/run.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -FAIL_COUNTER=0 - -check_pkg() { - local pkg=$1 - if rpm -q $pkg - then - echo "PASS" - else - echo "FAIL" - let "FAIL_COUNTER=FAIL_COUNTER+1" - fi -} - - -check_pkg "ibus" -check_pkg "ibus-table" -check_pkg "ibus-table-code" -check_pkg "ibus-table-cyrillic" -check_pkg "ibus-table-latin" -check_pkg "ibus-table-translit" -check_pkg "ibus-table-tv" -check_pkg "ibus-table-mathwriter" - -echo "starting ibus-daemon." - -ibus-daemon -v -r -d - -if [ $? == 0 ] -then - echo "PASS" -else - echo "FAIL" - let "FAIL_COUNTER=FAIL_COUNTER+1" -fi - -echo "give ibus-daemon some time to start properly." -sleep 5 - -for name in \ - cns11643 \ - emoji-table \ - latex \ - rusle \ - rustrad \ - yawerty \ - compose \ - hu-old-hungarian-rovas \ - ipa-x-sampa \ - translit-ua \ - translit \ - telex \ - thai \ - viqr \ - vni \ - mathwriter-ibus -do - echo "checking whether ibus can list ${name}:" - ibus list-engine --name-only | grep "table:${name}" - if [ $? == 0 ] - then - echo "PASS" - else - echo "FAIL" - let "FAIL_COUNTER=FAIL_COUNTER+1" - fi -done - -exit ${FAIL_COUNTER} diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 3c51928..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,18 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - - ibus - - ibus-table - - ibus-table-code - - ibus-table-cyrillic - - ibus-table-latin - - ibus-table-translit - - ibus-table-tv - - ibus-table-mathwriter - tests: - - simple: - dir: scripts - run: bash run.sh