From cc048442a7517d412b6aabf5aa93aad98eb4cca3 Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra Date: Mon, 17 Dec 2018 13:32:25 +0100 Subject: [PATCH] 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 --- helpers/assert_sysfs_attr_present | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 helpers/assert_sysfs_attr_present diff --git a/helpers/assert_sysfs_attr_present b/helpers/assert_sysfs_attr_present new file mode 100755 index 0000000..748a3d8 --- /dev/null +++ b/helpers/assert_sysfs_attr_present @@ -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 []" + exit 1 +fi + +timeout ${TIMEOUT} [ -f ${SYSFS_ATTRIBUTE} ] || test_report_exit fail + +test_report_exit pass