1#!/bin/sh 2 3export PATH="$(pwd):${PATH}" 4${1:+cd} ${1:-:} 5for cmd in *.sh 6do 7 printf . 8 t=${cmd%.sh} 9 10 sh ./${cmd} >${t}.out 2>${t}.err 11 echo $? >${t}.rc 12 13 # strip carriage returns from error output 14 # in case we are trying to run on MinGW 15 tr -d ' 16' >${t}.xerr <${t}.err 17 mv ${t}.xerr ${t}.err 18 19 ok=true 20 for e in out err rc 21 do 22 exp=${t}.exp${e} 23 got=${t}.${e} 24 if ! cmp -s ${exp} ${got} 25 then 26 echo 27 echo FAILED: ${got}: $(cat ${cmd}) 28 diff -u ${exp} ${got} 29 ok=false 30 fi 31 done 32 33 if ${ok} 34 then rm -f ${t}.out ${t}.err ${t}.rc 35 else rc=1 36 fi 37done 38echo 39exit ${rc} 40