diff options
author | Andrew Dunstan | 2022-02-18 22:00:03 +0000 |
---|---|---|
committer | Andrew Dunstan | 2022-02-20 16:51:45 +0000 |
commit | 95d981338b241ce1d1b2346cfe2df509bb7243ca (patch) | |
tree | c5c4b5427d119aaa8550ee4a41b7bb08c5ab8a32 /src/test | |
parent | cf12541f2bd5fd34425ecbb99f056a30ca5b7cae (diff) |
Remove PostgreSQL::Test::Utils::perl2host completely
Commit f1ac4a74de disabled this processing, and as nothing has broken (as
expected) here we proceed to remove the routine and adjust all the call
sites.
Backpatch to release 10
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/modules/test_misc/t/002_tablespace.pl | 4 | ||||
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Cluster.pm | 4 | ||||
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Utils.pm | 58 | ||||
-rw-r--r-- | src/test/recovery/t/014_unlogged_reinit.pl | 4 | ||||
-rw-r--r-- | src/test/recovery/t/017_shm.pl | 2 | ||||
-rw-r--r-- | src/test/recovery/t/018_wal_optimize.pl | 2 | ||||
-rw-r--r-- | src/test/recovery/t/025_stuck_on_old_timeline.pl | 2 | ||||
-rw-r--r-- | src/test/recovery/t/027_stream_regress.pl | 4 | ||||
-rw-r--r-- | src/test/ssl/t/001_ssltests.pl | 4 | ||||
-rw-r--r-- | src/test/ssl/t/002_scram.pl | 2 | ||||
-rw-r--r-- | src/test/ssl/t/003_sslinfo.pl | 2 |
11 files changed, 13 insertions, 75 deletions
diff --git a/src/test/modules/test_misc/t/002_tablespace.pl b/src/test/modules/test_misc/t/002_tablespace.pl index 6fea419bb80..04e54394c12 100644 --- a/src/test/modules/test_misc/t/002_tablespace.pl +++ b/src/test/modules/test_misc/t/002_tablespace.pl @@ -14,10 +14,10 @@ $node->start; # Create a couple of directories to use as tablespaces. my $basedir = $node->basedir(); -my $TS1_LOCATION = PostgreSQL::Test::Utils::perl2host("$basedir/ts1"); +my $TS1_LOCATION = "$basedir/ts1"; $TS1_LOCATION =~ s/\/\.\//\//g; # collapse foo/./bar to foo/bar mkdir($TS1_LOCATION); -my $TS2_LOCATION = PostgreSQL::Test::Utils::perl2host("$basedir/ts2"); +my $TS2_LOCATION = "$basedir/ts2"; $TS2_LOCATION =~ s/\/\.\//\//g; mkdir($TS2_LOCATION); diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index ed70eff374b..702b4c2b1c1 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -1076,7 +1076,7 @@ primary_conninfo='$root_connstr' sub enable_restoring { my ($self, $root_node, $standby) = @_; - my $path = PostgreSQL::Test::Utils::perl2host($root_node->archive_dir); + my $path = $root_node->archive_dir; my $name = $self->name; print "### Enabling WAL restore for node \"$name\"\n"; @@ -1144,7 +1144,7 @@ sub set_standby_mode sub enable_archiving { my ($self) = @_; - my $path = PostgreSQL::Test::Utils::perl2host($self->archive_dir); + my $path = $self->archive_dir; my $name = $self->name; print "### Enabling WAL archiving for node \"$name\"\n"; diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 31e2b0315ee..fc8ca741943 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -24,7 +24,6 @@ PostgreSQL::Test::Utils - helper module for writing PostgreSQL's C<prove> tests. # Miscellanea print "on Windows" if $PostgreSQL::Test::Utils::windows_os; - my $path = PostgreSQL::Test::Utils::perl2host($backup_dir); ok(check_mode_recursive($stream_dir, 0700, 0600), "check stream dir permissions"); PostgreSQL::Test::Utils::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid); @@ -297,61 +296,6 @@ sub tempdir_short =pod -=item perl2host() - -Translate a virtual file name to a host file name. Currently, this is a no-op -except for the case of Perl=msys and host=mingw32. The subject need not -exist, but its parent or grandparent directory must exist unless cygpath is -available. - -The returned path uses forward slashes but has no trailing slash. - -=cut - -sub perl2host -{ - my ($subject) = @_; - return $subject; - if ($is_msys2) - { - # get absolute, windows type path - my $path = qx{cygpath -a -m "$subject"}; - if (!$?) - { - chomp $path; - $path =~ s!/$!!; - return $path if $path; - } - # fall through if this didn't work. - } - my $here = cwd; - my $leaf; - if (chdir $subject) - { - $leaf = ''; - } - else - { - $leaf = '/' . basename $subject; - my $parent = dirname $subject; - if (!chdir $parent) - { - $leaf = '/' . basename($parent) . $leaf; - $parent = dirname $parent; - chdir $parent or die "could not chdir \"$parent\": $!"; - } - } - - # this odd way of calling 'pwd -W' is the only way that seems to work. - my $dir = qx{sh -c "pwd -W"}; - chomp $dir; - $dir =~ s!/$!!; - chdir $here; - return $dir . $leaf; -} - -=pod - =item has_wal_read_bug() Returns true if $tmp_check is subject to a sparc64+ext4 bug that causes WAL @@ -727,8 +671,6 @@ sub dir_symlink my $newname = shift; if ($windows_os) { - $oldname = perl2host($oldname); - $newname = perl2host($newname); $oldname =~ s,/,\\,g; $newname =~ s,/,\\,g; my $cmd = qq{mklink /j "$newname" "$oldname"}; diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl index da77c1211ff..f3199fbd2e1 100644 --- a/src/test/recovery/t/014_unlogged_reinit.pl +++ b/src/test/recovery/t/014_unlogged_reinit.pl @@ -33,9 +33,7 @@ ok(-f "$pgdata/$baseUnloggedPath", 'main fork in base exists'); my $tablespaceDir = PostgreSQL::Test::Utils::tempdir; -my $realTSDir = PostgreSQL::Test::Utils::perl2host($tablespaceDir); - -$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$realTSDir'"); +$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'"); $node->safe_psql('postgres', 'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1'); diff --git a/src/test/recovery/t/017_shm.pl b/src/test/recovery/t/017_shm.pl index 678a252165e..88f9e2b9cd7 100644 --- a/src/test/recovery/t/017_shm.pl +++ b/src/test/recovery/t/017_shm.pl @@ -112,7 +112,7 @@ log_ipcs(); $gnat->start; log_ipcs(); -my $regress_shlib = PostgreSQL::Test::Utils::perl2host($ENV{REGRESS_SHLIB}); +my $regress_shlib = $ENV{REGRESS_SHLIB}; $gnat->safe_psql('postgres', <<EOSQL); CREATE FUNCTION wait_pid(int) RETURNS void diff --git a/src/test/recovery/t/018_wal_optimize.pl b/src/test/recovery/t/018_wal_optimize.pl index 1410e2f03b9..4700d49c10c 100644 --- a/src/test/recovery/t/018_wal_optimize.pl +++ b/src/test/recovery/t/018_wal_optimize.pl @@ -60,7 +60,6 @@ wal_skip_threshold = 0 # Setup my $tablespace_dir = $node->basedir . '/tablespace_other'; mkdir($tablespace_dir); - $tablespace_dir = PostgreSQL::Test::Utils::perl2host($tablespace_dir); my $result; # Test redo of CREATE TABLESPACE. @@ -152,7 +151,6 @@ wal_skip_threshold = 0 $copy_file, qq(20000,30000 20001,30001 20002,30002)); - $copy_file = PostgreSQL::Test::Utils::perl2host($copy_file); # Test truncation with inserted tuples using both INSERT and COPY. Tuples # inserted after the truncation should be seen. diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl index d113c8cc9c5..fd821242e89 100644 --- a/src/test/recovery/t/025_stuck_on_old_timeline.pl +++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl @@ -28,7 +28,7 @@ $node_primary->init(allows_streaming => 1, has_archiving => 1); # Note: consistent use of forward slashes here avoids any escaping problems # that arise from use of backslashes. That means we need to double-quote all # the paths in the archive_command -my $perlbin = PostgreSQL::Test::Utils::perl2host($^X); +my $perlbin = $^X; $perlbin =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os; my $archivedir_primary = $node_primary->archive_dir; $archivedir_primary =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os; diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl index 4f82a54f933..c40951b7baf 100644 --- a/src/test/recovery/t/027_stream_regress.pl +++ b/src/test/recovery/t/027_stream_regress.pl @@ -48,8 +48,8 @@ $node_standby_1->append_conf('postgresql.conf', 'max_standby_streaming_delay = 600s'); $node_standby_1->start; -my $dlpath = PostgreSQL::Test::Utils::perl2host(dirname($ENV{REGRESS_SHLIB})); -my $outputdir = PostgreSQL::Test::Utils::perl2host($PostgreSQL::Test::Utils::tmp_check); +my $dlpath = dirname($ENV{REGRESS_SHLIB}); +my $outputdir = $PostgreSQL::Test::Utils::tmp_check; # Run the regression tests against the primary. my $extra_opts = $ENV{EXTRA_REGRESS_OPTS} || ""; diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl index b8f8b65a8fc..5c5b16fbe74 100644 --- a/src/test/ssl/t/001_ssltests.pl +++ b/src/test/ssl/t/001_ssltests.pl @@ -51,7 +51,7 @@ foreach my $keyfile (@keys) "couldn't copy ssl/$keyfile to $cert_tempdir/$keyfile for permissions change: $!"; chmod 0600, "$cert_tempdir/$keyfile" or die "failed to change permissions on $cert_tempdir/$keyfile: $!"; - $key{$keyfile} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/$keyfile"); + $key{$keyfile} = "$cert_tempdir/$keyfile"; $key{$keyfile} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os; } @@ -63,7 +63,7 @@ copy("ssl/client.key", "$cert_tempdir/client_wrongperms.key") "couldn't copy ssl/client_key to $cert_tempdir/client_wrongperms.key for permission change: $!"; chmod 0644, "$cert_tempdir/client_wrongperms.key" or die "failed to change permissions on $cert_tempdir/client_wrongperms.key: $!"; -$key{'client_wrongperms.key'} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_wrongperms.key"); +$key{'client_wrongperms.key'} = "$cert_tempdir/client_wrongperms.key"; $key{'client_wrongperms.key'} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os; #### Set up the server. diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl index 41d231c55d0..4decd7a506d 100644 --- a/src/test/ssl/t/002_scram.pl +++ b/src/test/ssl/t/002_scram.pl @@ -94,7 +94,7 @@ $node->connect_fails( # be used in a different test, so the name of this temporary client key # is chosen here to be unique. my $cert_tempdir = PostgreSQL::Test::Utils::tempdir(); -my $client_tmp_key = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_scram.key"); +my $client_tmp_key = "$cert_tempdir/client_scram.key"; copy("ssl/client.key", "$cert_tempdir/client_scram.key") or die "couldn't copy ssl/client_key to $cert_tempdir/client_scram.key for permission change: $!"; diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl index f008ea65941..95742081f38 100644 --- a/src/test/ssl/t/003_sslinfo.pl +++ b/src/test/ssl/t/003_sslinfo.pl @@ -34,7 +34,7 @@ my $common_connstr; # The client's private key must not be world-readable, so take a copy # of the key stored in the code tree and update its permissions. my $cert_tempdir = PostgreSQL::Test::Utils::tempdir(); -my $client_tmp_key = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_ext.key"); +my $client_tmp_key = "$cert_tempdir/client_ext.key"; copy("ssl/client_ext.key", "$cert_tempdir/client_ext.key") or die "couldn't copy ssl/client_ext.key to $cert_tempdir/client_ext.key for permissions change: $!"; |