accel-config/0001-accel-config-test-Don-t-attempt-to-disable-non-exist.patch
Jerry Snitselaar 58a2e60b96 accel-config/test: Don't try to iterate over non-existent devices
Fix dsa_user_test_runner so it doesn't attempt to iterate over
devices without first checking that there are devices to disable.

Resolves: RHEL-32469

Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
2024-04-17 00:32:30 -07:00

44 lines
1.4 KiB
Diff

From 3b1faa506dbc47c1f2aeb376ffe92a41eab961b3 Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Wed, 3 Apr 2024 13:06:20 -0700
Subject: [PATCH 1/3] accel-config/test: Don't attempt to disable non-existent
devices
'Content-type: text/plain'
Check whether any devices exist before attempting to iterate
over them.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
test/common | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/test/common b/test/common
index a5a53ec27b08..fd9a3eebdc6b 100755
--- a/test/common
+++ b/test/common
@@ -122,13 +122,18 @@ check_prereq()
disable_all() {
for device_type in 'dsa' 'iax'; do
# Kernel before 5.13 has dsa and iax bus. Because of ABI change, iax
- # bus is removed. All devices are in /sys/bus/das/devices.
+ # bus is removed. All devices are in /sys/bus/dsa/devices.
if [ -d /sys/bus/iax ] && [ $device_type == 'iax' ]; then
DSA_DEVICE_PATH="/sys/bus/iax/devices"
else
DSA_DEVICE_PATH="/sys/bus/dsa/devices"
fi
- # Get available devices
+
+ if ! ls "${DSA_DEVICE_PATH}/" | grep -qE "${device_type}[0-9]*"; then
+ continue
+ fi
+
+ # Get available devices
for device_path in ${DSA_DEVICE_PATH}/${device_type}* ; do
[[ $(echo "$device_path" | grep -c '!') -eq 0 ]] && {
# Get wqs and disable it if the status is enabled
--
2.44.0