Files
bootrr/helpers/state_check
Amit Kucheria 4ea31c5af8 helpers: Add state_check helper
This helper is useful to check the state of a sysfs variable, e.g. enabled,
disabled, running, offline, etc.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2018-07-26 06:06:57 -07:00

22 lines
355 B
Bash
Executable File

#!/bin/sh
. bootrr
TEST_CASE_ID="$1"
LOC="$2"
STATE="$3"
if [ -z "${TEST_CASE_ID}" -o -z "${LOC}" -o -z "${STATE}" ]; then
echo "Usage: $0 <test-case-id> <path> <desired state> [<timeout>]"
exit 1
fi
[ -r "${LOC}" ] || test_report_exit fail
val=$(cat "$LOC")
if [ "${val}" = "${STATE}" ]; then
test_report_exit pass
else
test_report_exit fail
fi