#!/bin/sh set -e here=$(dirname $0) fail=0 style=$(mktemp) trap "rm -f $style" EXIT cat >$style < $tmp || status=$? if [ $status -eq 0 ] && diff -u "$expected" "$tmp"; then echo "ok $tool < $vec > $tmp" else echo "error $tool < $vec > $tmp [status=$status]" fail=1 fi rm -f -- "$tmp" } for vec in $here/vectors/*.in; do expected=${vec%%.in}.expected tool=$(basename $vec | sed 's/-.*//') tool_bin=$here/../$tool if ! [ -f "$tool_bin" ]; then # execute source directly for interpreted filters tool_bin=$here/$tool fi do_test "$tool_bin" "$tool" "$vec" "$expected" case $tool in # additional test runs calendar) # Awk if awk -W posix -- '' >/dev/null 2>&1; then # test POSIX-compatibility do_test "awk -W posix -f $tool_bin" \ "$tool (posix)" "$vec" "$expected" else # "-W posix" is not supported and not ignored, skip test echo "? $tool < $vec > $tmp [no '-W posix' support]" fi ;; esac done exit $fail