aboutsummaryrefslogtreecommitdiff
path: root/test/run-tests.sh
blob: 3b82bc260bba717f3ab700c677df6484656453a9 (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
#!/bin/sh

err_file="stderr.tmp"
out_file="stdout.tmp"
EXECUTABLE="$PWD/../cue-bin-split"

fail()
{
	echo "[FAIL] $i: $@"
	exit 1
}

for i in *.test ; do
	pushd ${i} >/dev/null
	( . ./run.sh ) 2>${err_file} >${out_file}
	if [ $? -ne 0 ] ; then
		fail "script had non-zero return code"
	fi

	if [ -f stderr.expected ] ; then
		diff stderr.expected stderr.tmp
		if [ $? -ne 0 ] ; then
			fail "stderr didn't match expected"
		fi
	fi

	if [ -f stdout.expected ] ; then
		diff stdout.expected stdout.tmp
		if [ $? -ne 0 ] ; then
			fail "stdout didn't match expected"
		fi
	fi

	echo "[PASS] $i"

	rm ${err_file} ${out_file}
	popd >/dev/null
done