From d5bb31f40325f41caf0c3f76a071d8b776cb652d Mon Sep 17 00:00:00 2001 From: sshil Date: Tue, 16 Jul 2024 15:12:44 +0530 Subject: [PATCH] ci tests for c10s Resolves: RHELMISC-5983 --- .fmf/version | 2 ++ plans/basic.fmf | 5 +++++ tests/gnome_characters_test.py | 22 ++++++++++++++++++++++ tests/main.fmf | 8 ++++++++ tests/runtest.sh | 29 +++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/basic.fmf create mode 100755 tests/gnome_characters_test.py create mode 100644 tests/main.fmf create mode 100755 tests/runtest.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d474e1b --- /dev/null +++ b/.fmf/version @@ -0,0 +1,2 @@ +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/gnome_characters_test.py b/tests/gnome_characters_test.py new file mode 100755 index 0000000..f5d25ef --- /dev/null +++ b/tests/gnome_characters_test.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +import unittest +from gi import require_version +require_version('Gc', '1.0') +from gi.repository import Gc + + +class TestGnomeCharacters(unittest.TestCase): + + def test_dummy(self): + self.assertEqual(True, True) + + @unittest.expectedFailure + def test_expected_failure(self): + self.assertEqual('BLACK SMILING FACE', Gc.character_name("☺")) + + def test_character_name(self): + self.assertEqual('WHITE SMILING FACE', Gc.character_name("☺")) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..92b55d6 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,8 @@ +test: ./runtest.sh +duration: 50m +framework: beakerlib +require: + - gnome-characters + - desktop-file-utils + - gtk3-devel + - python3-gobject diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100755 index 0000000..4fa06c4 --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,29 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +NAME=gnome-characters + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm gnome-characters + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "cp gnome_characters_test.py $tmp" + rlRun "pushd $tmp" + rlPhaseEnd + + rlPhaseStartTest + rlRun -t -s "env LD_LIBRARY_PATH=/usr/lib64/org.gnome.Characters GI_TYPELIB_PATH=/usr/lib/girepository-1.0:/usr/lib64/org.gnome.Characters/girepository-1.0 ./gnome_characters_test.py -v" 0 "Running test cases" + echo "==== START of `cat ${rlRun_LOG}`: log of ${test_file} ====" + cat ${rlRun_LOG} + echo "==== END of `cat ${rlRun_LOG}`: log of ${test_file} ====" + rlAssertNotGrep FAIL ${rlRun_LOG} + rlGetTestState + rlLog "Number of failed asserts so far: ${ECODE}" + rlFileSubmit ${rlRun_LOG} + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd