freebsd-src/contrib/unifdef/scripts/runtests.sh
Dag-Erling Smørgrav fb3ef04d20 Add 'contrib/unifdef/' from commit '0da44885831dc0a43c4ca6ff04a2430993cc0a80'
git-subtree-dir: contrib/unifdef
git-subtree-mainline: 3b7ffacdee
git-subtree-split: 0da4488583
2023-08-21 19:51:03 +02:00

39 lines
578 B
Bash
Executable file

#!/bin/sh
export PATH="$(pwd):${PATH}"
${1:+cd} ${1:-:}
for cmd in *.sh
do
printf .
t=${cmd%.sh}
sh ./${cmd} >${t}.out 2>${t}.err
echo $? >${t}.rc
# strip carriage returns from error output
# in case we are trying to run on MinGW
tr -d '
' >${t}.xerr <${t}.err
mv ${t}.xerr ${t}.err
ok=true
for e in out err rc
do
exp=${t}.exp${e}
got=${t}.${e}
if ! cmp -s ${exp} ${got}
then
echo
echo FAILED: ${got}: $(cat ${cmd})
diff -u ${exp} ${got}
ok=false
fi
done
if ${ok}
then rm -f ${t}.out ${t}.err ${t}.rc
else rc=1
fi
done
echo
exit ${rc}