From: Ben Crocker <bcrocker(a)redhat.com>
Check whether the ShellCheck package is installed; if it is
not installed, skip the test and print a message.
Signed-off-by: Ben Crocker <bcrocker(a)redhat.com>
---
redhat/self-test/0001-shellcheck.bats | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/redhat/self-test/0001-shellcheck.bats
b/redhat/self-test/0001-shellcheck.bats
index cac9e3ab7c29..0d838fd254e5 100644
--- a/redhat/self-test/0001-shellcheck.bats
+++ b/redhat/self-test/0001-shellcheck.bats
@@ -1,4 +1,8 @@
@test "shellcheck" {
- run shellcheck $(find $BATS_TEST_DIRNAME/.. -name "*.sh")
- [ "$status" = 0 ]
+ if ! dnf list installed ShellCheck >& /dev/null
+ then
+ skip "The ShellCheck package is not installed"
+ fi
+ run shellcheck $(find $BATS_TEST_DIRNAME/.. -name "*.sh")
+ [ "$status" = 0 ]
}
--
GitLab