From 0afbc535b5216cba3b69677d13fc291b6da77b78 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Wed, 26 Jun 2024 13:45:39 +0200 Subject: [PATCH] Extract smoke tests out of test plan We want tests to be stored directly in the file system instead of being embedded into tests plans. --- plans/smoke.fmf | 21 +----------- tests/Sanity/smoke/main.fmf | 5 +++ tests/Sanity/smoke/runtest.sh | 64 +++++++++++++++++++++++++++++++++++ tests/main.fmf | 4 +++ 4 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 tests/Sanity/smoke/main.fmf create mode 100755 tests/Sanity/smoke/runtest.sh create mode 100644 tests/main.fmf diff --git a/plans/smoke.fmf b/plans/smoke.fmf index fa03fc2..a1e7bfd 100644 --- a/plans/smoke.fmf +++ b/plans/smoke.fmf @@ -1,24 +1,5 @@ summary: Basic smoke test discover: - how: shell - tests: - - name: /smoke/maven-version - test: /usr/libexec/javapackages-bootstrap/mvn --version - - name: /smoke/maven-home-version - test: /usr/share/javapackages-bootstrap/bin/mvn --version - - name: /smoke/xmvn-version - test: /usr/libexec/javapackages-bootstrap/xmvn --version - - name: /smoke/xmvn-install-help - test: /usr/libexec/javapackages-bootstrap/xmvn-install --help - - name: /smoke/xmvn-resolve-help - test: /usr/libexec/javapackages-bootstrap/xmvn-resolve --help - - name: /smoke/xmvn-subst-help - test: /usr/libexec/javapackages-bootstrap/xmvn-subst --help - - name: /smoke/ant-version - test: /usr/libexec/javapackages-bootstrap/ant -version - - name: /smoke/cup - test: echo 'non terminal bar; bar::=;' | /usr/libexec/javapackages-bootstrap/cup - - name: /smoke/jflex-version - test: /usr/libexec/javapackages-bootstrap/jflex -version + how: fmf execute: how: tmt diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf new file mode 100644 index 0000000..0a0133d --- /dev/null +++ b/tests/Sanity/smoke/main.fmf @@ -0,0 +1,5 @@ +summary: javapackages-bootstrap smoke test +description: | + Test basic functionality of javapackages-bootstrap. +require: + - javapackages-bootstrap diff --git a/tests/Sanity/smoke/runtest.sh b/tests/Sanity/smoke/runtest.sh new file mode 100755 index 0000000..a30050d --- /dev/null +++ b/tests/Sanity/smoke/runtest.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Author: Mikolaj Izdebski +. /usr/share/beakerlib/beakerlib.sh + +rlJournalStart + + PATH="/usr/libexec/javapackages-bootstrap:$PATH" + + rlPhaseStartTest "check for presence of libexec binaries" + rlAssertRpm javapackages-bootstrap + rlAssertBinaryOrigin mvn javapackages-bootstrap + rlAssertBinaryOrigin xmvn javapackages-bootstrap + rlAssertBinaryOrigin xmvn-install javapackages-bootstrap + rlAssertBinaryOrigin xmvn-resolve javapackages-bootstrap + rlAssertBinaryOrigin xmvn-subst javapackages-bootstrap + rlAssertBinaryOrigin ant javapackages-bootstrap + rlAssertBinaryOrigin cup javapackages-bootstrap + rlAssertBinaryOrigin jflex javapackages-bootstrap + rlPhaseEnd + + rlPhaseStartTest "display mvn version" + rlRun -s "mvn --version" + rlAssertGrep "Red Hat XMvn" $rlRun_LOG + rlAssertGrep "XMvn home: /usr/share/javapackages-bootstrap" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display xmvn version" + rlRun -s "xmvn --version" + rlAssertGrep "Red Hat XMvn" $rlRun_LOG + rlAssertGrep "XMvn home: /usr/share/javapackages-bootstrap" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display xmvn-install help" + rlRun -s "xmvn-install --help" + rlAssertGrep "Usage: xmvn-install" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display xmvn-resolve help" + rlRun -s "xmvn-resolve --help" + rlAssertGrep "Usage: xmvn-resolve" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display xmvn-subst help" + rlRun -s "xmvn-subst --help" + rlAssertGrep "Usage: xmvn-subst" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display ant version" + rlRun -s "ant -version" + rlAssertGrep "Apache Ant(TM) version" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display cup version" + rlRun -s "cup -version" 1 + rlAssertGrep "CUP v" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "display jflex version" + rlRun -s "jflex --version" + rlAssertGrep "This is JFlex" $rlRun_LOG + rlPhaseEnd + +rlJournalEnd +rlJournalPrintText diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..99fd67e --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,4 @@ +contact: Mikolaj Izdebski +framework: beakerlib +test: ./runtest.sh +tier: 0