Skip to content

Commit eaa5ebe

Browse files
committed
Improve and fix some issues in the TAP tests of pg_upgrade
This is based on a set of suggestions from Noah, with the following changes made: - The set of databases created in the tests are now prefixed with "regression" to not trigger any warnings with name restrictions when compiling the code with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, and now only the first name checks after the Windows case of double quotes mixed with backslashes. - Fix an issue with EXTRA_REGRESS_OPTS, which were not processed in a way consistent with 027_stream_regress.pl (missing space between the option string and pg_regress). This got introduced in 7dd3ee5. - Add a check on the exit code of the pg_regress command, to catch failures after running the regression tests. Reviewed-by: Noah Misch Discussion: https://postgr.es/m/YoHhWD5vQzb2mmiF@paquier.xyz
1 parent 5e5fa32 commit eaa5ebe

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@
1313
# Generate a database with a name made of a range of ASCII characters.
1414
sub generate_db
1515
{
16-
my ($node, $from_char, $to_char) = @_;
16+
my ($node, $prefix, $from_char, $to_char, $suffix) = @_;
1717

18-
my $dbname = '';
18+
my $dbname = $prefix;
1919
for my $i ($from_char .. $to_char)
2020
{
2121
next if $i == 7 || $i == 10 || $i == 13; # skip BEL, LF, and CR
2222
$dbname = $dbname . sprintf('%c', $i);
2323
}
2424

25-
# Exercise backslashes adjacent to double quotes, a Windows special
26-
# case.
27-
$dbname = '\\"\\' . $dbname . '\\\\"\\\\\\';
25+
$dbname .= $suffix;
2826
$node->command_ok([ 'createdb', $dbname ]);
2927
}
3028

@@ -79,10 +77,12 @@ sub generate_db
7977
{
8078
# Default is to use pg_regress to set up the old instance.
8179

82-
# Create databases with names covering most ASCII bytes
83-
generate_db($oldnode, 1, 45);
84-
generate_db($oldnode, 46, 90);
85-
generate_db($oldnode, 91, 127);
80+
# Create databases with names covering most ASCII bytes. The
81+
# first name exercises backslashes adjacent to double quotes, a
82+
# Windows special case.
83+
generate_db($oldnode, 'regression\\"\\', 1, 45, '\\\\"\\\\\\');
84+
generate_db($oldnode, 'regression', 46, 90, '');
85+
generate_db($oldnode, 'regression', 91, 127, '');
8686

8787
# Grab any regression options that may be passed down by caller.
8888
my $extra_opts = $ENV{EXTRA_REGRESS_OPTS} || "";
@@ -99,7 +99,7 @@ sub generate_db
9999

100100
my $rc =
101101
system($ENV{PG_REGRESS}
102-
. "$extra_opts "
102+
. " $extra_opts "
103103
. "--dlpath=\"$dlpath\" "
104104
. "--bindir= "
105105
. "--host="
@@ -121,6 +121,7 @@ sub generate_db
121121
print "=== EOF ===\n";
122122
}
123123
}
124+
is($rc, 0, 'regression tests pass');
124125
}
125126

126127
# Before dumping, get rid of objects not existing or not supported in later

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy