summaryrefslogtreecommitdiff
path: root/tests/driver.sh
blob: d20809d0e8b6659c8770fcce9c863e15964e84da (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
#!/bin/bash

if [[ $# -eq 0 ]] ; then
    echo 'Supply at least one argument'
    exit 1
fi

TESTDB=/tmp/$1.db
TESTSQL=/tmp/$1.sql
TESTPID=/tmp/$1.pid
TESTSRV=./$1.exe

rm -f $TESTDB $TESTSQL $TESTPID $TESTSRV
../bin/urweb -debug -boot -noEmacs -dbms sqlite -db $TESTDB -sql $TESTSQL "$1" || exit 1

if [ -e $TESTSQL ]
then
    sqlite3 $TESTDB < $TESTSQL
fi

$TESTSRV -q -a 127.0.0.1 &
echo $! >> $TESTPID
sleep 1
if [[ $# -eq 1 ]] ; then
    python3 -m unittest $1.py
else
    python3 -m unittest $1.Suite.$2
fi
kill `cat $TESTPID`