diff options
Diffstat (limited to 'src/test/perl/PostgreSQL')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Cluster.pm | 12 | ||||
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Utils.pm | 16 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 4ea10d063c4..b08296605c4 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -467,7 +467,7 @@ sub set_replication_conf $self->host eq $test_pghost or croak "set_replication_conf only works with the default host"; - open my $hba, '>>', "$pgdata/pg_hba.conf"; + open my $hba, '>>', "$pgdata/pg_hba.conf" or die $!; print $hba "\n# Allow replication (set up by PostgreSQL::Test::Cluster.pm)\n"; if ($PostgreSQL::Test::Utils::windows_os @@ -580,7 +580,7 @@ sub init PostgreSQL::Test::Utils::system_or_bail($ENV{PG_REGRESS}, '--config-auth', $pgdata, @{ $params{auth_extra} }); - open my $conf, '>>', "$pgdata/postgresql.conf"; + open my $conf, '>>', "$pgdata/postgresql.conf" or die $!; print $conf "\n# Added by PostgreSQL::Test::Cluster.pm\n"; print $conf "fsync = off\n"; print $conf "restart_after_crash = off\n"; @@ -862,7 +862,7 @@ sub init_from_backup rmdir($data_path); PostgreSQL::Test::RecursiveCopy::copypath($backup_path, $data_path); } - chmod(0700, $data_path); + chmod(0700, $data_path) or die $!; # Base configuration for this node $self->append_conf( @@ -1688,16 +1688,16 @@ sub _reserve_port if (kill 0, $pid) { # process exists and is owned by us, so we can't reserve this port - flock($portfile, LOCK_UN); + flock($portfile, LOCK_UN) || die $!; close($portfile); return 0; } } # All good, go ahead and reserve the port - seek($portfile, 0, SEEK_SET); + seek($portfile, 0, SEEK_SET) || die $!; # print the pid with a fixed width so we don't leave any trailing junk print $portfile sprintf("%10d\n", $$); - flock($portfile, LOCK_UN); + flock($portfile, LOCK_UN) || die $!; close($portfile); push(@port_reservation_files, $filename); return 1; diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 2185a079def..42d5a50dc88 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -211,10 +211,10 @@ INIT or die "could not open STDOUT to logfile \"$test_logfile\": $!"; # Hijack STDOUT and STDERR to the log file - open(my $orig_stdout, '>&', \*STDOUT); - open(my $orig_stderr, '>&', \*STDERR); - open(STDOUT, '>&', $testlog); - open(STDERR, '>&', $testlog); + open(my $orig_stdout, '>&', \*STDOUT) or die $!; + open(my $orig_stderr, '>&', \*STDERR) or die $!; + open(STDOUT, '>&', $testlog) or die $!; + open(STDERR, '>&', $testlog) or die $!; # The test output (ok ...) needs to be printed to the original STDOUT so # that the 'prove' program can parse it, and display it to the user in @@ -564,7 +564,7 @@ Find and replace string of a given file. sub string_replace_file { my ($filename, $find, $replace) = @_; - open(my $in, '<', $filename); + open(my $in, '<', $filename) or croak $!; my $content = ''; while (<$in>) { @@ -572,7 +572,7 @@ sub string_replace_file $content = $content . $_; } close $in; - open(my $out, '>', $filename); + open(my $out, '>', $filename) or croak $!; print $out $content; close($out); @@ -789,11 +789,11 @@ sub dir_symlink # need some indirection on msys $cmd = qq{echo '$cmd' | \$COMSPEC /Q}; } - system($cmd); + system($cmd) == 0 or die; } else { - symlink $oldname, $newname; + symlink $oldname, $newname or die $!; } die "No $newname" unless -e $newname; } |