helpers: Add assert_sysfs_attr_present helper

This helper is useful to check if a sysfs attribute is present.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
This commit is contained in:
Enric Balletbo i Serra
2018-12-17 13:32:25 +01:00
committed by Bjorn Andersson
parent 29a357b718
commit cc048442a7

View File

@@ -0,0 +1,16 @@
#!/bin/sh
. bootrr
TEST_CASE_ID="$1"
SYSFS_ATTRIBUTE="$2"
TIMEOUT="${3:-1}"
if [ -z "${TEST_CASE_ID}" -o -z "${SYSFS_ATTRIBUTE}" ]; then
echo "Usage: $0 <test-case-id> <sysfs attribute> [<timeout>]"
exit 1
fi
timeout ${TIMEOUT} [ -f ${SYSFS_ATTRIBUTE} ] || test_report_exit fail
test_report_exit pass