2 # Copyright (c) 2021-2025, PostgreSQL Global Development Group
5 use warnings FATAL
=> 'all';
7 use PostgreSQL
::Test
::Cluster
;
8 use PostgreSQL
::Test
::Utils
;
11 # Use Test::Differences if installed, and select unified diff output.
15 require Test
::Differences
;
16 Test
::Differences
->import;
20 # No dice -- fall back to 'is'
21 *eq_or_diff
= \
&is
if $@
;
24 my $node = PostgreSQL
::Test
::Cluster
->new('main');
30 my ($out, $err) = run_command
([ 'libpq_pipeline', 'tests' ]);
31 die "oops: $err" unless $err eq '';
32 my @tests = split(/\s+/, $out);
34 mkdir "$PostgreSQL::Test::Utils::tmp_check/traces";
36 for my $testname (@tests)
38 my @extraargs = ('-r', $numrows);
39 my $cmptrace = grep(/^$testname$/,
40 qw(simple_pipeline nosync multi_pipelines prepared singlerow
41 pipeline_abort pipeline_idle transaction
42 disallowed_in_pipeline)) > 0;
44 # For a bunch of tests, generate a libpq trace file too.
46 "$PostgreSQL::Test::Utils::tmp_check/traces/$testname.trace";
49 push @extraargs, "-t", $traceout;
55 'libpq_pipeline', @extraargs,
56 $testname, $node->connstr('postgres')
58 "libpq_pipeline $testname");
60 # Compare the trace, if requested
66 $expected = slurp_file_eval
("traces/$testname.trace");
67 next unless $expected ne "";
68 $result = slurp_file_eval
($traceout);
69 next unless $result ne "";
71 eq_or_diff
($result, $expected, "$testname trace match");
84 eval { $contents = slurp_file
($filepath); };
87 fail
"reading $filepath: $@";