3 tmpfile
=/tmp
/test_reference_output$$.txt
7 if [ -f "${tmpfile}" ]; then
8 echo removing
"${tmpfile}"
20 if [ "${filter}" = "" ]; then
23 ${program} | ${filter}
29 echo "usage: $0 ( create | test ) <program> <reference_file> [ <filter> ]"
38 if [ "${ref_file}" = "" ]; then
42 if [ "${program}" = "" ]; then
46 if [ ! -f "${program}" ]; then
47 echo "program '${program}' doesn't exit"
50 if [ ! -x "${program}" ]; then
51 program
="sh ${program}"
53 # echo "The program is ${program}"
55 if [ ! "${filter}" = "" ]; then
56 if [ ! -f "${filter}" ]; then
57 echo "filter '${filter}' doesn't exit"
60 if [ ! -x "${filter}" ]; then
63 # echo "The filter is ${filter}"
68 if [ "${command}" = "create" ]; then
69 run_program
"${program}" "${filter}" > "${ref_file}"
70 elif [ "${command}" = "test" ]; then
71 if [ ! -f "${ref_file}" ]; then
72 echo "reference file '${ref_file}' doesn't exist"
75 run_program
"${program}" "${filter}" > "${tmpfile}"
76 cmp "${tmpfile}" "${ref_file}"
77 if [ ! $?
-eq 0 ]; then
79 diff "${tmpfile}" "${ref_file}"