#!/bin/sh

. bootrr

TEST_CASE_ID="$1"
STATE="$2"
shift 2
# one or more files to check in batch mode
LOC="$*"

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

for f in ${LOC}; do
	[ -r "${f}" ] || test_report_exit fail

	val=$(cat "$f")
	if [ "${val}" != "${STATE}" ]; then
		test_report_exit fail
	fi
done

# if we are here, everything is all right!
test_report_exit pass
