mirror of
https://github.com/linux-msm/bootrr.git
synced 2026-02-25 13:12:03 -08:00
helpers: Add value_in_range helper
This helper is useful to check if a value is within a given range e.g. temperature is between 30 and 40 degrees. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
This commit is contained in:
committed by
Bjorn Andersson
parent
4ea31c5af8
commit
a2cc1741bb
1
Makefile
1
Makefile
@@ -12,6 +12,7 @@ HELPERS := assert_device_present \
|
||||
ensure_lib_firmware \
|
||||
rproc-start \
|
||||
rproc-stop \
|
||||
value_in_range \
|
||||
state_check
|
||||
|
||||
BOARDS := arrow,apq8096-db820c \
|
||||
|
||||
22
helpers/value_in_range
Executable file
22
helpers/value_in_range
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. bootrr
|
||||
|
||||
TEST_CASE_ID="$1"
|
||||
LOC="$2"
|
||||
LOW="$3"
|
||||
HIGH="$4"
|
||||
|
||||
if [ -z "${TEST_CASE_ID}" -o -z "${LOC}" -o -z "${LOW}" -o -z "${HIGH}" ]; then
|
||||
echo "Usage: $0 <test-case-id> <path> <low> <high> [<timeout>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -r "${LOC}" ] || test_report_exit fail
|
||||
|
||||
val=$(cat "${LOC}")
|
||||
if [ "${val}" -ge "${LOW}" -a "${val}" -le "${HIGH}" ]; then
|
||||
test_report_exit pass
|
||||
else
|
||||
test_report_exit fail
|
||||
fi
|
||||
Reference in New Issue
Block a user