Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-committers@lists.postgresql.org
Date: 2021-06-25T12:24:23Z
Lists: pgsql-hackers
On Fri, Jun 25, 2021 at 06:12:09AM -0400, Andrew Dunstan wrote:
> +        # On Msys, filter out any CRLF.
> +        $contents_raw =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
> 
> This is completely redundant. The whole point is that slurp_file does
> exactly this for you.

Thanks.  I have managed to duplicate that.

> +        my @contents = split("\n", $contents_raw);
> 
> Probably more idiomatic to write split(/\n/,$contents_raw), or
> split(/^/, $contents_raw) if you want to keep the line feeds.

I have gone with the solution that removes the newlines.  This does
not change the pattern checks, and that makes printing entries not
matching a bit cleaner.

Thanks a lot for the investigation!
--
Michael

Commits

  1. Cleanup some code related to pgbench log checks in TAP tests

  2. Add more debugging information with log checks in TAP tests of pgbench

  3. Fix pattern matching logic for logs in TAP tests of pgbench