aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_ctl/t/002_status.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_ctl/t/002_status.pl')
-rw-r--r--src/bin/pg_ctl/t/002_status.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl
new file mode 100644
index 00000000000..e41c22fd5bd
--- /dev/null
+++ b/src/bin/pg_ctl/t/002_status.pl
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use TestLib;
+use Test::More tests => 2;
+
+my $tempdir = TestLib::tempdir;
+
+system_or_bail "initdb -D $tempdir/data -A trust >/dev/null";
+open CONF, ">>$tempdir/data/postgresql.conf";
+print CONF "listen_addresses = ''\n";
+print CONF "unix_socket_directories = '$tempdir'\n";
+close CONF;
+
+command_exit_is(['pg_ctl', 'status', '-D', "$tempdir/data"], 3, 'pg_ctl status with server not running');
+
+system_or_bail 'pg_ctl', '-s', '-l', "$tempdir/logfile", '-D', "$tempdir/data", '-w', 'start';
+command_exit_is(['pg_ctl', 'status', '-D', "$tempdir/data"], 0, 'pg_ctl status with server running');
+
+system_or_bail 'pg_ctl', '-s', 'stop', '-D', "$tempdir/data", '-m', 'fast';