summaryrefslogtreecommitdiffstats
path: root/tools/ocft/runocft
blob: d269a6bba67f5da52f947b2fea50c23f70cc1dec (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
OCFTDIR=/usr/share/resource-agents/ocft
CONFDIR=$OCFTDIR/configs

prereq_run() {
	eval "$@"
}
prereq_prog() {
	which $@
}

test_prereq() {
	local tp arg
	tp=`echo $prereq|sed 's/:.*//'`
	arg=`echo $prereq|sed 's/[a-z]*://'`
	prereq_$tp $arg >/dev/null 2>&1
}

rm -f ocft.FAILED
rc=0
while read f prereq; do
	if [ -n "$prereq" ] && ! test_prereq; then
		echo "$f: prerequisite not fulfilled, skipping"
		continue
	fi
	ocft make $f
	if ! ocft test $f; then
		echo $f >> ocft.FAILED
		rc=1
	fi
done < $OCFTDIR/runocft.prereq

if [ -f ocft.FAILED ]; then
	echo "The following ocft tests failed:"
	cat ocft.FAILED
fi

exit $rc