From c1846554ee0490aaf6bd47ab0fe37fa0f4edca3e Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@icinga.com>
Date: Thu, 7 May 2020 08:40:52 +0200
Subject: [PATCH] Support custom test scripts passed to the command line

`... icinga-build-test testing/live_test.sh`
---
 icinga-build-deb-test | 4 +++-
 icinga-build-rpm-test | 4 +++-
 icinga-build-test     | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/icinga-build-deb-test b/icinga-build-deb-test
index 36489ba..8790656 100755
--- a/icinga-build-deb-test
+++ b/icinga-build-deb-test
@@ -20,7 +20,9 @@ fi
 )
 
 test_script=
-if [ -f "${ICINGA_BUILD_DEB_FLAVOR}/debian/icinga-build-test" ]; then
+if [ -n "$@" ]; then
+  test_script="$@"
+elif [ -f "${ICINGA_BUILD_DEB_FLAVOR}/debian/icinga-build-test" ]; then
   test_script="${ICINGA_BUILD_DEB_FLAVOR}/debian/icinga-build-test"
 elif [ -f "debian/icinga-build-test" ]; then
   test_script="debian/icinga-build-test"
diff --git a/icinga-build-rpm-test b/icinga-build-rpm-test
index 602aa14..030793a 100755
--- a/icinga-build-rpm-test
+++ b/icinga-build-rpm-test
@@ -57,7 +57,9 @@ REPO
 esac
 
 test_script=
-if [ -f "icinga-build-test" ]; then
+if [ -n "$@" ]; then
+  test_script="$@"
+elif [ -f "icinga-build-test" ]; then
   test_script="./icinga-build-test"
 elif [ -f "${WORKDIR}/testing/start_test.sh" ]; then
   test_script="${WORKDIR}/testing/start_test.sh"
diff --git a/icinga-build-test b/icinga-build-test
index 10191b8..27b3810 100755
--- a/icinga-build-test
+++ b/icinga-build-test
@@ -7,7 +7,7 @@ FILES_DEBIAN="$(ls -d ./debian ./*/debian 2>/dev/null)"
 if [ -n "${FILES_SPEC}" ]; then
   echo "Detected RPM source: ${FILES_SPEC}"
   echo
-  if ! icinga-build-rpm-test; then
+  if ! icinga-build-rpm-test "$@"; then
     echo "[ test failed! ]"
     exit 1
   fi
@@ -15,7 +15,7 @@ if [ -n "${FILES_SPEC}" ]; then
 elif [ -n "${FILES_DEBIAN}" ]; then
   echo "Detected Debian packaging paths: ${FILES_DEBIAN}"
   echo
-  if ! icinga-build-deb-test; then
+  if ! icinga-build-deb-test "$@"; then
     echo "[ test failed! ]"
     exit 1
   fi
-- 
GitLab