summaryrefslogtreecommitdiffstats
path: root/tools/regression/bin/sh/regress.sh
blob: 0e098d0d3d12f8ea6296e013723a8fdec9a7b0de (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
# $FreeBSD$

echo '1..31'

COUNTER=1

do_test() {
	local c
	c=${COUNTER}
	COUNTER=$((COUNTER+1))
	sh $1 > tmp.stdout 2> tmp.stderr
	if [ $? -ne $2 ]; then
		echo "not ok ${c} - ${1} # wrong exit status"
		rm tmp.stdout tmp.stderr
		return
	fi
	for i in stdout stderr; do
		if [ -f ${1}.${i} ]; then
			if ! cmp -s tmp.${i} ${1}.${i}; then
				echo "not ok ${c} - ${1} # wrong output on ${i}"
				rm tmp.stdout tmp.stderr
				return
			fi
		elif [ -s tmp.${i} ]; then
			echo "not ok ${c} - ${1} # wrong output on ${i}"
			rm tmp.stdout tmp.stderr
			return
		fi
	done
	echo "ok ${c} - ${1}"
	rm tmp.stdout tmp.stderr
}

SUCCESS=$(find . -name "*.0")
for i in ${SUCCESS} ; do
	do_test ${i} 0
done
	
FAILURE=$(find . -name "*.1")
for i in ${FAILURE} ; do
	do_test ${i} 1
done
OpenPOWER on IntegriCloud