From: Ben Crocker <bcroc...@redhat.com>

1003-rpminspect.bats: initial commit.

Like the 1001-rpmlint.bats test, this test
• tests for exactly one SRPM
• runs rpminspect (instead of rpmlint) on that SRPM,
  after checking for the presence of the /usr/bin/rpminspect.

Both 1001-rpmlint.bats and 1003-rpminspect.bats
Check via 'test -x' whether the /usr/bin/rpmlint or rpminspect,
respectively, is installed; if not, skip the test and print a message.

For now, skip both tests entirely, pending fixes to kernel.spec.template.

Signed-off-by: Ben Crocker <bcroc...@redhat.com>
---
 redhat/self-test/1001-rpmlint.bats    | 12 +++++++++---
 redhat/self-test/1003-rpminspect.bats | 17 +++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 redhat/self-test/1003-rpminspect.bats

diff --git a/redhat/self-test/1001-rpmlint.bats 
b/redhat/self-test/1001-rpmlint.bats
index bd0d8d1bcc24..6329fb0dc0a2 100644
--- a/redhat/self-test/1001-rpmlint.bats
+++ b/redhat/self-test/1001-rpmlint.bats
@@ -5,7 +5,13 @@
 }
 
 @test "rpmlint" {
-      srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
-      run rpmlint $srpm
-      [ "$status" = 0 ]
+    if ! test -x /usr/bin/rpmlint
+    then
+        skip "The rpmlint package is not installed"
+    else
+        skip "Skip rpmlint test pending kernel.spec.template changes"
+    fi
+    srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
+    run rpmlint $srpm
+    [ "$status" = 0 ]
 }
diff --git a/redhat/self-test/1003-rpminspect.bats 
b/redhat/self-test/1003-rpminspect.bats
new file mode 100644
index 000000000000..85194f8c083d
--- /dev/null
+++ b/redhat/self-test/1003-rpminspect.bats
@@ -0,0 +1,17 @@
+#!/usr/bin/env bats
+@test "Exactly one SRPM exists" {
+    result=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+    [ "$result" = 1 ]
+}
+
+@test "rpminspect" {
+    if ! test -x /usr/bin/rpminspect
+    then
+        skip "The rpminspect package is not installed"
+    else
+        skip "Skip rpminspect test pending fixes"
+    fi
+    srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
+    run rpminspect $srpm
+    [ "$status" = 0 ]
+}
-- 
GitLab
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org

Reply via email to