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

Commit 2cf15ec

Browse files
committed
Fix pgbench TAP tests to work with --disable-thread-safety.
Probably matters to nobody but me; but I'd like to still be able to get through the TAP tests on gaur/pademelon, from time to time.
1 parent c1602c7 commit 2cf15ec

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,18 @@ sub pgbench
126126
qr{receiving}, qr{executing} ],
127127
'pgbench select only');
128128

129+
# check if threads are supported
130+
my $nthreads = 2;
131+
132+
{
133+
my ($stderr);
134+
run_log([ 'pgbench', '-j', '2', '--bad-option' ], '2>', \$stderr);
135+
$nthreads = 1 if $stderr =~ 'threads are not supported on this platform';
136+
}
137+
129138
# run custom scripts
130139
pgbench(
131-
'-t 100 -c 1 -j 2 -M prepared -n',
140+
"-t 100 -c 1 -j $nthreads -M prepared -n",
132141
0,
133142
[ qr{type: multiple scripts},
134143
qr{mode: prepared},
@@ -439,11 +448,12 @@ sub check_pgbench_logs
439448
# note: --progress-timestamp is not tested
440449
pgbench(
441450
'-T 2 -P 1 -l --log-prefix=001_pgbench_log_1 --aggregate-interval=1'
442-
. ' -S -b se@2 --rate=20 --latency-limit=1000 -j 2 -c 3 -r',
451+
. ' -S -b se@2 --rate=20 --latency-limit=1000 -j ' . $nthreads
452+
. ' -c 3 -r',
443453
0,
444454
[ qr{type: multiple},
445455
qr{clients: 3},
446-
qr{threads: 2},
456+
qr{threads: $nthreads},
447457
qr{duration: 2 s},
448458
qr{script 1: .* select only},
449459
qr{script 2: .* select only},
@@ -452,8 +462,8 @@ sub check_pgbench_logs
452462
[ qr{vacuum}, qr{progress: 1\b} ],
453463
'pgbench progress');
454464

455-
# 2 threads 2 seconds, sometimes only one aggregated line is written
456-
check_pgbench_logs('001_pgbench_log_1', 2, 1, 2,
465+
# $nthreads threads, 2 seconds, sometimes only one aggregated line is written
466+
check_pgbench_logs('001_pgbench_log_1', $nthreads, 1, 2,
457467
qr{^\d+ \d{1,2} \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+$});
458468

459469
# with sampling rate

0 commit comments

Comments
 (0)