6 Generate ATF test cases from a set of DTrace tests.
8 usage: sh $(basename $0) [-e <excludes>] <category> [<testfiles>]
10 excludes: A shell script which defines test cases that are to be skipped,
11 or aren't expected to pass.
12 category: The test category, in the form of <arch>/<feature>. For example,
13 "common/aggs" is the test category for D aggregations.
14 testfiles: The test files for the tests in the specified category.
31 atf_set 'descr' 'DTrace test ${CATEGORY}/${tfile}'
36 atf_check -s exit:0 -o empty -e empty \\
37 "\$(atf_get_srcdir)/../../dtest" "\$(atf_get_srcdir)/${tfile}"
44 local mod tcase tfile tfiles
49 for tfile in ${tfiles}; do
51 drp.*.d|err.*.d|tst.*.d|*.ksh)
52 # Test names need to be mangled for ATF.
53 tcase=$(echo "$tfile" | tr '.-' '_')
54 gentestcase "$tfile" "$tcase" "$mod"
55 TCASES="$TCASES $tcase"
68 shift; EXCLUDES=$1; shift
74 if ! expr "$CATEGORY" : '[^/]*/[^/]*' >/dev/null 2>&1; then
77 FEATURE=$(basename ${CATEGORY})
78 ARCH=$(dirname ${CATEGORY})
81 # Remove skipped tests and expected failures from the main test list.
84 EXFAILS=$(echo -e "$EXFAIL" | grep "^${CATEGORY}/" | xargs basename -a)
85 SKIPS=$(echo -e "$SKIP" | grep "^${CATEGORY}/" | xargs basename -a)
88 trap 'rm -f $FILELIST' EXIT
90 echo "$@" | tr ' ' '\n' | xargs basename -a | sort > ${FILELIST}
91 TFILES=$(printf '%s\n%s' "$EXFAILS" "$SKIPS" | sort | comm -13 /dev/stdin $FILELIST)
94 # Generate test cases.
96 gentestcases SKIPS "atf_skip \"test may hang or cause system instability\""
97 gentestcases EXFAILS "atf_expect_fail \"test is known to fail\""
101 # Generate the test init function.
104 atf_init_test_cases()
106 $(for tcase in ${TCASES}; do echo " atf_add_test_case $tcase"; done)