]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add --noskip-commands
authorKarel Zak <kzak@redhat.com>
Tue, 5 Mar 2019 10:06:41 +0000 (11:06 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 5 Mar 2019 10:06:41 +0000 (11:06 +0100)
The default is SKIP missing commands on --use-system-commands, but
with --noskip-commands the test will FAIL.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests/functions.sh
tests/run.sh

index ab607c4ced47b213f27c2293abbf0de7c929b782..0605a1320a5311a5380af666e8b2a1f0c5ef2a4b 100644 (file)
@@ -85,7 +85,13 @@ function ts_check_test_command {
        *)
                # just command names (e.g. --use-system-commands)
                local cmd=$1
-               type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
+               type "$cmd" >/dev/null 2>&1
+               if [ $? -ne 0 ]; then
+                       if [ "$TS_NOSKIP_COMMANDS" = "yes" ]; then
+                               ts_failed "missing in PATH: $cmd"
+                       fi
+                       ts_skip "missing in PATH: $cmd"
+               fi
                ;;
        esac
 }
@@ -301,6 +307,7 @@ function ts_init_env {
 
        ts_init_core_env
 
+       TS_NOSKIP_COMMANDS=$(ts_has_option "noskip-commands" "$*")
        TS_VERBOSE=$(ts_has_option "verbose" "$*")
        TS_SHOWDIFF=$(ts_has_option "show-diff" "$*")
        TS_PARALLEL=$(ts_has_option "parallel" "$*")
index 881148a0640e9c5d762852a4e1b836e09e882449..2a71331490560982d960308c29deae1b85078e45 100755 (executable)
@@ -65,6 +65,7 @@ while [ -n "$1" ]; do
        --show-diff |\
        --verbose  |\
        --skip-loopdevs |\
+       --noskip-commands |\
        --parsable)
                # these options are simply forwarded to the test scripts
                OPTS="$OPTS $1"
@@ -113,6 +114,7 @@ while [ -n "$1" ]; do
                echo "  --show-diff           show diff from failed tests"
                echo "  --nonroot             ignore test suite if user is root"
                echo "  --use-system-commands use PATH rather than builddir"
+               echo "  --noskip-commands     fail on missing commands"
                echo "  --srcdir=<path>       autotools top source directory"
                echo "  --builddir=<path>     autotools top build directory"
                echo "  --parallel=<num>      number of parallel test jobs, default: num cpus"