diff options
Diffstat (limited to 'src/test')
| -rwxr-xr-x | src/test/locale/sort-test.pl | 6 | ||||
| -rw-r--r-- | src/test/perl/PostgresNode.pm | 8 | ||||
| -rw-r--r-- | src/test/perl/TestLib.pm | 16 | ||||
| -rw-r--r-- | src/test/ssl/ServerSetup.pm | 48 |
4 files changed, 39 insertions, 39 deletions
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl index cb7e4934e4..b8fc93aab1 100755 --- a/src/test/locale/sort-test.pl +++ b/src/test/locale/sort-test.pl @@ -3,9 +3,9 @@ use strict; use locale; -open(INFILE, "<$ARGV[0]"); -chop(my (@words) = <INFILE>); -close(INFILE); +open(my $in_fh, '<', $ARGV[0]) || die; +chop(my (@words) = <$in_fh>); +close($in_fh); $" = "\n"; my (@result) = sort @words; diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 5ef007f7d4..1ad8f7fc1c 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -347,7 +347,7 @@ sub set_replication_conf $self->host eq $test_pghost or die "set_replication_conf only works with the default host"; - open my $hba, ">>$pgdata/pg_hba.conf"; + open my $hba, '>>', "$pgdata/pg_hba.conf"; print $hba "\n# Allow replication (set up by PostgresNode.pm)\n"; if ($TestLib::windows_os) { @@ -399,7 +399,7 @@ sub init @{ $params{extra} }); TestLib::system_or_bail($ENV{PG_REGRESS}, '--config-auth', $pgdata); - open my $conf, ">>$pgdata/postgresql.conf"; + open my $conf, '>>', "$pgdata/postgresql.conf"; print $conf "\n# Added by PostgresNode.pm\n"; print $conf "fsync = off\n"; print $conf "log_line_prefix = '%m [%p] %q%a '\n"; @@ -820,7 +820,7 @@ sub _update_pid # If we can open the PID file, read its first line and that's the PID we # want. If the file cannot be opened, presumably the server is not # running; don't be noisy in that case. - if (open my $pidfile, $self->data_dir . "/postmaster.pid") + if (open my $pidfile, '<', $self->data_dir . "/postmaster.pid") { chomp($self->{_pid} = <$pidfile>); print "# Postmaster PID for node \"$name\" is $self->{_pid}\n"; @@ -1357,7 +1357,7 @@ sub lsn chomp($result); if ($result eq '') { - return undef; + return; } else { diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index d22957ceb0..ae8d1782da 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -84,14 +84,14 @@ INIT $test_logfile = basename($0); $test_logfile =~ s/\.[^.]+$//; $test_logfile = "$log_path/regress_log_$test_logfile"; - open TESTLOG, '>', $test_logfile + open my $testlog, '>', $test_logfile or die "could not open STDOUT to logfile \"$test_logfile\": $!"; # Hijack STDOUT and STDERR to the log file - open(ORIG_STDOUT, ">&STDOUT"); - open(ORIG_STDERR, ">&STDERR"); - open(STDOUT, ">&TESTLOG"); - open(STDERR, ">&TESTLOG"); + open(my $orig_stdout, '>&', \*STDOUT); + open(my $orig_stderr, '>&', \*STDERR); + open(STDOUT, '>&', $testlog); + open(STDERR, '>&', $testlog); # 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 @@ -99,16 +99,16 @@ INIT # in the log. my $builder = Test::More->builder; my $fh = $builder->output; - tie *$fh, "SimpleTee", *ORIG_STDOUT, *TESTLOG; + tie *$fh, "SimpleTee", $orig_stdout, $testlog; $fh = $builder->failure_output; - tie *$fh, "SimpleTee", *ORIG_STDERR, *TESTLOG; + tie *$fh, "SimpleTee", $orig_stderr, $testlog; # Enable auto-flushing for all the file handles. Stderr and stdout are # redirected to the same file, and buffering causes the lines to appear # in the log in confusing order. autoflush STDOUT 1; autoflush STDERR 1; - autoflush TESTLOG 1; + autoflush $testlog 1; } END diff --git a/src/test/ssl/ServerSetup.pm b/src/test/ssl/ServerSetup.pm index 9441249b3a..6d17d6d61a 100644 --- a/src/test/ssl/ServerSetup.pm +++ b/src/test/ssl/ServerSetup.pm @@ -58,21 +58,21 @@ sub configure_test_server_for_ssl $node->psql('postgres', "CREATE DATABASE certdb"); # enable logging etc. - open CONF, ">>$pgdata/postgresql.conf"; - print CONF "fsync=off\n"; - print CONF "log_connections=on\n"; - print CONF "log_hostname=on\n"; - print CONF "listen_addresses='$serverhost'\n"; - print CONF "log_statement=all\n"; + open my $conf, '>>', "$pgdata/postgresql.conf"; + print $conf "fsync=off\n"; + print $conf "log_connections=on\n"; + print $conf "log_hostname=on\n"; + print $conf "listen_addresses='$serverhost'\n"; + print $conf "log_statement=all\n"; # enable SSL and set up server key - print CONF "include 'sslconfig.conf'"; + print $conf "include 'sslconfig.conf'"; - close CONF; + close $conf; # ssl configuration will be placed here - open SSLCONF, ">$pgdata/sslconfig.conf"; - close SSLCONF; + open my $sslconf, '>', "$pgdata/sslconfig.conf"; + close $sslconf; # Copy all server certificates and keys, and client root cert, to the data dir copy_files("ssl/server-*.crt", $pgdata); @@ -100,13 +100,13 @@ sub switch_server_cert diag "Reloading server with certfile \"$certfile\" and cafile \"$cafile\"..."; - open SSLCONF, ">$pgdata/sslconfig.conf"; - print SSLCONF "ssl=on\n"; - print SSLCONF "ssl_ca_file='$cafile.crt'\n"; - print SSLCONF "ssl_cert_file='$certfile.crt'\n"; - print SSLCONF "ssl_key_file='$certfile.key'\n"; - print SSLCONF "ssl_crl_file='root+client.crl'\n"; - close SSLCONF; + open my $sslconf, '>', "$pgdata/sslconfig.conf"; + print $sslconf "ssl=on\n"; + print $sslconf "ssl_ca_file='root+client_ca.crt'\n"; + print $sslconf "ssl_cert_file='$certfile.crt'\n"; + print $sslconf "ssl_key_file='$certfile.key'\n"; + print $sslconf "ssl_crl_file='root+client.crl'\n"; + close $sslconf; $node->reload; } @@ -121,16 +121,16 @@ sub configure_hba_for_ssl # but seems best to keep it as narrow as possible for security reasons. # # When connecting to certdb, also check the client certificate. - open HBA, ">$pgdata/pg_hba.conf"; - print HBA + open my $hba, '>', "$pgdata/pg_hba.conf"; + print $hba "# TYPE DATABASE USER ADDRESS METHOD\n"; - print HBA + print $hba "hostssl trustdb ssltestuser $serverhost/32 trust\n"; - print HBA + print $hba "hostssl trustdb ssltestuser ::1/128 trust\n"; - print HBA + print $hba "hostssl certdb ssltestuser $serverhost/32 cert\n"; - print HBA + print $hba "hostssl certdb ssltestuser ::1/128 cert\n"; - close HBA; + close $hba; } |
