Files
bootrr/helpers/assert_file_is_empty
Enric Balletbo i Serra 4523c42196 helpers: Add an script to check if a file is empty
We might be interested on check if a file is empty or not. One use case
is check if the /sys/kernel/debug/devices_deferred file is not empty, in
such case mean that a driver is deferred for some reason so probe didn't
succeed.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
2019-05-08 09:00:50 -07:00

22 lines
341 B
Bash
Executable File

#!/bin/sh
. bootrr
TEST_CASE_ID="$1"
FILEPATH="$2"
TIMEOUT="${4:-1}"
if [ -z "${TEST_CASE_ID}" -o -z "${FILEPATH}" ]; then
echo "Usage: $0 <test-case-id> <file path> [<timeout>]"
exit 1
fi
if [ ! -e "${FILEPATH}" ]
then
test_report_exit skip
fi
timeout ${TIMEOUT} [ -s "${FILEPATH}" ] || test_report_exit pass
test_report_exit fail