~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to xtra/pgscript/file/test/execute.sh

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2013-09-10 16:16:38 UTC
  • mfrom: (1.3.4)
  • Revision ID: package-import@ubuntu.com-20130910161638-wwup1q553ylww7dr
Tags: 1.18.0-1
* New upstream release.
* Don't install /usr/bin/png2c anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
#############
4
 
## Options ##
5
 
#############
6
 
 
7
 
# Default parameters for pgScript if nothing is provided (see Usage).
8
 
DEFAULTPARAM="-h 127.0.0.1 -U postgres -d testbase"
9
 
 
10
 
##################
11
 
## Main program ##
12
 
##################
13
 
 
14
 
echo "Runs integration tests"
15
 
echo "Usage: $0 [parameters for db connection]"
16
 
echo ""
17
 
 
18
 
THISDIR=`dirname $0`
19
 
PREVDIR="$PWD"
20
 
 
21
 
echo -n "cd $THISDIR... "
22
 
cd "$THISDIR"
23
 
echo "done"
24
 
echo ""
25
 
 
26
 
# Get parameters for database connections
27
 
if test "$*" == ""
28
 
then
29
 
        PARAMETERS="$DEFAULTPARAM" # Default if nothing is provided
30
 
else
31
 
        PARAMETERS="$*"
32
 
fi
33
 
echo -e "- Using '$PARAMETERS' \n  for database connection"
34
 
 
35
 
# Try to find pgScript
36
 
PGS1="./../../src/pgScript"
37
 
PGS2="./../../bin/pgScript"
38
 
if test -f "$PGS1"
39
 
then
40
 
        PGS="$PGS1"
41
 
else
42
 
        if test -f "$PGS2"
43
 
        then
44
 
                PGS="$PGS2"
45
 
        else
46
 
                echo "- pgScript executable not found: please configure script"
47
 
                exit
48
 
        fi
49
 
fi
50
 
echo "- pgScript at '$PGS' found"
51
 
echo "- Check output below: no [EXCEPTION] should appear."
52
 
echo ""
53
 
 
54
 
# Execute pgScript programs
55
 
echo "############# RUNNING  TESTS #############"
56
 
 
57
 
for src in `ls ./source/*.sql.pgs`; do
58
 
        output=$($PGS $PARAMETERS -e cp1252 "$src" 2>&1 >/dev/null)
59
 
        echo "$output" | awk '{
60
 
                if ($1 == "[QUERY")
61
 
                {
62
 
                        query=1
63
 
                }
64
 
                else if ($1 != "[QUERY" && query == 0)
65
 
                {
66
 
                        print $0
67
 
                        query=0
68
 
                }}'
69
 
done
70
 
echo "################## DONE ##################"
71
 
 
72
 
echo ""
73
 
echo -n "cd $PREVDIR... "
74
 
cd "$PREVDIR"
75
 
echo "done"