Removed line numbers from the SQL scripts output.
[gnucomo.git] / test / t0008.sh
1 #!/bin/sh
2
3 #
4 #  Test the database upgrades in gcm_daemon.
5 #  Create an old, version 1, database and run gcm_daemon to perform
6 #  an upgrade to the latest version.
7 #  Then, create a latest-version database and compare dumps of these
8 #  database. They should be essentially the same.
9
10 cd ..
11
12 if psql gnucomo_test <test/create_v1.sql -q >/dev/null
13 then
14    src/gcm_daemon/gcm_daemon.php -c gnucomo_test
15    pg_dump gnucomo_test |grep -v '^--' | sort >test/dump.upgraded.sql
16    psql gnucomo_test -f src/database/destroy.sql -q
17    psql gnucomo_test <src/database/create.sql -q >/dev/null
18    pg_dump gnucomo_test |grep -v '^--' | sort >test/dump.latest.sql
19    psql gnucomo_test -f src/database/destroy.sql -q
20
21    #  Expect 28 lines of diff output (character varying vs. text types)
22    diff test/dump.latest.sql test/dump.upgraded.sql
23
24    exit 0
25 else
26    echo Can not create test database
27    exit 1
28 fi