Some incorrect logs in TAP tests of pgbench

Started by Michael Paquierover 4 years ago5 messages
#1Michael Paquier
michael@paquier.xyz
1 attachment(s)

Hi all,

While digging into some of the TAP tests, I have noticed that
002_pgbench_no_server.pl prints array pointers, like that:
opts=-f no-such-file, stat=1, out=ARRAY(0x1374d7990),
err=ARRAY(0x14028dc40), name=pgbench option error: no file# Running:
pgbench -f no-such-file

I am a bit dubious that this information is useful when it comes to
debugging because we have the name of the tests close by, so I would
just remove those extra logs. If people prefer keeping this
information around, we could fix the format with something like the
attached, for example.

Thoughts?
--
Michael

Attachments:

pgbench-tap-logs.patchtext/x-diff; charset=us-asciiDownload
diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl
index 9023fac52d..a3608ae5fc 100644
--- a/src/bin/pgbench/t/002_pgbench_no_server.pl
+++ b/src/bin/pgbench/t/002_pgbench_no_server.pl
@@ -26,7 +26,10 @@ sub pgbench
 	local $Test::Builder::Level = $Test::Builder::Level + 1;
 
 	my ($opts, $stat, $out, $err, $name) = @_;
-	print STDERR "opts=$opts, stat=$stat, out=$out, err=$err, name=$name";
+	print STDERR "opts=$opts, stat=$stat, " .
+	    "out=" . join(' ', @{$out}) . ", " .
+	    "err=" . join(' ', @{$err}) . ", " .
+	    "name=$name\n";
 	command_checks_all([ 'pgbench', split(/\s+/, $opts) ],
 		$stat, $out, $err, $name);
 	return;
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Michael Paquier (#1)
Re: Some incorrect logs in TAP tests of pgbench

On 6/25/21 8:33 AM, Michael Paquier wrote:

Hi all,

While digging into some of the TAP tests, I have noticed that
002_pgbench_no_server.pl prints array pointers, like that:
opts=-f no-such-file, stat=1, out=ARRAY(0x1374d7990),
err=ARRAY(0x14028dc40), name=pgbench option error: no file# Running:
pgbench -f no-such-file

I am a bit dubious that this information is useful when it comes to
debugging because we have the name of the tests close by, so I would
just remove those extra logs. If people prefer keeping this
information around, we could fix the format with something like the
attached, for example.

Thoughts?

Either that or dereference them, by printing @$out and @$err instead of
$out and $err or something similar.

But probably the name of the test is sufficient. (What were we thinking
in allowing this in the first place?)

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#3Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Michael Paquier (#1)
Re: Some incorrect logs in TAP tests of pgbench

On 2021-Jun-25, Michael Paquier wrote:

I am a bit dubious that this information is useful when it comes to
debugging because we have the name of the tests close by, so I would
just remove those extra logs. If people prefer keeping this
information around, we could fix the format with something like the
attached, for example.

I agree it's not useful -- command_checks_all logs each element of those
arrays already, when doing its like(). So ISTM we can do away with them.

--
�lvaro Herrera 39�49'30"S 73�17'W
"Most hackers will be perfectly comfortable conceptualizing users as entropy
sources, so let's move on." (Nathaniel Smith)

#4Michael Paquier
michael@paquier.xyz
In reply to: Andrew Dunstan (#2)
Re: Some incorrect logs in TAP tests of pgbench

On Fri, Jun 25, 2021 at 09:37:50AM -0400, Andrew Dunstan wrote:

Either that or dereference them, by printing @$out and @$err instead of
$out and $err or something similar.

Looking again, we don't really lose context if we remove that, so done
this way.

But probably the name of the test is sufficient. (What were we thinking
in allowing this in the first place?)

No idea. This got introduced in v5 of what got committed as of
ed8a7c6:
/messages/by-id/alpine.DEB.2.20.1705091641150.29373@lancre
--
Michael

#5Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Andrew Dunstan (#2)
Re: Some incorrect logs in TAP tests of pgbench

(What were we thinking in allowing this in the first place?)

Temporary debug leftovers that got through, I'd say.

Thanks Micha�l for the clean up!

--
Fabien.