File: run-tests.sh

package info (click to toggle)
lua-gtk 0.8%2B20080510%2Bdash-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,236 kB
  • ctags: 1,308
  • sloc: ansic: 6,659; sh: 717; makefile: 114
file content (37 lines) | stat: -rwxr-xr-x 753 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
#! /bin/bash
# Run all Tests and shows a summary.  Any error messages are written to the
# log file.  Returns the number of errors as exit code.
#
# Copyright (C) 2007 by Wolfgang Oertl
#


TESTS=0
ERRORS=0
LOGFILE="tests.log"

# change to the directory where this script is in.
BASEDIR="${0%/*}"
cd "$BASEDIR"

echo "** Running tests. `date`" >> $LOGFILE

# run all Lua files in this directory.
for i in [0-9]*.lua; do
	TESTS=$(( $TESTS + 1 ))
	echo "- running $i" >> $LOGFILE
	RESULT=$(lua $i 2>&1)
	RC=$?
	if test $RC -ne 0; then
		echo "* FAILED $i with rc=$RC" >> $LOGFILE
		echo "$RESULT" >> $LOGFILE
		echo "" >> $LOGFILE
		ERRORS=$(( $ERRORS + 1 ))
	else
		:
	fi
done

echo "** $TESTS tests performed, $ERRORS errors." >> $LOGFILE
exit $ERRORS