summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2021-12-03 04:25:54 +0000
committerRobert Mustacchi <rm@fingolfin.org>2022-01-15 00:41:16 +0000
commitfff59a0859385717fd41a0edf704de81c340ad00 (patch)
tree943c17a22c300bab90945bcb12d95033a882d529 /usr/src
parent097e441f24cafd9118111f7b1b6ca3f00e5bb03f (diff)
downloadillumos-gate-fff59a0859385717fd41a0edf704de81c340ad00.tar.gz
14288 mdbtest finds no tests when invoked by test runner
Reviewed by: Yuri Pankov <ypankov@tintri.com> Approved by: Rich Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rwxr-xr-xusr/src/test/util-tests/tests/mdb/mdbtest23
1 files changed, 16 insertions, 7 deletions
diff --git a/usr/src/test/util-tests/tests/mdb/mdbtest b/usr/src/test/util-tests/tests/mdb/mdbtest
index 96ffdc4c2d..3b353619c4 100755
--- a/usr/src/test/util-tests/tests/mdb/mdbtest
+++ b/usr/src/test/util-tests/tests/mdb/mdbtest
@@ -12,6 +12,7 @@
#
# Copyright 2020 Joyent, Inc.
+# Copyright 2021 Oxide Computer Company
#
#
@@ -22,6 +23,7 @@ shopt -s xpg_echo
#set -o xtrace
mt_arg0=$(basename $0)
+mt_root=$(dirname $0)
mt_ksh="/usr/bin/ksh"
mt_mdb="/usr/bin/mdb"
mt_outdir=
@@ -37,11 +39,11 @@ function usage
local msg="$*"
[[ -z "$msg" ]] || echo "$msg" 2>&1
cat <<USAGE >&2
-Usage: $mt_arg0 [ -o dir ] [ -k ] [ -m executable ] [ -a | test ... ]
+Usage: $mt_arg0 [ -o dir ] [ -k ] [ -m executable ] [ test ... ]
-o dir Sets 'dir' as the output directory
-k Keep output from all tests, not just failures
- -m mdb binary to test
+ -m mdb binary to test
USAGE
exit 2
}
@@ -123,7 +125,7 @@ function run_single
echo "passed"
((mt_tsuc++))
mv "$odir" "$mt_outdir/success.$mt_tsuc" || fatal \
- "failed to move test directory"
+ "failed to move test directory"
fi
((mt_tnum++))
@@ -132,7 +134,7 @@ function run_single
function run_all
{
local tests t
-
+
tests=$(find . -type f -name '[tst,err]*.*.[ksh,mdb]*')
for t in $tests; do
run_single $t
@@ -143,7 +145,7 @@ function welcome
{
cat <<WELCOME
Starting tests...
-mtest target: $mt_mdb
+mdbtest target: $mt_mdb
output directory: $mt_outdir
WELCOME
}
@@ -161,6 +163,10 @@ function cleanup
function goodbye
{
+ if [[ $mt_tnum -eq 0 ]]; then
+ fatal "no tests were run, are you in the right directory?"
+ fi
+
cat <<EOF
-------------
@@ -214,11 +220,14 @@ setup_outdir
welcome
if [[ ! -z "$mt_all" ]]; then
+ if ! cd "$mt_root"; then
+ fatal "failed to change to test root: $mt_root"
+ fi
run_all
else
for t in $@; do
[[ -f $t ]] || fatal "cannot find test $t"
- run_single $t
+ run_single $t
done
fi
@@ -228,4 +237,4 @@ cleanup
#
# Exit 1 if we have tests that return non-zero
#
-[[ $mt_tfai -eq 0 ]]
+[[ $mt_tfail -eq 0 ]]