This is a simple patch that does what it says on the tin. I ran into trouble with the pgbench TAP test *even before applying the patch*, but only because I was doing a VPATH build as a user without 'write' on the source tree (001_pgbench_with_server.pl tried to make pgbench create log files there). Bad me. Oddly, that was the only test in the whole tree to have such an issue, so here I add a pre-patch to fix that. Now my review needs a review. :)
Yep. I find the multiple chdir solution a little bit too extreme.ISTM that it should rather add the correct path to --log-prefix by prepending $node->basedir, like the pgbench function does for -f scripts.
See attached. -- Fabien.
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index e579334..ba7e363 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -611,24 +611,26 @@ sub check_pgbench_logs ok(unlink(@logs), "remove log files"); } +my $bdir = $node->basedir; + # with sampling rate 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, [ qr{select only}, qr{processed: 100/100} ], [qr{^$}], '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+$}); # check log file in some detail 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} ], [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+$}); # done