then
local switches="$switches --skeleton -Werror-undefined-control-flow"
- local status=""
- [ -z $status ] && status=`${valgrind} ${wine} ../${re2c} $switches "../$x" 2>"$outc.stderr" || echo "FAIL_RE2C"`
- [ -z $status ] && status=`gcc -Wall -Wextra -o "$outc.out" "$outc" 2>>"$outc.stderr" || echo "FAIL_CC"`
- [ -z $status ] && status=`./"$outc.out" 2>>"$outc.stderr" || echo "FAIL_RUN"`
- [ -z $status ] && status="OK"
- if [ $status = "OK" -o $status = "FAIL_RE2C" ]
- then
+ local status=0
+ ${valgrind} ${wine} ../${re2c} $switches "../$x" 2>"$outc.stderr" || status=1
+ [ $status -eq 0 ] && { @CC@ -Wall -Wextra -o "$outc.out" "$outc" 2>>"$outc.stderr" || status=2; }
+ [ $status -eq 0 ] && { ./"$outc.out" 2>>"$outc.stderr" || status=3; }
+
+ case $status in
+ 0 ) local msg="OK" ;;
+ 1 ) local msg="OK (expected re2c error)" ;;
+ 2 ) local msg="FAIL (compilation error)" ;;
+ 3 ) local msg="FAIL (runtime error)" ;;
+ esac
+ printf "%-25s $outx\n" "$msg"
+
+ if [ $status -le 1 ]; then
[ $keep_tmp_files -eq 0 ] && rm -f "$outc"{,.line*.{input,keys},.stderr,.out}
else
cp -f "../$x" "$outx"
local errcnt=$(($errcnt + 1))
fi
-
- printf "%-10s $outx\n" "$status"
else
# create sandbox
tmpdir="tmp_$log" \