aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_ctl/t/001_start_stop.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_ctl/t/001_start_stop.pl')
-rw-r--r--src/bin/pg_ctl/t/001_start_stop.pl40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 5f7b5eb96d8..8c86faf3ad5 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -15,10 +15,15 @@ program_help_ok('pg_ctl');
program_version_ok('pg_ctl');
program_options_handling_ok('pg_ctl');
-command_exit_is([ 'pg_ctl', 'start', '-D', "$tempdir/nonexistent" ],
+command_exit_is([ 'pg_ctl', 'start', '--pgdata' => "$tempdir/nonexistent" ],
1, 'pg_ctl start with nonexistent directory');
-command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
+command_ok(
+ [
+ 'pg_ctl', 'initdb',
+ '--pgdata' => "$tempdir/data",
+ '--options' => '--no-sync'
+ ],
'pg_ctl initdb');
command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
'configure authentication');
@@ -41,8 +46,9 @@ else
}
close $conf;
my $ctlcmd = [
- 'pg_ctl', 'start', '-D', "$tempdir/data", '-l',
- "$PostgreSQL::Test::Utils::log_path/001_start_stop_server.log"
+ 'pg_ctl', 'start',
+ '--pgdata' => "$tempdir/data",
+ '--log' => "$PostgreSQL::Test::Utils::log_path/001_start_stop_server.log"
];
command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
@@ -51,17 +57,23 @@ command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
# postmaster they start. Waiting more than the 2 seconds slop time allowed
# by wait_for_postmaster() prevents that mistake.
sleep 3 if ($windows_os);
-command_fails([ 'pg_ctl', 'start', '-D', "$tempdir/data" ],
+command_fails([ 'pg_ctl', 'start', '--pgdata' => "$tempdir/data" ],
'second pg_ctl start fails');
-command_ok([ 'pg_ctl', 'stop', '-D', "$tempdir/data" ], 'pg_ctl stop');
-command_fails([ 'pg_ctl', 'stop', '-D', "$tempdir/data" ],
+command_ok([ 'pg_ctl', 'stop', '--pgdata' => "$tempdir/data" ],
+ 'pg_ctl stop');
+command_fails([ 'pg_ctl', 'stop', '--pgdata' => "$tempdir/data" ],
'second pg_ctl stop fails');
# Log file for default permission test. The permissions won't be checked on
# Windows but we still want to do the restart test.
my $logFileName = "$tempdir/data/perm-test-600.log";
-command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data", '-l', $logFileName ],
+command_ok(
+ [
+ 'pg_ctl', 'restart',
+ '--pgdata' => "$tempdir/data",
+ '--log' => $logFileName
+ ],
'pg_ctl restart with server not running');
# Permissions on log file should be default
@@ -82,23 +94,27 @@ SKIP:
skip "group access not supported on Windows", 3
if ($windows_os || $Config::Config{osname} eq 'cygwin');
- system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data";
+ system_or_bail 'pg_ctl', 'stop', '--pgdata' => "$tempdir/data";
# Change the data dir mode so log file will be created with group read
# privileges on the next start
chmod_recursive("$tempdir/data", 0750, 0640);
command_ok(
- [ 'pg_ctl', 'start', '-D', "$tempdir/data", '-l', $logFileName ],
+ [
+ 'pg_ctl', 'start',
+ '--pgdata' => "$tempdir/data",
+ '--log' => $logFileName
+ ],
'start server to check group permissions');
ok(-f $logFileName);
ok(check_mode_recursive("$tempdir/data", 0750, 0640));
}
-command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data" ],
+command_ok([ 'pg_ctl', 'restart', '--pgdata' => "$tempdir/data" ],
'pg_ctl restart with server running');
-system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data";
+system_or_bail 'pg_ctl', 'stop', '--pgdata' => "$tempdir/data";
done_testing();