summaryrefslogtreecommitdiff
path: root/tests/run_script_test.sh
blob: a6ccfa8cb08e1097b91b72c0abbe83668dd53307 (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
48
49
50
51
52
53
54
55
56
#!/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
}

case $expected in
	good)
		export APLWC_FAILSIM_STRICT=1
		;;
	bad)
		export APLWC_FAILSIM_STRICT=0
		;;
esac

"$1"
check $?

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

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