Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7dd3ee5

Browse files
committed
Fix several issues with the TAP tests of pg_upgrade
This commit addresses the following issues in the TAP tests ofpg_upgrade, introduced in322becb:- Remove --port and --host for commands that already rely on a node'senvironment PGHOST and PGPORT.- Switch from run_log() to command_ok(), as all the commands executed inthe tests should succeed.- Change EXTRA_REGRESS_OPTS to make it count as a shell fragment (fixings/OPT/OPTS on a way), to be compatible with the various Makefiles usingit as well as 027_stream_regress.pl in the recovery tests. The commandbuilt for the execution the pg_regress command is reformatted, while onit, to map with the recovery test doing the same thing (we shouldrefactor and consolidate that in the future, perhaps).- Re-add the test for database names stressing the behavior ofbackslashes with double quotes, mostly here for Windows.Tests doable with the upgrade across different major versions still workthe same way.Reported-by: Noah MischDiscussion:https://postgr.es/m/20220502042718.GB1565149@rfd.leadboat.com
1 parentfe20afa commit7dd3ee5

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

‎src/bin/pg_upgrade/t/002_pg_upgrade.pl

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ sub generate_db
2121
nextif$i == 7 ||$i == 10 ||$i == 13;# skip BEL, LF, and CR
2222
$dbname =$dbname .sprintf('%c',$i);
2323
}
24-
$node->run_log(
25-
['createdb','--host',$node->host,'--port',$node->port,$dbname ]
26-
);
24+
25+
# Exercise backslashes adjacent to double quotes, a Windows special
26+
# case.
27+
$dbname ='\\"\\' .$dbname .'\\\\"\\\\\\';
28+
$node->command_ok(['createdb',$dbname ]);
2729
}
2830

2931
# The test of pg_upgrade requires two clusters, an old one and a new one
@@ -70,12 +72,7 @@ sub generate_db
7072

7173
# Load the dump using the "postgres" database as "regression" does
7274
# not exist yet, and we are done here.
73-
$oldnode->command_ok(
74-
[
75-
'psql','-X','-f',$olddumpfile,
76-
'--port',$oldnode->port,'--host',$oldnode->host,
77-
'postgres'
78-
]);
75+
$oldnode->command_ok(['psql','-X','-f',$olddumpfile,'postgres' ]);
7976
}
8077
else
8178
{
@@ -87,8 +84,7 @@ sub generate_db
8784
generate_db($oldnode, 91, 127);
8885

8986
# Grab any regression options that may be passed down by caller.
90-
my$extra_opts_val =$ENV{EXTRA_REGRESS_OPT} ||"";
91-
my@extra_opts =split(/\s+/,$extra_opts_val);
87+
my$extra_opts =$ENV{EXTRA_REGRESS_OPTS} ||"";
9288

9389
# --dlpath is needed to be able to find the location of regress.so
9490
# and any libraries the regression tests require.
@@ -100,19 +96,19 @@ sub generate_db
10096
# --inputdir points to the path of the input files.
10197
my$inputdir ="$srcdir/src/test/regress";
10298

103-
my@regress_command = [
104-
$ENV{PG_REGRESS},@extra_opts,
105-
'--dlpath',$dlpath,
106-
'--max-concurrent-tests','20',
107-
'--bindir=','--host',
108-
$oldnode->host,'--port',
109-
$oldnode->port,'--schedule',
110-
"$srcdir/src/test/regress/parallel_schedule",'--outputdir',
111-
$outputdir,'--inputdir',
112-
$inputdir
113-
];
114-
115-
my$rc = run_log(@regress_command);
99+
my$rc =
100+
system($ENV{PG_REGRESS}
101+
."$extra_opts"
102+
."--dlpath=\"$dlpath\""
103+
."--bindir="
104+
."--host="
105+
.$oldnode->host .""
106+
."--port="
107+
.$oldnode->port .""
108+
."--schedule=$srcdir/src/test/regress/parallel_schedule"
109+
."--max-concurrent-tests=20"
110+
."--inputdir=\"$inputdir\""
111+
."--outputdir=\"$outputdir\"");
116112
if ($rc != 0)
117113
{
118114
# Dump out the regression diffs file, if there is one
@@ -133,12 +129,10 @@ sub generate_db
133129
{
134130
# Note that upgrade_adapt.sql from the new version is used, to
135131
# cope with an upgrade to this version.
136-
$oldnode->run_log(
132+
$oldnode->command_ok(
137133
[
138-
'psql','-X',
139-
'-f',"$srcdir/src/bin/pg_upgrade/upgrade_adapt.sql",
140-
'--port',$oldnode->port,
141-
'--host',$oldnode->host,
134+
'psql','-X',
135+
'-f',"$srcdir/src/bin/pg_upgrade/upgrade_adapt.sql",
142136
'regression'
143137
]);
144138
}
@@ -232,7 +226,7 @@ sub generate_db
232226
}
233227

234228
# Second dump from the upgraded instance.
235-
$newnode->run_log(
229+
$newnode->command_ok(
236230
[
237231
'pg_dumpall','--no-sync',
238232
'-d',$newnode->connstr('postgres'),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp