src/server/plugins/postgresql/test/createtestdb.sh

Fri, 29 Nov 2024 18:10:26 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 29 Nov 2024 18:10:26 +0100
changeset 564
f19fd264c69c
parent 288
7dd45173f68a
permissions
-rwxr-xr-x

fix wrong column name usage by pg prop extensions

287
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 BUILD_ROOT=../../../../..
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 PGTEST=$BUILD_ROOT/build/server/plugins/postgresql/test
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 TESTDB=$PGTEST/data
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 echo "## prepare testdb directory"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 rm -Rf $TESTDB
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 mkdir $TESTDB
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 if [ $? -ne 0 ]; then
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 exit 1
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 fi
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 TESTDB_ABS=`realpath $TESTDB`
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 echo "testdb path: " $TESTDB_ABS
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 echo "## init testdb"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 initdb -D $TESTDB_ABS
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 if [ $? -ne 0 ]; then
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 exit 1
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 fi
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 cp pg/postgresql.conf $TESTDB
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 mkdir $TESTDB/run
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 echo "## start database"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 pg_ctl -D $TESTDB_ABS start
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 if [ $? -ne 0 ]; then
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 echo "## start failed"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 exit 1
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 fi
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 echo "## create testdb"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 createdb -h $TESTDB_ABS/run testdb
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 if [ $? -ne 0 ]; then
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 echo "## createdb failed"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 echo "## stop database"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 pg_ctl -D $TESTDB_ABS stop
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 exit 1
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 fi
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 echo "success"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
288
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
44 echo "## create test data"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
45 psql -h $TESTDB_ABS/run -d testdb -f postgresql_vfs.sql
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
46 if [ $? -ne 0 ]; then
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
47 echo "## create test data (1) failed"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
48 echo "## stop database"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
49 pg_ctl -D $TESTDB_ABS stop
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
50 exit 1
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
51 fi
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
52 psql -h $TESTDB_ABS/run -d testdb -f postgresql_vfs_testdata.sql
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
53 if [ $? -ne 0 ]; then
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
54 echo "## create test data (2) failed"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
55 echo "## stop database"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
56 pg_ctl -D $TESTDB_ABS stop
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
57 exit 1
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
58 fi
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
59 echo "success"
7dd45173f68a create pg test data
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 287
diff changeset
60
287
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 echo "## stop database"
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 pg_ctl -D $TESTDB_ABS stop
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 exit $?
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
a171da778817 prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66

mercurial