8af74b5ac7
If there is only one device in ${devs[*]}, we see failure backtrace: ========== Backtrace start: ========== in /home/jenkins/spdk_repo/spdk/test/setup/acl.sh:41 -> allowed([]) ... 36 } 37 38 allowed() { 39 PCI_ALLOWED="${devs[0]}" setup output config \ 40 | grep "Skipping denied controller at " \ => 41 | grep -v "${devs[0]}" 42 verify "${devs[@]:1}" 43 setup reset 44 } 45 46 setup reset Signed-off-by: Rui Chang <rui.chang@arm.com> Change-Id: I9aba6b19f6de6bea7149e0f39da8d5d8d6978a4e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7467 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Michal Berger <michalx.berger@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
testdir=$(readlink -f "$(dirname "$0")")
|
|
rootdir=$(readlink -f "$testdir/../../")
|
|
source "$testdir/common.sh"
|
|
|
|
declare -a devs=()
|
|
declare -A drivers=()
|
|
|
|
collect_setup_devs() {
|
|
local dev driver
|
|
|
|
while read -r _ dev _ _ _ driver _; do
|
|
[[ $dev == *:*:*.* ]] || continue
|
|
[[ $driver == nvme ]] || continue
|
|
devs+=("$dev") drivers["$dev"]=$driver
|
|
done < <(setup output status)
|
|
((${#devs[@]} > 0))
|
|
}
|
|
|
|
verify() {
|
|
local dev driver
|
|
|
|
for dev; do
|
|
[[ -e /sys/bus/pci/devices/$dev ]]
|
|
driver=$(readlink -f "/sys/bus/pci/devices/$dev/driver")
|
|
[[ ${drivers["$dev"]} == "${driver##*/}" ]]
|
|
done
|
|
}
|
|
|
|
denied() {
|
|
# Include OCSSD devices in the PCI_BLOCKED to make sure we don't unbind
|
|
# them from the pci-stub (see autotest.sh for details).
|
|
PCI_BLOCKED="$OCSSD_PCI_DEVICES ${devs[0]}" setup output config \
|
|
| grep "Skipping denied controller at ${devs[0]}"
|
|
verify "${devs[0]}"
|
|
setup reset
|
|
}
|
|
|
|
allowed() {
|
|
PCI_ALLOWED="${devs[0]}" setup output config \
|
|
| grep -E "${devs[0]} .*: ${drivers["${devs[0]}"]} -> .*"
|
|
verify "${devs[@]:1}"
|
|
setup reset
|
|
}
|
|
|
|
setup reset
|
|
collect_setup_devs
|
|
|
|
run_test "denied" denied
|
|
run_test "allowed" allowed
|