missing NULL terminator in set_config_x
[geda-gaf.git] / utils / tests / gxyrs / run-test
blob618f82bb9bfb3201d40b939d11eee08651b764df
1 #!/bin/sh
3 t=`basename "$1" .out`
5 TESTLIST="${srcdir}/tests.list"
6 INPUT_DIR="${srcdir}/inputs"
7 GOLDEN_DIR="${srcdir}/outputs"
9 rundir="${t}.run"
12 # figure out what files we need to copy for this test and what
13 # arguments to feed refdes_renum
15 files=`grep "^[ \t]*${t}[ \t]*|" "${TESTLIST}" | awk 'BEGIN{FS="|"} {print $2}'`
16 adjust_file=`grep "^[ \t]*${t}[ \t]*|" "${TESTLIST}" | awk 'BEGIN{FS="|"} {print $3}'`
17 args=`grep "^[ \t]*${t}[ \t]*|" "${TESTLIST}" | awk 'BEGIN{FS="|"} {print $4}'`
18 code=`grep "^[ \t]*${t}[ \t]*|" "${TESTLIST}" | awk 'BEGIN{FS="|"} {print $5}'`
20 if test "X${code}" = "X" ; then
21 code=0
25 # create temporary run directory with the needed files
27 rm -fr "${rundir}"
28 mkdir -p "${rundir}"
30 if test ! -z "${files}" ; then
31 for f in ${files} ${adjust_file}; do
32 cp "${INPUT_DIR}/${f}" "${rundir}"
33 chmod 644 "${rundir}/${f}"
34 done
38 # run gxyrs
40 here=`pwd`
41 cd "${rundir}"
43 if test "X${adjust_file}" = "X" -o "X${adjust_file}" = "X " ; then
44 command="${GXYRS} ${args} ${files} --output stdout 2> stderr"
45 else
46 command="${GXYRS} ${args} ${files} --adjust ${adjust_file} --output stdout 2> stderr"
48 echo "${command}"
49 eval "${command}"
51 rc=$?
52 if test ${rc} -ne "${code}" ; then
53 echo "gxyrs returned ${rc} which did not match the expected ${code}"
54 exit 1
57 cd "${here}"
60 # check output and clean up
62 ref_out="${GOLDEN_DIR}/${t}.out"
63 ref_err="${GOLDEN_DIR}/${t}.err"
64 gen_out="${rundir}/stdout"
65 gen_err="${rundir}/stderr"
67 if test "X${REGEN}" = "X1" ; then
68 cp "${gen_out}" "${ref_out}"
69 cp "${gen_err}" "${ref_err}"
70 else
71 status=0
72 diff -wu "${ref_out}" "${gen_out}" || status=1
73 diff -wu "${ref_err}" "${gen_err}" || status=1
74 test ${status} = 0 || exit 1
77 rm -fr "${rundir}"