Add FAILFAST support
[zfs.git] / scripts / common.sh.in
index 102952f..57508be 100644 (file)
@@ -1,13 +1,13 @@
 #!/bin/bash
 #
-# Common support functions for testing scripts.  If a .script-config
+# Common support functions for testing scripts.  If a script-config
 # files is available it will be sourced so in-tree kernel modules and
-# utilities will be used.  If no .script-config can be found then the
+# utilities will be used.  If no script-config can be found then the
 # installed kernel modules and utilities will be used.
 
 basedir="$(dirname $0)"
 
-SCRIPT_CONFIG=.script-config
+SCRIPT_CONFIG=zfs-script-config.sh
 if [ -f "${basedir}/../${SCRIPT_CONFIG}" ]; then
 . "${basedir}/../${SCRIPT_CONFIG}"
 else
@@ -441,3 +441,20 @@ run_test() {
                skip_one_test ${TEST_NUM} "${TEST_NAME}"
        fi
 }
+
+wait_udev() {
+       local DEVICE=$1
+       local DELAY=$2
+       local COUNT=0
+
+       while [ ! -e ${DEVICE} ]; do
+               if [ ${COUNT} -gt ${DELAY} ]; then
+                       return 1
+               fi
+
+               let COUNT=${COUNT}+1
+               sleep 1
+       done
+
+       return 0
+}