diff --git a/gating.yaml b/gating.yaml index 0d484d7..7b6e38f 100644 --- a/gating.yaml +++ b/gating.yaml @@ -5,4 +5,5 @@ decision_contexts: - bodhi_update_push_testing - bodhi_update_push_stable rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional} - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional} diff --git a/plans/smoke.fmf b/plans/smoke.fmf new file mode 100644 index 0000000..c979bd9 --- /dev/null +++ b/plans/smoke.fmf @@ -0,0 +1,5 @@ +summary: Run smoke tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..9e2ea10 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,4 @@ +contact: Mikolaj Izdebski +framework: beakerlib +test: ./runtest.sh +tier: 1 diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..d35e96d --- /dev/null +++ b/tests/smoke/main.fmf @@ -0,0 +1,7 @@ +summary: XMvn Generator smoke test +description: | + Test basic functionality of XMvn Generator. +require: + - rpm-build + - javapackages-local + - java-17-openjdk-devel diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100755 index 0000000..8ef024a --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Author: Mikolaj Izdebski +. /usr/share/beakerlib/beakerlib.sh + +rlJournalStart + + rlPhaseStartSetup + rlAssertRpm xmvn-generator + rlAssertRpm javapackages-local + rlAssertRpm rpm-build + rlAssertRpm java-17-openjdk-devel + rlPhaseEnd + + rlPhaseStartTest + rlRun -s "rpmbuild -D '%_topdir %{lua:print(posix.getcwd())}' -D '%_sourcedir %{_topdir}' -D '%_builddir %{_topdir}/build' -D '%_srcrpmdir %{_topdir}' -D '%_rpmdir %{_topdir}' -D '__xmvngen_debug 1' -ba testpkg.spec" + rlAssertGrep "^INSTALL DONE$" $rlRun_LOG + rpm=noarch/testpkg-1.2.3-1.fc22.noarch.rpm + rlAssertExists $rpm + rlRun -s "rpm -qp $rpm --provides" + rlAssertGrep "^jpms(foo.module)$" $rlRun_LOG + rlRun "rpm2cpio $rpm | cpio -id" + rlAssertExists usr/share/java/sub/some.jar + rlRun "jar xf usr/share/java/sub/some.jar" + rlAssertExists file.txt + rlAssertExists META-INF/MANIFEST.MF + rlAssertGrep "^Automatic-Module-Name: foo.module" META-INF/MANIFEST.MF + rlAssertGrep "^Rpm-Name: testpkg" META-INF/MANIFEST.MF + rlAssertGrep "^Rpm-Epoch: 42" META-INF/MANIFEST.MF + rlAssertGrep "^Rpm-Version: 1.2.3" META-INF/MANIFEST.MF + rlAssertGrep "^Rpm-Release: 1.fc22" META-INF/MANIFEST.MF + rlPhaseEnd + +rlJournalEnd +rlJournalPrintText diff --git a/tests/smoke/testpkg.spec b/tests/smoke/testpkg.spec new file mode 100644 index 0000000..2d23874 --- /dev/null +++ b/tests/smoke/testpkg.spec @@ -0,0 +1,24 @@ +Name: testpkg +Epoch: 42 +Version: 1.2.3 +Release: 1.fc22 +Summary: test package +License: DUMMY +URL: file:/dev/null +BuildArch: noarch + +%description +test package + +%install +touch file.txt +echo Automatic-Module-Name: foo.module >mf +echo Rpm-Version: 4.5.6 >>mf +jar cfm out.jar mf file.txt +install -D out.jar %{buildroot}%{_javadir}/sub/some.jar +echo INSTALL DONE + +%files +%{_javadir} + +%changelog