Files
bootrr/helpers/assert_device_present
Caleb Connolly 15802fb245 bin: generate: use POSIX sh and support spaces
Handles drivers with spaces in their names, and simplify slightly by
using globbing to unwrap the bus for loop.

It's necessary to add the final '*' in the "for driver in" loop in
bootrr-generate-template on POSIX sh.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2023-09-25 15:18:27 +01:00

19 lines
429 B
Bash
Executable File

#!/bin/sh
. bootrr
TEST_CASE_ID="$1"
DRIVER="$2"
DEVICE="$3"
TIMEOUT="${4:-1}"
if [ -z "${TEST_CASE_ID}" -o -z "${DRIVER}" -o -z "${DEVICE}" ]; then
echo "Usage: $0 <test-case-id> <driver> <device> [<timeout>]"
exit 1
fi
timeout ${TIMEOUT} [ -d /sys/bus/*/drivers/"${DRIVER}" ] || test_report_exit blocked
timeout ${TIMEOUT} [ -L /sys/bus/*/drivers/"${DRIVER}"/"${DEVICE}" ] || test_report_exit fail
test_report_exit pass