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

branch
webdav
changeset 287
a171da778817
child 288
7dd45173f68a
equal deleted inserted replaced
286:864e2d701dd4 287:a171da778817
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 "## stop database"
45 pg_ctl -D $TESTDB_ABS stop
46 exit $?
47
48
49

mercurial