]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unifdef/scripts/runtests.sh
Add 'contrib/unifdef/' from commit '0da44885831dc0a43c4ca6ff04a2430993cc0a80'
[FreeBSD/FreeBSD.git] / contrib / unifdef / scripts / runtests.sh
1 #!/bin/sh
2
3 export PATH="$(pwd):${PATH}"
4 ${1:+cd} ${1:-:}
5 for cmd in *.sh
6 do
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 '\r' >${t}.xerr <${t}.err
16         mv ${t}.xerr ${t}.err
17
18         ok=true
19         for e in out err rc
20         do
21                 exp=${t}.exp${e}
22                 got=${t}.${e}
23                 if ! cmp -s ${exp} ${got}
24                 then
25                         echo
26                         echo FAILED: ${got}: $(cat ${cmd})
27                         diff -u ${exp} ${got}
28                         ok=false
29                 fi
30         done
31
32         if ${ok}
33         then rm -f ${t}.out ${t}.err ${t}.rc
34         else rc=1
35         fi
36 done
37 echo
38 exit ${rc}