From f63e72522f48ec628b44864310307661e393a23b Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 17 Jan 2018 20:23:31 +0000 Subject: [PATCH] Testsuite: interlock Postgres server startup --- test/Makefile.in | 2 +- test/runtest | 5 ++++- test/scripts/2620-Postgresql/2620 | 7 ++++++- test/stdout/2620 | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index f67f8d1f5..dbf6d809c 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -27,7 +27,7 @@ all: binaries sysbinaries binaries: $(BINARIES) sysbinaries: FRC - sh -x bin/locate.sh initdb postgres pg_ctl mysqld + bin/locate.sh initdb postgres pg_ctl mysqld ls -la bin.sys # Compile and link the programs: diff --git a/test/runtest b/test/runtest index 89625e90d..484b799e9 100755 --- a/test/runtest +++ b/test/runtest @@ -661,7 +661,7 @@ RESET_AFTER_EXTRA_LINE_READ: s/\bgid=\d+/gid=gggg/; s/\begid=\d+/egid=gggg/; - s/\bpid=\d+/pid=pppp/; + s/\b(pid=|PID: )\d+/$1pppp/; s/\buid=\d+/uid=uuuu/; s/\beuid=\d+/euid=uuuu/; s/set_process_info:\s+\d+/set_process_info: pppp/; @@ -922,6 +922,9 @@ RESET_AFTER_EXTRA_LINE_READ: # subsecond timstamp info in reported header-files s/^(-received_time_usec \.)\d{6}$/$1uuuuuu/; + + # Postgres server takes varible time to shut down + s/^waiting for server to shut down\.+ done$/waiting for server to shut down.... done/; } # ======== stderr ======== diff --git a/test/scripts/2620-Postgresql/2620 b/test/scripts/2620-Postgresql/2620 index 1f8f3abe1..a96b71930 100644 --- a/test/scripts/2620-Postgresql/2620 +++ b/test/scripts/2620-Postgresql/2620 @@ -4,6 +4,7 @@ # # first, populate a DB to test against sudo rm -fr DIR/pgsql +echo Starting DB server perl system 'DIR/bin.sys/initdb -D DIR/pgsql/data'; **** @@ -12,7 +13,9 @@ background DIR/bin.sys/postgres -D DIR/pgsql/data -p PORT_N -k DIR/pgsql **** sleep 1 +echo Waiting for DB server perl +system 'DIR/bin.sys/pg_ctl -w -D DIR/pgsql/data status'; system 'createdb -h localhost -p PORT_N test'; system 'psql -h localhost -p PORT_N -d test \ -c "CREATE TABLE them ( name text, id text ); \ @@ -25,6 +28,7 @@ system 'psql -h localhost -p PORT_N -d test \ INSERT INTO them VALUES ( CHR(39) || \'stquot\', \'quote1\' );" \ '; **** +echo Populated DB server # # now, the tests exim -d-all+lookup -be @@ -62,7 +66,8 @@ ${lookup pgsql {select name from them where id='ph10';}} **** # perl -system 'pg_ctl stop -D DIR/pgsql/data -m immediate'; +system 'DIR/bin.sys/pg_ctl stop -D DIR/pgsql/data -m immediate'; **** +sleep 2 killdaemon sudo rm -fr DIR/pgsql diff --git a/test/stdout/2620 b/test/stdout/2620 index 4f907c1bc..74b91abee 100644 --- a/test/stdout/2620 +++ b/test/stdout/2620 @@ -1,3 +1,5 @@ +pg_ctl: server is running (PID: pppp) +/usr/bin/postgres "-D" "TESTSUITE/pgsql/data" "-p" "1223" "-k" "TESTSUITE/pgsql" INSERT 0 1 > Philip Hazel > Philip Hazel -- 2.30.2