]> arthur.barton.de Git - ngircd-alex.git/blob - src/testsuite/tests.sh
f820628f8d1102bb7c1da297d3a24bffffe379b1
[ngircd-alex.git] / src / testsuite / tests.sh
1 #!/bin/sh
2 #
3 # ngIRCd Test Suite
4 # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
11 #
12
13 # detect source directory
14 [ -z "$srcdir" ] && srcdir=`dirname $0`
15
16 name=`basename $0`
17 test=`echo ${name} | cut -d '.' -f 1`
18 [ -d logs ] || mkdir logs
19
20 if [ ! -r "$test" ]; then
21   echo "${name}: test \"$test\" not found!";  exit 77
22   exit 1
23 fi
24
25 # read in functions
26 . ${srcdir}/functions.inc
27
28 type expect > /dev/null 2>&1
29 if [ $? -ne 0 ]; then
30   echo "${name}: \"expect\" not found.";  exit 77
31 fi
32 type telnet > /dev/null 2>&1
33 if [ $? -ne 0 ]; then
34   echo "${name}: \"telnet\" not found.";  exit 77
35 fi
36
37 echo_n "running ${test} ..."
38 expect ${srcdir}/${test}.e > logs/${test}.log 2>&1; r=$?
39 [ $r -eq 0 ] && echo " ok." || echo " failure!"
40
41 exit $r
42
43 # -eof-