summaryrefslogtreecommitdiff
path: root/src/pl/plpython/test.sh
blob: facf29e2680fd52fe0227687461e38f0f048eb1c (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh

DBNAME=pltest

echo -n "*** Destroy $DBNAME."
dropdb $DBNAME > test.log 2>&1
# drop failure is ok...
echo " Done. ***"

echo -n "*** Create $DBNAME."
if createdb $DBNAME >> test.log 2>&1 ; then
  echo " Done. ***"
else
  echo " Failed!  See test.log. ***"
  exit 1
fi

echo -n "*** Create plpython."
if createlang plpythonu $DBNAME >> test.log 2>&1 ; then
  echo " Done. ***"
else
  echo " Failed!  See test.log. ***"
  exit 1
fi

echo -n "*** Create tables"
psql -q $DBNAME < plpython_schema.sql >> test.log 2>&1
echo -n ", data"
psql -q $DBNAME < plpython_populate.sql >> test.log 2>&1
echo -n ", and functions and triggers."
psql -q $DBNAME < plpython_function.sql >> test.log 2>&1
echo " Done. ***"

echo -n "*** Running feature tests."
psql -q -e $DBNAME < plpython_test.sql > feature.output 2>&1
echo " Done. ***"

echo -n "*** Running error handling tests."
psql -q -e $DBNAME < plpython_error.sql > error.output 2>&1
echo " Done. ***"

echo -n "*** Checking the results of the feature tests."
if diff -c feature.expected feature.output > feature.diff 2>&1 ; then
  echo -n " passed!"
else
  echo -n " failed!  Please examine feature.diff."
fi
echo " Done. ***"

echo -n "*** Checking the results of the error handling tests."
if diff -c error.expected error.output > error.diff 2>&1 ; then
  echo -n " passed!"
else
  echo -n " failed!  Please examine error.diff."
fi
echo " Done. ***"