diff options
author | Brian Behlendorf <[email protected]> | 2010-08-26 11:44:39 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-08-31 13:41:50 -0700 |
commit | 325f023544bbec6a478882c442e15304ee379759 (patch) | |
tree | e41ddbab7f373fc7fd43390c4ba05ea722729e68 /scripts/common.sh.in | |
parent | 47d0ed1e6f8a8ee67492ec63173a27df8e4ca059 (diff) |
Add linux kernel device support
This branch contains the majority of the changes required to cleanly
intergrate with Linux style special devices (/dev/zfs). Mainly this
means dropping all the Solaris style callbacks and replacing them
with the Linux equivilants.
This patch also adds the onexit infrastructure needed to track
some minimal state between ioctls. Under Linux it would be easy
to do this simply using the file->private_data. But under Solaris
they apparent need to pass the file descriptor as part of the ioctl
data and then perform a lookup in the kernel. Once again to keep
code change to a minimum I've implemented the Solaris solution.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'scripts/common.sh.in')
-rw-r--r-- | scripts/common.sh.in | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/scripts/common.sh.in b/scripts/common.sh.in index 00418696c..0a8399f18 100644 --- a/scripts/common.sh.in +++ b/scripts/common.sh.in @@ -26,6 +26,8 @@ RAID0S=() RAID10S=() RAIDZS=() RAIDZ2S=() +TESTS_RUN=${TESTS_RUN:-'*'} +TESTS_SKIP=${TESTS_SKIP:-} prefix=@prefix@ exec_prefix=@exec_prefix@ @@ -58,6 +60,24 @@ SYSCTL=${SYSCTL:-/sbin/sysctl} UDEVADM=${UDEVADM:-/sbin/udevadm} AWK=${AWK:-/usr/bin/awk} +COLOR_BLACK="\033[0;30m" +COLOR_DK_GRAY="\033[1;30m" +COLOR_BLUE="\033[0;34m" +COLOR_LT_BLUE="\033[1;34m" +COLOR_GREEN="\033[0;32m" +COLOR_LT_GREEN="\033[1;32m" +COLOR_CYAN="\033[0;36m" +COLOR_LT_CYAN="\033[1;36m" +COLOR_RED="\033[0;31m" +COLOR_LT_RED="\033[1;31m" +COLOR_PURPLE="\033[0;35m" +COLOR_LT_PURPLE="\033[1;35m" +COLOR_BROWN="\033[0;33m" +COLOR_YELLOW="\033[1;33m" +COLOR_LT_GRAY="\033[0;37m" +COLOR_WHITE="\033[1;37m" +COLOR_RESET="\033[0m" + die() { echo -e "${PROG}: $1" >&2 exit 1 @@ -70,14 +90,18 @@ msg() { } pass() { - echo "PASS" + echo -e "${COLOR_GREEN}Pass${COLOR_RESET}" } fail() { - echo "FAIL ($1)" + echo -e "${COLOR_RED}Fail${COLOR_RESET} ($1)" exit $1 } +skip() { + echo -e "${COLOR_BROWN}Skip${COLOR_RESET}" +} + spl_dump_log() { ${SYSCTL} -w kernel.spl.debug.dump=1 &>/dev/null local NAME=`dmesg | tail -n 1 | cut -f5 -d' '` @@ -371,3 +395,44 @@ udev_raidz2_setup() { return 0 } + +run_one_test() { + local TEST_NUM=$1 + local TEST_NAME=$2 + + printf "%-4d %-36s " ${TEST_NUM} "${TEST_NAME}" + test_${TEST_NUM} +} + +skip_one_test() { + local TEST_NUM=$1 + local TEST_NAME=$2 + + printf "%-4d %-36s " ${TEST_NUM} "${TEST_NAME}" + skip +} + +run_test() { + local TEST_NUM=$1 + local TEST_NAME=$2 + + for i in ${TESTS_SKIP[@]}; do + if [[ $i == ${TEST_NUM} ]] ; then + skip_one_test ${TEST_NUM} "${TEST_NAME}" + return 0 + fi + done + + if [ "${TESTS_RUN[0]}" = "*" ]; then + run_one_test ${TEST_NUM} "${TEST_NAME}" + else + for i in ${TESTS_RUN[@]}; do + if [[ $i == ${TEST_NUM} ]] ; then + run_one_test ${TEST_NUM} "${TEST_NAME}" + return 0 + fi + done + + skip_one_test ${TEST_NUM} "${TEST_NAME}" + fi +} |