File: run.sh

package info (click to toggle)
scratchbox2 2.2.4-1debian1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,392 kB
  • ctags: 5,239
  • sloc: ansic: 21,734; sh: 4,360; perl: 2,170; cpp: 1,913; makefile: 610; python: 184
file content (68 lines) | stat: -rwxr-xr-x 1,127 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

#export SBOX_DIR=/scratchbox
#export SBOX_LOGIN=$SBOX_DIR/login

tdir=`mktemp -d test.XXXXXX` || exit 1
status=0

if [ x$1 = x ]; then
	tests="test-*.sh"
else
	tests=$1
fi

echo "*******************************"
echo "testing basic sb2 functionality"
echo "*******************************"
echo

sb2 sh ./init_tests.sh || exit 1

echo
echo OK
echo
echo "*******************************"
echo "running regression tests.."
echo "*******************************"
echo

for test in $tests
do
	name=`head -n1 $test | grep '^#' | cut -c3-`
	if [ x"$name" = x ]
	then
		name=`echo $test | cut -d- -f2- | cut -d. -f1 | tr - ' ' | tr _ ' '`
	fi

	echo -n "Running \"$name\" ... " >&2
	cp $test $tdir
	( cd ${tdir} ; sb2 sh ./$test ) > $tdir/out 2> $tdir/err
	retval=$?

	if [ $retval -eq 0 ]
	then
		echo "OK" >&2
	elif [ $retval -eq 66 ]
	then
		echo "DISABLED" >&2
	else
		echo "FAIL" >&2
		status=1
	fi

	if [ `stat -c %s $tdir/out` -ne 0 ]
	then
		echo -n 'Output:'
		sed 's/^/\t/' $tdir/out
	fi

	if [ `stat -c %s $tdir/err` -ne 0 ]
	then
		echo -n 'Errors:'
		sed 's/^/\t/' $tdir/err
	fi
done

rm -r $tdir
exit $status