3 [[ -n "$DEBUG" ]] && set -x
6 TEST_ARGS="--lookup-policy=nonabsolute"
7 WORKDIR=`mktemp -d ${TMPDIR:-/tmp}/${TEST_PGM}.XXXXXXXXXX`
8 [[ -n "$WORKDIR" ]] && [[ -d "$WORKDIR" ]] || [[ -w "$WORKDIR" ]] || exit 1
10 export FHICL_FILE_PATH="$WORKDIR"
12 # Clean up if we're not debugging.
13 trap "if [[ -n \"$DEBUG\" ]]; then echo \"$WORKDIR\"; else [[ -d \"$WORKDIR\" ]] && rm -rf \"$WORKDIR\"; fi" EXIT
15 OUTPUT_FILE=${WORKDIR}/out.txt
18 ${TEST_PGM} ${TEST_ARGS} > ${OUTPUT_FILE} <<EOF
21 [[ ${STATUS} ]] || exit ${STATUS}
22 [[ -r ${OUTPUT_FILE} ]] || exit 11
23 [[ ! -s ${OUTPUT_FILE} ]] || exit 12
26 ${TEST_PGM} ${TEST_ARGS} - > ${OUTPUT_FILE} <<EOF
30 [[ ${STATUS} ]] || exit ${STATUS}
31 [[ -r ${OUTPUT_FILE} ]] || exit 21
32 [[ -s ${OUTPUT_FILE} ]] || exit 22
35 ${TEST_PGM} ${TEST_ARGS} a b c > ${OUTPUT_FILE}
37 [[ ${STATUS} == 3 ]] || exit ${STATUS}
41 F1A=${WORKDIR}/F1A.txt
42 F2=${WORKDIR}/F2/F2.txt
44 FEXPECTED=${WORKDIR}/expected.txt
51 mkdir -p `dirname "${F2}"`
62 cat - > ${FEXPECTED} <<EOF
69 export FHICL_FILE_PATH="$WORKDIR/F2:$WORKDIR"
70 ${TEST_PGM} ${TEST_ARGS} ${F3} > ${OUTPUT_FILE}
72 [[ ${STATUS} ]] || exit ${STATUS}
73 cmp ${FEXPECTED} ${OUTPUT_FILE} || exit 31