@@ -126,9 +126,18 @@ sub pgbench
126
126
qr { receiving} , qr { executing} ],
127
127
' pgbench select only' );
128
128
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
+
129
138
# run custom scripts
130
139
pgbench(
131
- ' -t 100 -c 1 -j 2 -M prepared -n' ,
140
+ " -t 100 -c 1 -j $nthreads -M prepared -n" ,
132
141
0,
133
142
[ qr { type: multiple scripts} ,
134
143
qr { mode: prepared} ,
@@ -439,11 +448,12 @@ sub check_pgbench_logs
439
448
# note: --progress-timestamp is not tested
440
449
pgbench(
441
450
' -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' ,
443
453
0,
444
454
[ qr { type: multiple} ,
445
455
qr { clients: 3} ,
446
- qr { threads: 2 } ,
456
+ qr { threads: $nthreads } ,
447
457
qr { duration: 2 s} ,
448
458
qr { script 1: .* select only} ,
449
459
qr { script 2: .* select only} ,
@@ -452,8 +462,8 @@ sub check_pgbench_logs
452
462
[ qr { vacuum} , qr { progress: 1\b } ],
453
463
' pgbench progress' );
454
464
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,
457
467
qr { ^\d + \d {1,2} \d + \d + \d + \d + \d + \d + \d + \d + \d +$} );
458
468
459
469
# with sampling rate
0 commit comments