From 19dc96e1107c2fa37234be3f8f2477b93e59a4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Thu, 17 Jun 2021 17:28:03 +0200 Subject: [PATCH] Resolves: rhbz#1974653 Convert test to tmt and beakerlib --- .fmf/version | 1 + plans/basic.fmf | 5 + tests/smoke/main.fmf | 18 ++ tests/smoke/runtest.sh | 385 +++++++++++++++++++---------------------- tests/tests.yml | 28 --- 5 files changed, 206 insertions(+), 231 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/basic.fmf create mode 100644 tests/smoke/main.fmf mode change 100644 => 100755 tests/smoke/runtest.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/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..dbe46a0 --- /dev/null +++ b/tests/smoke/main.fmf @@ -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 diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh old mode 100644 new mode 100755 index 48a3400..aa22874 --- a/tests/smoke/runtest.sh +++ b/tests/smoke/runtest.sh @@ -1,207 +1,186 @@ #!/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 \ - am:sera \ - ar:kbd \ - ar:translit \ - as:inscript \ - as:inscript2 \ - as:itrans \ - as:phonetic \ - ath:phonetic \ - bla:phonetic \ - bn:disha \ - bn:inscript \ - bn:inscript2 \ - bn:itrans \ - bn:probhat \ - bo:ewts \ - bo:tcrc \ - bo:wylie \ - brx:inscript2 \ - cr:western \ - da:post \ - doi:inscript2 \ - dv:phonetic \ - eo:h-fundamente \ - eo:h-sistemo \ - eo:plena \ - eo:q-sistemo \ - eo:vi-sistemo \ - eo:x-sistemo \ - fa:isiri \ - fr:azerty \ - grc:mizuochi \ - gu:inscript \ - gu:inscript2 \ - gu:itrans \ - gu:phonetic \ - hi:inscript \ - hi:inscript2 \ - hi:itrans \ - hi:optitransv2 \ - hi:phonetic \ - hi:remington \ - hi:typewriter \ - hi:vedmata \ - hu:rovas-post \ - ii:phonetic \ - iu:phonetic \ - kk:arabic \ - km:yannis \ - kn:inscript \ - kn:inscript2 \ - kn:itrans \ - kn:kgp \ - kn:optitransv2 \ - kn:typewriter \ - kok:inscript2 \ - ks:inscript \ - ks:kbd \ - lo:lrt \ - mai:inscript \ - mai:inscript2 \ - ml:enhanced-inscript \ - ml:inscript \ - ml:inscript2 \ - ml:itrans \ - ml:mozhi \ - ml:remington \ - ml:swanalekha \ - mni:inscript2-beng \ - mni:inscript2-mtei \ - mr:inscript \ - mr:inscript2 \ - mr:itrans \ - mr:phonetic \ - mr:remington \ - mr:typewriter \ - ne:inscript2 \ - ne:rom \ - ne:rom-translit \ - ne:trad \ - ne:trad-ttf \ - nsk:phonetic \ - oj:phonetic \ - or:inscript \ - or:inscript2 \ - or:itrans \ - or:phonetic \ - pa:anmollipi \ - pa:inscript \ - pa:inscript2 \ - pa:itrans \ - pa:jhelum \ - pa:phonetic \ - ps:phonetic \ - ru:phonetic \ - ru:translit \ - ru:yawerty \ - sa:IAST \ - sa:harvard-kyoto \ - sa:inscript2 \ - sa:itrans \ - sat:inscript2-deva \ - sat:inscript2-olck \ - sd:inscript \ - sd:inscript2 \ - si:phonetic-dynamic \ - si:samanala \ - si:sayura \ - si:singlish \ - si:sumihiri \ - si:transliteration \ - si:wijesekera \ - sv:post \ - t:latn-post \ - t:latn-pre \ - t:latn1-pre \ - t:lsymbol \ - t:math-latex \ - t:rfc1345 \ - t:ssymbol \ - t:syrc-phonetic \ - t:unicode \ - ta:inscript \ - ta:inscript2 \ - ta:itrans \ - ta:lk-renganathan \ - ta:phonetic \ - ta:tamil99 \ - ta:typewriter \ - ta:vutam \ - tai:sonla-kbd \ - te:apple \ - te:inscript \ - te:inscript2 \ - te:itrans \ - te:pothana \ - te:rts \ - te:sarala \ - th:kesmanee \ - th:pattachote \ - th:tis820 \ - ur:phonetic \ - vi:han \ - vi:nomtelex \ - vi:nomvni \ - vi:tcvn \ - vi:telex \ - 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 "m17n:${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} + 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 \ + as:inscript \ + as:inscript2 \ + as:itrans \ + as:phonetic \ + ath:phonetic \ + bla:phonetic \ + bn:disha \ + bn:inscript \ + bn:inscript2 \ + bn:itrans \ + bn:probhat \ + bo:ewts \ + bo:tcrc \ + bo:wylie \ + brx:inscript2 \ + cr:western \ + da:post \ + doi:inscript2 \ + dv:phonetic \ + eo:h-fundamente \ + eo:h-sistemo \ + eo:plena \ + eo:q-sistemo \ + eo:vi-sistemo \ + eo:x-sistemo \ + fa:isiri \ + fr:azerty \ + grc:mizuochi \ + gu:inscript \ + gu:inscript2 \ + gu:itrans \ + gu:phonetic \ + hi:inscript \ + hi:inscript2 \ + hi:itrans \ + hi:optitransv2 \ + hi:phonetic \ + hi:remington \ + hi:typewriter \ + hi:vedmata \ + hu:rovas-post \ + ii:phonetic \ + iu:phonetic \ + kk:arabic \ + km:yannis \ + kn:inscript \ + kn:inscript2 \ + kn:itrans \ + kn:kgp \ + kn:optitransv2 \ + kn:typewriter \ + kok:inscript2 \ + ks:inscript \ + ks:kbd \ + lo:lrt \ + mai:inscript \ + mai:inscript2 \ + ml:enhanced-inscript \ + ml:inscript \ + ml:inscript2 \ + ml:itrans \ + ml:mozhi \ + ml:remington \ + ml:swanalekha \ + mni:inscript2-beng \ + mni:inscript2-mtei \ + mr:inscript \ + mr:inscript2 \ + mr:itrans \ + mr:phonetic \ + mr:remington \ + mr:typewriter \ + ne:inscript2 \ + ne:rom \ + ne:rom-translit \ + ne:trad \ + ne:trad-ttf \ + nsk:phonetic \ + oj:phonetic \ + or:inscript \ + or:inscript2 \ + or:itrans \ + or:phonetic \ + pa:anmollipi \ + pa:inscript \ + pa:inscript2 \ + pa:itrans \ + pa:jhelum \ + pa:phonetic \ + ps:phonetic \ + ru:phonetic \ + ru:translit \ + ru:yawerty \ + sa:IAST \ + sa:harvard-kyoto \ + sa:inscript2 \ + sa:itrans \ + sat:inscript2-deva \ + sat:inscript2-olck \ + sd:inscript \ + sd:inscript2 \ + si:phonetic-dynamic \ + si:samanala \ + si:sayura \ + si:singlish \ + si:sumihiri \ + si:transliteration \ + si:wijesekera \ + sv:post \ + t:latn-post \ + t:latn-pre \ + t:latn1-pre \ + t:lsymbol \ + t:math-latex \ + t:rfc1345 \ + t:ssymbol \ + t:syrc-phonetic \ + t:unicode \ + ta:inscript \ + ta:inscript2 \ + ta:itrans \ + ta:lk-renganathan \ + ta:phonetic \ + ta:tamil99 \ + ta:typewriter \ + ta:vutam \ + tai:sonla-kbd \ + te:apple \ + te:inscript \ + te:inscript2 \ + te:itrans \ + te:pothana \ + te:rts \ + te:sarala \ + th:kesmanee \ + th:pattachote \ + th:tis820 \ + ur:phonetic \ + vi:han \ + vi:nomtelex \ + vi:nomvni \ + vi:tcvn \ + vi:telex \ + vi:viqr \ + vi:vni \ + yi:yivo + do + rlRun "/usr/libexec/ibus-engine-m17n --xml 2>/dev/null | grep 'm17n:${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 diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 65a5bc9..0000000 --- a/tests/tests.yml +++ /dev/null @@ -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