1 # Define various parameters for use in test runs.
2 # Requires $test to be defined before sourcing.
6 echo "\$test not defined" >&2
10 if [ "${test}" != "driver" ]
12 echo "Running ${test} ..."
19 GUILE=`if test -f ../../guile/libguile/guile ; then echo ../../guile/libguile/guile; else echo guile ; fi`
20 GUILEFLAGS="-l ${cgendir}/guile.scm -s"
24 cgen_output_file=${test}.cgen.out
25 test_output_file=${test}.test.out
26 rm -f ${cgen_output_file} ${test_output_file}
28 tmp_match=match-${test}.tmp
29 tmp_expr=expr-${test}.tmp
30 rm -f ${tmp_match} ${tmp_expr}
34 # Invoke this to run cgen.
35 # Usage: run_cgen [-f] cpu-file-path
36 # -f: cgen is expected to fail (useful for testing error handling)
40 [ "$1" == "-f" ] && { expect_fail=true ; shift ; }
42 [ $# -ne 1 ] && { echo "missing cpu_file" >&2 ; exit 1 ; }
45 if ${GUILE} ${GUILEFLAGS} ${cgendir}/cgen-testsuite.scm \
49 -T ${cgen_output_file} >& ${test_output_file}
51 ${expect_fail} && { fail "${test} run of cgen expected to fail" ; }
53 ${expect_fail} || { fail "${test} run of cgen" ; }
58 file=${test_output_file}
62 fail "In test output:"
66 grep "^MATCH: " $file | sed -e 's/^MATCH://' > ${tmp_match}
67 grep "^EXPR: " $file | sed -e 's/^EXPR://' > ${tmp_expr}
69 if ! cmp -s ${tmp_match} ${tmp_expr}
71 fail "Differences from expected output:"
72 diff ${tmp_match} ${tmp_expr}