Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert_device_present: allow glob patterns in devices #41

Open
wants to merge 1 commit into
base: staging.kernelci.org
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions helpers/assert_device_present
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

. bootrr

Expand All @@ -13,6 +13,12 @@ if [ -z "${TEST_CASE_ID}" -o -z "${DRIVER}" -o -z "${DEVICE}" ]; then
fi

timeout ${TIMEOUT} [ -d /sys/bus/*/drivers/${DRIVER} ] || test_report_exit blocked
timeout ${TIMEOUT} [ -L /sys/bus/*/drivers/${DRIVER}/${DEVICE} ] || test_report_exit fail

# If the device parameter is a glob pattern, run the test for each
# device once expanded
devices=(/sys/bus/*/drivers/${DRIVER}/${DEVICE})
for path in "${devices[@]}"; do
timeout ${TIMEOUT} [ -L $path ] || test_report_exit fail
done

test_report_exit pass