dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
069435
From 9e92f2ff939a885b70d3a5d20e8c94f6e41e821b Mon Sep 17 00:00:00 2001
069435
From: Karel Zak <kzak@redhat.com>
069435
Date: Tue, 5 Mar 2019 11:06:41 +0100
069435
Subject: [PATCH 19/19] tests: add --noskip-commands
069435
069435
The default is SKIP missing commands on --use-system-commands, but
069435
with --noskip-commands the test will FAIL.
069435
069435
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
069435
Upstream: http://github.com/karelzak/util-linux/commit/7c90efa384cbb2ace873e2b90e8cc396a1719535
069435
Signed-off-by: Karel Zak <kzak@redhat.com>
069435
---
069435
 tests/functions.sh | 9 ++++++++-
069435
 tests/run.sh       | 2 ++
069435
 2 files changed, 10 insertions(+), 1 deletion(-)
069435
069435
diff --git a/tests/functions.sh b/tests/functions.sh
069435
index ab607c4ce..0605a1320 100644
069435
--- a/tests/functions.sh
069435
+++ b/tests/functions.sh
069435
@@ -85,7 +85,13 @@ function ts_check_test_command {
069435
 	*)
069435
 		# just command names (e.g. --use-system-commands)
069435
 		local cmd=$1
069435
-		type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
069435
+		type "$cmd" >/dev/null 2>&1
069435
+	        if [ $? -ne 0 ]; then
069435
+			if [ "$TS_NOSKIP_COMMANDS" = "yes" ]; then
069435
+				ts_failed "missing in PATH: $cmd"
069435
+			fi
069435
+			ts_skip "missing in PATH: $cmd"
069435
+		fi
069435
 		;;
069435
 	esac
069435
 }
069435
@@ -301,6 +307,7 @@ function ts_init_env {
069435
 
069435
 	ts_init_core_env
069435
 
069435
+	TS_NOSKIP_COMMANDS=$(ts_has_option "noskip-commands" "$*")
069435
 	TS_VERBOSE=$(ts_has_option "verbose" "$*")
069435
 	TS_SHOWDIFF=$(ts_has_option "show-diff" "$*")
069435
 	TS_PARALLEL=$(ts_has_option "parallel" "$*")
069435
diff --git a/tests/run.sh b/tests/run.sh
069435
index 28f8ee25a..e8328cc5d 100755
069435
--- a/tests/run.sh
069435
+++ b/tests/run.sh
069435
@@ -65,6 +65,7 @@ while [ -n "$1" ]; do
069435
 	--show-diff |\
069435
 	--verbose  |\
069435
 	--skip-loopdevs |\
069435
+	--noskip-commands |\
069435
 	--parsable)
069435
 		# these options are simply forwarded to the test scripts
069435
 		OPTS="$OPTS $1"
069435
@@ -113,6 +114,7 @@ while [ -n "$1" ]; do
069435
 		echo "  --show-diff           show diff from failed tests"
069435
 		echo "  --nonroot             ignore test suite if user is root"
069435
 		echo "  --use-system-commands use PATH rather than builddir"
069435
+		echo "  --noskip-commands     fail on missing commands"
069435
 		echo "  --srcdir=<path>       autotools top source directory"
069435
 		echo "  --builddir=<path>     autotools top build directory"
069435
 		echo "  --parallel=<num>      number of parallel test jobs, default: num cpus"
069435
-- 
069435
2.20.1
069435