summaryrefslogtreecommitdiff
path: root/usr/src/test
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2022-01-29 17:34:59 +0000
committerRobert Mustacchi <rm@fingolfin.org>2022-02-08 15:12:38 +0000
commit92f11af9ee66cf1fac02dc46553e805de69f204c (patch)
tree5983b5a3a6ab8e6ae43fa66cdfa974c3e864e544 /usr/src/test
parent163bcb88498e897f35c7fc801fe9db507052a1f0 (diff)
downloadillumos-gate-92f11af9ee66cf1fac02dc46553e805de69f204c.tar.gz
14460 pcieadm show-devs should warn on unused filters
14459 pcieadm show-cfgspace sometimes confuses hex and strings 14461 pcieadm-priv tests fail in the face of duplicate /devices paths Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com> Reviewed by: Andy Fiddaman <andy@omnios.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/test')
-rw-r--r--usr/src/test/util-tests/tests/pcieadm/pcieadm-priv.ksh35
1 files changed, 26 insertions, 9 deletions
diff --git a/usr/src/test/util-tests/tests/pcieadm/pcieadm-priv.ksh b/usr/src/test/util-tests/tests/pcieadm/pcieadm-priv.ksh
index 0e9c8bc796..749e4b5e4b 100644
--- a/usr/src/test/util-tests/tests/pcieadm/pcieadm-priv.ksh
+++ b/usr/src/test/util-tests/tests/pcieadm/pcieadm-priv.ksh
@@ -12,7 +12,7 @@
#
#
-# Copyright 2021 Oxide Computer Company
+# Copyright 2022 Oxide Computer Company
#
#
@@ -48,6 +48,12 @@ pcieadm_validate_filter()
printf "TEST PASSED: show-devs $filter\n"
fi
+ if $pcieadm_prog show-devs $filter 9000/9000/9000; then
+ warn "show-devs $filter 9000/9000/9000, should have failed"
+ else
+ printf "TEST PASSED: show-devs $filter 9000/9000/9000\n"
+ fi
+
if ! $pcieadm_prog show-cfgspace -d $filter >/dev/null; then
warn "failed to show-cfgspace with filter $filter"
else
@@ -96,9 +102,22 @@ else
fi
#
-# Verify based on device.
+# Do the same based on the device name
+#
+pcieadm_dev=$($pcieadm_prog show-devs -p -o driver | \
+ awk '{ if ($1 != "--") { print $1; exit 0 } }')
+if [[ -z "$pcieadm_dev" ]]; then
+ warn "failed to obtain driver based filter"
+else
+ pcieadm_validate_filter "$pcieadm_dev"
+fi
+
+#
+# Verify based on the /devices path. Note, we use the device name to
+# seed this as if there is no device driver attached, the path may
+# overlap with another device on a PCI-only (non-express) based system.
#
-pcieadm_path=$($pcieadm_prog show-devs -p -o path | \
+pcieadm_path=$($pcieadm_prog show-devs -p -o path $pcieadm_dev | \
awk '{ print $1; exit 0 }')
if [[ -z "$pcieadm_path" ]]; then
warn "failed to obtain path based filter"
@@ -107,14 +126,12 @@ else
fi
#
-# Do the same based on the device name
+# Verify a bad filter doesn't work and results in an error.
#
-pcieadm_dev=$($pcieadm_prog show-devs -p -o driver | \
- awk '{ if ($1 != "--") { print $1; exit 0 } }')
-if [[ -z "$pcieadm_dev" ]]; then
- warn "failed to obtain driver based filter"
+if $pcieadm_prog show-devs /enoent >/dev/null; then
+ warn "pcieadm succeeded with bad filter '/enoent'"
else
- pcieadm_validate_filter "$pcieadm_dev"
+ printf "TEST PASSED: show-devs /enoent\n"
fi
if ! $pcieadm_prog save-cfgspace -a "$pcieadm_tmp" > /dev/null; then