File: runtests.sh

package info (click to toggle)
unifdef 2.6-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,116 kB
  • sloc: ansic: 1,338; sh: 163; makefile: 100
file content (29 lines) | stat: -rwxr-xr-x 384 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

${1:+cd} ${1:-:}
for cmd in *.sh
do
	t=${cmd%.sh}

	. ./${cmd} >${t}.out 2>${t}.err
	echo $? >${t}.rc

	ok=true
	for e in out err rc
	do
		exp=${t}.exp${e}
		got=${t}.${e}
		if ! cmp -s ${exp} ${got}
		then
			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
exit ${rc}