summaryrefslogtreecommitdiff
path: root/tests/run_script_test.sh
blob: 9e7d085442349344b773aae08cd1c9bc62a8dbd0 (plain) (blame)
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
43
44
45
46
47
#!/bin/sh

input=$1

input=${input#*/tests/scripts/}
expected=${input%%/*}
ext=${input##*.}

check()
{
	status=$1
	case $status in
		0|1)
			;;
		*)
			exit 99
			;;
	esac

	case $expected in
		bad)
			[ "$status" -eq 1 ]
			;;
		*)
			[ "$status" -eq 0 ]
			;;
	esac
	if [ "$?" -ne 0 ]; then
		exit 1
	fi
}

"$1"
check $?

case "$ext" in
	aplwc)
		aplwc "$1"
		check $?
		;;
esac

case $expected in
	*)
		"$srcdir/tests/scripts/simfail.sh" "$1"
		check $?
esac