summaryrefslogtreecommitdiff
path: root/tests/test_xauth
blob: 27d999b19249187087b1e0833a0532e53ff92e63 (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

# This script is modelled after cmdtest:
#   it takes all *.scripts and executes them and saves the stdout/err
#   This output is compared against *.stdout/stderr.
#   If no difference is found, the test is assumed as PASS (otherwise FAIL)
#
total_ret=0
for script in `ls -1 ./*.script | sort` ; do
	base=`basename $script .script`
	echo "Testing $base"
        $script > out.stdout 2> out.stderr

	# check stdout for correctness
	if [ -f $base.stdout ]; then
		diff out.stdout $base.stdout
		ret_stdout=$?
	else
		ret_stdout=0
	fi

	# check stderr for correctness
	if [ -f $base.stderr ]; then
		diff out.stderr $base.stderr
		ret_stderr=$?
	else
		ret_stderr=0
	fi

	if [ $ret_stdout -eq 0 -a $ret_stderr -eq 0 ]; then
		echo "OK"
	else
		echo "FAIL"
		total_ret=1
	fi
done

exit $total_ret