Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 77d63b7

Browse files
committed
Fix more portability issues in new pgbench TAP tests.
* Remove no-such-user test case, output isn't stable, and we really don't need to be testing such cases here anyway. * Fix the process exit code test logic to match PostgresNode::psql (but I didn't bother with looking at the "core" flag). * Give up on inf/nan tests. Per buildfarm.
1 parent ee24d2b commit 77d63b7

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ sub pgbench
6868
qr{FATAL: database "no-such-database" does not exist} ],
6969
'no such database');
7070

71-
pgbench(
72-
'-U no-such-user template0',
73-
1,
74-
[qr{^$}],
75-
[ qr{connection to database "template0" failed},
76-
qr{FATAL: role "no-such-user" does not exist} ],
77-
'no such user');
78-
7971
pgbench(
8072
'-S -t 1', 1, [qr{^$}],
8173
[qr{Perhaps you need to do initialization}],
@@ -89,7 +81,7 @@ sub pgbench
8981

9082
# Again, with all possible options
9183
pgbench(
92-
'--initialize --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default',
84+
'--initialize --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default',
9385
0,
9486
[qr{^$}i],
9587
[ qr{creating tables},
@@ -217,10 +209,7 @@ sub pgbench
217209
qr{command=18.: double 18\b},
218210
qr{command=19.: double 19\b},
219211
qr{command=20.: double 20\b},
220-
qr{command=21.: double -?nan}i,
221-
qr{command=22.: double inf}i,
222-
qr{command=23.: double -inf}i,
223-
qr{command=24.: int 9223372036854775807\b}, ],
212+
qr{command=21.: int 9223372036854775807\b}, ],
224213
'pgbench expressions',
225214
{ '001_pgbench_expressions' => q{-- integer functions
226215
\set i1 debug(random(1, 100))
@@ -246,10 +235,7 @@ sub pgbench
246235
\set d6 debug((0.5 * 12.1 - 0.05) * (31.0 / 10))
247236
\set d7 debug(11.1 + 7.9)
248237
\set d8 debug(:foo * -2)
249-
-- special values
250-
\set nan debug(0.0 / 0.0)
251-
\set pin debug(1.0 / 0.0)
252-
\set nin debug(-1.0 / 0.0)
238+
-- forced overflow
253239
\set maxint debug(:minint - 1)
254240
-- reset a variable
255241
\set i1 0

src/test/perl/TestLib.pm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,20 +340,22 @@ sub command_fails_like
340340
# - test_name: name of test
341341
sub command_checks_all
342342
{
343-
my ($cmd, $ret, $out, $err, $test_name) = @_;
343+
my ($cmd, $expected_ret, $out, $err, $test_name) = @_;
344344

345345
# run command
346346
my ($stdout, $stderr);
347347
print("# Running: " . join(" ", @{$cmd}) . "\n");
348348
IPC::Run::run($cmd, '>', \$stdout, '2>', \$stderr);
349349

350-
# On Windows, the exit status of the process is returned directly as the
351-
# process's exit code, while on Unix, it's returned in the high bits
352-
# of the exit code.
353-
my $status = $windows_os ? $? : $? >> 8;
350+
# See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
351+
my $ret = $?;
352+
die "command exited with signal " . ($ret & 127)
353+
if $ret & 127;
354+
$ret = $ret >> 8;
354355

355356
# check status
356-
ok($ret == $status, "$test_name status (got $status vs expected $ret)");
357+
ok($ret == $expected_ret,
358+
"$test_name status (got $ret vs expected $expected_ret)");
357359

358360
# check stdout
359361
for my $re (@$out)

0 commit comments

Comments
 (0)