aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-09-08 13:36:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-09-08 13:36:13 -0400
commit77d63b7eafd44469c2766c1f29b75533981e4911 (patch)
treecd628ff0b69b079f6f5b3c36c29f7ee5ffe0ea59 /src
parentee24d2b5cf059cab83711992c0cf110ad44df5f9 (diff)
downloadpostgresql-77d63b7eafd44469c2766c1f29b75533981e4911.tar.gz
postgresql-77d63b7eafd44469c2766c1f29b75533981e4911.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pgbench/t/001_pgbench_with_server.pl20
-rw-r--r--src/test/perl/TestLib.pm14
2 files changed, 11 insertions, 23 deletions
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 66df4bc81b7..8458270637c 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -69,14 +69,6 @@ pgbench(
'no such database');
pgbench(
- '-U no-such-user template0',
- 1,
- [qr{^$}],
- [ qr{connection to database "template0" failed},
- qr{FATAL: role "no-such-user" does not exist} ],
- 'no such user');
-
-pgbench(
'-S -t 1', 1, [qr{^$}],
[qr{Perhaps you need to do initialization}],
'run without init');
@@ -89,7 +81,7 @@ pgbench(
# Again, with all possible options
pgbench(
- '--initialize --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default',
+'--initialize --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default',
0,
[qr{^$}i],
[ qr{creating tables},
@@ -217,10 +209,7 @@ pgbench(
qr{command=18.: double 18\b},
qr{command=19.: double 19\b},
qr{command=20.: double 20\b},
- qr{command=21.: double -?nan}i,
- qr{command=22.: double inf}i,
- qr{command=23.: double -inf}i,
- qr{command=24.: int 9223372036854775807\b}, ],
+ qr{command=21.: int 9223372036854775807\b}, ],
'pgbench expressions',
{ '001_pgbench_expressions' => q{-- integer functions
\set i1 debug(random(1, 100))
@@ -246,10 +235,7 @@ pgbench(
\set d6 debug((0.5 * 12.1 - 0.05) * (31.0 / 10))
\set d7 debug(11.1 + 7.9)
\set d8 debug(:foo * -2)
--- special values
-\set nan debug(0.0 / 0.0)
-\set pin debug(1.0 / 0.0)
-\set nin debug(-1.0 / 0.0)
+-- forced overflow
\set maxint debug(:minint - 1)
-- reset a variable
\set i1 0
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 0e73c991306..d1a2eb58837 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -340,20 +340,22 @@ sub command_fails_like
# - test_name: name of test
sub command_checks_all
{
- my ($cmd, $ret, $out, $err, $test_name) = @_;
+ my ($cmd, $expected_ret, $out, $err, $test_name) = @_;
# run command
my ($stdout, $stderr);
print("# Running: " . join(" ", @{$cmd}) . "\n");
IPC::Run::run($cmd, '>', \$stdout, '2>', \$stderr);
- # On Windows, the exit status of the process is returned directly as the
- # process's exit code, while on Unix, it's returned in the high bits
- # of the exit code.
- my $status = $windows_os ? $? : $? >> 8;
+ # See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
+ my $ret = $?;
+ die "command exited with signal " . ($ret & 127)
+ if $ret & 127;
+ $ret = $ret >> 8;
# check status
- ok($ret == $status, "$test_name status (got $status vs expected $ret)");
+ ok($ret == $expected_ret,
+ "$test_name status (got $ret vs expected $expected_ret)");
# check stdout
for my $re (@$out)