File: check.sh

package info (click to toggle)
tinyows 1.2.2-2
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 4,472 kB
  • sloc: ansic: 10,067; xml: 1,124; lex: 816; sql: 273; sh: 160; makefile: 82
file content (73 lines) | stat: -rwxr-xr-x 3,500 bytes parent folder | download | duplicates (3)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

set -eu

RET=0

PGUSER=postgres
DB=tinyows_demo

for i in demo/tests/input/*; do
    echo "Running $i"
    QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt
    if ! diff -u /tmp/output.txt demo/tests/expected/$(basename $i); then
        mkdir -p demo/tests/got
        mv /tmp/output.txt demo/tests/got/$(basename $i)
        echo "Result got put in demo/tests/got/$(basename $i)"
        RET=1
    fi
done

if test "$RET" -eq "0"; then
    echo "Tests OK !"
else
    echo "Tests failed !"
    exit $RET
fi

i=demo/tests/transactions/input/wfst10_france_insert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false)
echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))"
echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB"


i=demo/tests/transactions/input/wfst10_world_insert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false)
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"


i=demo/tests/transactions/input/wfst11_france_insert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))"
echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB"


i=demo/tests/transactions/input/wfst11_world_insert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"


i=demo/tests/transactions/input/wfst11_world_insert_srsname_in_wfsinsert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"


i=demo/tests/transactions/input/wfst11_geometry_less_insert.xml
echo "Running $i"
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
echo "select textcol from geometry_less where intcol = -1234;" | su $PGUSER -c "psql -t $DB" | grep "minus 1234"
echo "delete from geometry_less where intcol = -1234" | su $PGUSER -c "psql $DB"