[OS-BUILD PATCHv6 3/8] redhat/self-test: 1005-dist-dump-variables.bats, initial commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Crocker <bcrocker@xxxxxxxxxx>

These four tests test the RPM version generation, name generation, and
snapshot designation for several previously chosen tags/commits.

The tags/commits chosen are:

a) v5.8
b) v5.8-rc7
c) v5.8-9-g565674d613d7
d) v5.8-rc5-99-g25ccd24ffd91

and the expected results are:
a) RPMVERSION = 5.8.0, no rc
b) RPMVERSION = 5.8.0, .rc7
c) RPMVERSION = 5.9.0, .rc0, snapshot
d) RPMVERSION = 5.8.0, .rc5, snapshot

Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx>
---
 .../self-test/1005-dist-dump-variables.bats   | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 redhat/self-test/1005-dist-dump-variables.bats

diff --git a/redhat/self-test/1005-dist-dump-variables.bats b/redhat/self-test/1005-dist-dump-variables.bats
new file mode 100644
index 000000000000..2ebea70baf59
--- /dev/null
+++ b/redhat/self-test/1005-dist-dump-variables.bats
@@ -0,0 +1,73 @@
+#!/usr/bin/env bats
+function get_rpmversion
+{
+        # ts = tag or sha1
+        ts=$1
+        RPMKVERSION=$(git show $ts:Makefile | sed -ne '/^VERSION\ =\ /{s///;p;q}')
+        RPMKPATCHLEVEL=$(git show $ts:Makefile | sed -ne '/^PATCHLEVEL\ =\ /{s///;p;q}')
+        RPMKSUBLEVEL=$(git show $ts:Makefile | sed -ne '/^SUBLEVEL\ =\ /{s///;p;q}')
+        RPMKEXTRAVERSION=$(git show $ts:Makefile | sed -ne '/^EXTRAVERSION\ =\ /{s///;p;q}')
+}
+
+function prologue()
+{
+    tag=$1
+    git show $tag:Makefile > Makefile
+    git add Makefile
+    git commit -m "Temporarily replace with $tag Makefile"
+    ofile=$BATS_TMPDIR/$tag.out
+    GIT=$BATS_TEST_DIRNAME/egit.sh EGIT_OVERRIDE_DESCRIBE=$tag DIST=.fc33 make dist-dump-variables > $ofile
+}
+
+function epilogue()
+{
+    git reset --hard HEAD^
+}
+
+@test "dist-dump-variables v5.8" {
+    tag=v5.8
+    prologue $tag
+    status=1
+    if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=" $ofile && grep -x "KEXTRAVERSION=" $ofile && grep -x "SNAPSHOT=0" $ofile
+    then
+        status=$?
+    fi
+    epilogue
+    [ "$status" = 0 ]
+}
+
+@test "dist-dump-variables v5.8-rc7" {
+    tag=v5.8-rc7
+    prologue $tag
+    status=1
+    if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=-rc7" $ofile && grep -x "KEXTRAVERSION=.rc7" $ofile && grep -x "SNAPSHOT=0" $ofile
+    then
+        status=$?
+    fi
+    epilogue
+    [ "$status" = 0 ]
+}
+
+@test "dist-dump-variables v5.8-9-g565674d613d7" {
+    tag=v5.8-9-g565674d613d7
+    prologue $tag
+    status=1
+    if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=9" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=" $ofile && grep -x "KEXTRAVERSION=.rc0" $ofile && grep -x "SNAPSHOT=1" $ofile
+    then
+        status=$?
+    fi
+    epilogue
+    [ "$status" = 0 ]
+}
+
+@test "dist-dump-variables v5.8-rc5-99-g25ccd24ffd91" {
+    tag=v5.8-rc5-99-g25ccd24ffd91
+    prologue $tag
+    status=1
+    if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=-rc5" $ofile && grep -x "KEXTRAVERSION=.rc5" $ofile && grep -x "SNAPSHOT=1" $ofile
+    then
+        status=$?
+    fi
+    epilogue
+    [ "$status" = 0 ]
+}
-- 
GitLab
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux