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