4 WORKDIR=`mktemp -d ${TMPDIR:-/tmp}/${TEST_PGM}.XXXXXXXXXX`
5 [[ -n "$WORKDIR" ]] && [[ -d "$WORKDIR" ]] || [[ -w "$WORKDIR" ]] || exit 1
7 # Clean up if we're not debugging.
8 [[ -z "$DEBUG" ]] && trap "[[ -d \"$WORKDIR\" ]] && rm -rf \"$WORKDIR\"" EXIT
10 OUTPUT_FILE=${WORKDIR}/out.txt
13 ${TEST_PGM} > ${OUTPUT_FILE} <<EOF
16 [[ ${STATUS} ]] || exit ${STATUS}
17 [[ -r ${OUTPUT_FILE} ]] || exit 11
18 [[ ! -s ${OUTPUT_FILE} ]] || exit 12
21 ${TEST_PGM} - > ${OUTPUT_FILE} <<EOF
25 [[ ${STATUS} ]] || exit ${STATUS}
26 [[ -r ${OUTPUT_FILE} ]] || exit 21
27 [[ -s ${OUTPUT_FILE} ]] || exit 22
30 ${TEST_PGM} a b c > ${OUTPUT_FILE}
32 [[ ${STATUS} == 3 ]] || exit ${STATUS}
38 FEXPECTED=${WORKDIR}/expected.txt
51 cat - > ${FEXPECTED} <<EOF
57 ${TEST_PGM} ${F3} > ${OUTPUT_FILE}
59 [[ ${STATUS} ]] || exit ${STATUS}
60 cmp ${FEXPECTED} ${OUTPUT_FILE} || exit 31