Commit e94f2bc8 authored by Tom Lane's avatar Tom Lane

Fix pgbench TAP test to work in VPATH builds.

Previously, it'd try to create log files under the source directory
not the build directory.  This fell over if the source isn't writable
by the building user.

Fabien Coelho

Discussion: https://postgr.es/m/alpine.DEB.2.20.1801101038340.2283@lancre
parent fd1a421f
...@@ -605,24 +605,26 @@ sub check_pgbench_logs ...@@ -605,24 +605,26 @@ sub check_pgbench_logs
ok(unlink(@logs), "remove log files"); ok(unlink(@logs), "remove log files");
} }
my $bdir = $node->basedir;
# with sampling rate # with sampling rate
pgbench( pgbench(
'-n -S -t 50 -c 2 --log --log-prefix=001_pgbench_log_2 --sampling-rate=0.5', "-n -S -t 50 -c 2 --log --log-prefix=$bdir/001_pgbench_log_2 --sampling-rate=0.5",
0, 0,
[ qr{select only}, qr{processed: 100/100} ], [ qr{select only}, qr{processed: 100/100} ],
[qr{^$}], [qr{^$}],
'pgbench logs'); 'pgbench logs');
check_pgbench_logs('001_pgbench_log_2', 1, 8, 92, check_pgbench_logs("$bdir/001_pgbench_log_2", 1, 8, 92,
qr{^0 \d{1,2} \d+ \d \d+ \d+$}); qr{^0 \d{1,2} \d+ \d \d+ \d+$});
# check log file in some detail # check log file in some detail
pgbench( pgbench(
'-n -b se -t 10 -l --log-prefix=001_pgbench_log_3', "-n -b se -t 10 -l --log-prefix=$bdir/001_pgbench_log_3",
0, [ qr{select only}, qr{processed: 10/10} ], 0, [ qr{select only}, qr{processed: 10/10} ],
[qr{^$}], 'pgbench logs contents'); [qr{^$}], 'pgbench logs contents');
check_pgbench_logs('001_pgbench_log_3', 1, 10, 10, check_pgbench_logs("$bdir/001_pgbench_log_3", 1, 10, 10,
qr{^\d \d{1,2} \d+ \d \d+ \d+$}); qr{^\d \d{1,2} \d+ \d \d+ \d+$});
# done # done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment