From 2a5491dd6f4fe1a0e82fcfdf49ed679050d86101 Mon Sep 17 00:00:00 2001 From: Parag Nemade Date: Wed, 28 Aug 2024 19:09:04 +0530 Subject: [PATCH] Add tmt testcase for CI --- .fmf/version | 1 + plans/fontforge.fmf | 5 +++ tests/{scripts => }/generate-font.py | 0 tests/{scripts => }/generate-sfd.pe | 0 tests/{scripts => }/generate-ttf.pe | 0 tests/{scripts => }/get-font-metadata.py | 0 tests/main.fmf | 5 +++ tests/{scripts => }/run_tests.sh | 0 tests/runtests.sh | 47 ++++++++++++++++++++++++ tests/tests.yml | 9 ----- 10 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/fontforge.fmf rename tests/{scripts => }/generate-font.py (100%) rename tests/{scripts => }/generate-sfd.pe (100%) rename tests/{scripts => }/generate-ttf.pe (100%) rename tests/{scripts => }/get-font-metadata.py (100%) create mode 100644 tests/main.fmf rename tests/{scripts => }/run_tests.sh (100%) mode change 100644 => 100755 create mode 100755 tests/runtests.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/fontforge.fmf b/plans/fontforge.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/fontforge.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/scripts/generate-font.py b/tests/generate-font.py similarity index 100% rename from tests/scripts/generate-font.py rename to tests/generate-font.py diff --git a/tests/scripts/generate-sfd.pe b/tests/generate-sfd.pe similarity index 100% rename from tests/scripts/generate-sfd.pe rename to tests/generate-sfd.pe diff --git a/tests/scripts/generate-ttf.pe b/tests/generate-ttf.pe similarity index 100% rename from tests/scripts/generate-ttf.pe rename to tests/generate-ttf.pe diff --git a/tests/scripts/get-font-metadata.py b/tests/get-font-metadata.py similarity index 100% rename from tests/scripts/get-font-metadata.py rename to tests/get-font-metadata.py diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..542903b --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,5 @@ +require: +- fontforge +test: bash ./run_tests.sh +framework: shell + diff --git a/tests/scripts/run_tests.sh b/tests/run_tests.sh old mode 100644 new mode 100755 similarity index 100% rename from tests/scripts/run_tests.sh rename to tests/run_tests.sh diff --git a/tests/runtests.sh b/tests/runtests.sh new file mode 100755 index 0000000..a94d8f5 --- /dev/null +++ b/tests/runtests.sh @@ -0,0 +1,47 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +NAME=fontforge + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm ${NAME} + rlAssertRpm ${NAME}-devel + rlShowPackageVersion ${NAME} + rlRun -t -l "VERSION=$(rpm -q ${NAME} --queryformat='%{version}')" 0 "Get VERSION" + FEDORA_VERSION=$(rlGetDistroRelease) + rlLog "FEDORA_VERSION=${DISTRO_RELEASE}" + 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 + rlRun "set -o pipefail" + rlRun "NOCONFIGURE=1 ./autogen.sh" + rlRun "./configure --disable-static --with-graphite2 --with-gobject --enable-introspection" + rlRun "make check" + rlRun "retval=$?" + rlRun "echo $retval" + rlPhaseEnd + + rlPhaseStartTest + rlRun -t -l "INSTALLED_VERSION=$(hb-info --version|awk 'NR==1 {print $3}')" \ + 0 "Get installed version" + rlAssertEquals "versions should be equal" "${VERSION}" "${INSTALLED_VERSION}" + rlGetTestState + rlLog "Number of failed asserts so far: ${ECODE}" + rlRun "popd" 0 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "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 aaf3946..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,9 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - tests: - - simple: - dir: scripts/ - run: ./run_tests.sh