cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0019-tests-add-noskip-commands.patch

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