summaryrefslogtreecommitdiff
path: root/dist/s_validate
blob: 32e8fe5229ae9cfb105d28e11fcdd16997f33382 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh -
#	$Id$
#
# This script runs the various validation tests in the validate directory.

# Run everything, even those known to be invalid or useless.
all_tests=1
# Run all tests, even those that require odd env setup or a long time.
full=0
ignore_failures=0
nocleanup=0
verbose=1
while [ $# -gt 0 ]
do 
	case "$1" in
	-a*) # all
		all_tests=1; full=1; shift;;
	-c*) # continue
		ignore_failures=1; shift;;
	-f*) # full
		full=1; shift;;
	-nocleanup)
		nocleanup=1; shift;;
	-q*)
		verbose=0; shift;;
	*)
		echo "Unrecognized option: $1, ignoring"
		shift;;
	esac
done

# The set of full tests are those that have special env setup requirements
# or take a long time to run. They should be run at release time.
FULL_TESTS="s_chk_build_configs s_chk_vxworks"
EXCLUDE_TESTS="s_chk_logverify s_chk_srcfiles s_chk_java_samples"

# Run all s_chk scripts, files with extensions are used by the script with
# the shorter name, they shouldn't be run directly.
for t in `(cd validate && ls s_chk_* | grep -v "\.")`
do
	excluded=0
	for skip in $FULL_TESTS; do
		if [ $full = 0 -a "$t" = "$skip" ]; then
			echo "===!! Skipping $t ==="
			echo "=== Add -full to the command line to enable ==="
			excluded=1
			break;
		fi
	done
	for skip in $EXCLUDE_TESTS; do
		if [ $all_tests != 0 -a "$t" = "$skip" ]; then
			echo "===!! Skipping $t ==="
			echo "=== Add -all to the command line to enable ==="
			excluded=1
			break;
		fi
	done
	if [ $excluded != 0 ]; then
		continue
	fi

	echo "=== Running $t ==="
	if [ "$verbose" = 1 ]; then
		(cd validate && sh $t)
	else
		(cd validate && sh $t > /dev/null)
	fi
	ret_val=$?
	if [ "$ret_val" != 0 ]; then
		echo "=== Test $t reported a failure $ret_val." >&2
		if [ $ignore_failures = 0 ]; then
			exit $ret_val
		fi
	else
		echo "=== Test $t passed, $ret_val"
	fi
	rm -f validate/__?
done
echo "Finished running validate tests."