pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
18+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2021-06-25 38ff135d94 af2e67b47a 79c24a0c21 c4c9c77e56  Cleanup some code related to pgbench log checks in TAP tests
  2021-06-25 87b2124dfa  Add more debugging information with log checks in TAP tests of pgbench
* pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-24 21:54  Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-24 21:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pattern matching logic for logs in TAP tests of pgbench

The logic checking for the format of per-thread logs used grep() with
directly "$re", which would cause the test to consider all the logs as
a match without caring about their format at all.  Using "/$re/" makes
grep() perform a regex test, which is what we want here.

While on it, improve some of the tests to be more picky with the
patterns expected and add more comments to describe the tests.

Issue discovered while digging into a separate patch.

Author: Fabien Coelho, Michael Paquier
Discussion: https://postgr.es/m/YNPsPAUoVDCpPOGk@paquier.xyz
Backpatch-through: 11

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c13585fe9e55813cf9feac67fe7b65d3a78fff92

Modified Files
--------------
src/bin/pgbench/t/001_pgbench_with_server.pl | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-24 21:54  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 18+ messages in thread

From: Michael Paquier @ 2021-06-24 21:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pattern matching logic for logs in TAP tests of pgbench

The logic checking for the format of per-thread logs used grep() with
directly "$re", which would cause the test to consider all the logs as
a match without caring about their format at all.  Using "/$re/" makes
grep() perform a regex test, which is what we want here.

While on it, improve some of the tests to be more picky with the
patterns expected and add more comments to describe the tests.

Issue discovered while digging into a separate patch.

Author: Fabien Coelho, Michael Paquier
Discussion: https://postgr.es/m/YNPsPAUoVDCpPOGk@paquier.xyz
Backpatch-through: 11

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7a9eaf111ac0a3ceba24fe15e5402bb2a17891f5

Modified Files
--------------
src/bin/pgbench/t/001_pgbench_with_server.pl | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-24 21:54  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 18+ messages in thread

From: Michael Paquier @ 2021-06-24 21:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pattern matching logic for logs in TAP tests of pgbench

The logic checking for the format of per-thread logs used grep() with
directly "$re", which would cause the test to consider all the logs as
a match without caring about their format at all.  Using "/$re/" makes
grep() perform a regex test, which is what we want here.

While on it, improve some of the tests to be more picky with the
patterns expected and add more comments to describe the tests.

Issue discovered while digging into a separate patch.

Author: Fabien Coelho, Michael Paquier
Discussion: https://postgr.es/m/YNPsPAUoVDCpPOGk@paquier.xyz
Backpatch-through: 11

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/79ff96aa9d9a76cf6fd5ade9a25efb488ecd89ab

Modified Files
--------------
src/bin/pgbench/t/001_pgbench_with_server.pl | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-24 21:54  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 18+ messages in thread

From: Michael Paquier @ 2021-06-24 21:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pattern matching logic for logs in TAP tests of pgbench

The logic checking for the format of per-thread logs used grep() with
directly "$re", which would cause the test to consider all the logs as
a match without caring about their format at all.  Using "/$re/" makes
grep() perform a regex test, which is what we want here.

While on it, improve some of the tests to be more picky with the
patterns expected and add more comments to describe the tests.

Issue discovered while digging into a separate patch.

Author: Fabien Coelho, Michael Paquier
Discussion: https://postgr.es/m/YNPsPAUoVDCpPOGk@paquier.xyz
Backpatch-through: 11

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0efd2a1a66dd6e27b097ad533311d8e1ad7ca309

Modified Files
--------------
src/bin/pgbench/t/001_pgbench_with_server.pl | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-24 23:51  Michael Paquier <michael@paquier.xyz>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-24 23:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

On Thu, Jun 24, 2021 at 09:54:51PM +0000, Michael Paquier wrote:
> Fix pattern matching logic for logs in TAP tests of pgbench
> 
> The logic checking for the format of per-thread logs used grep() with
> directly "$re", which would cause the test to consider all the logs as
> a match without caring about their format at all.  Using "/$re/" makes
> grep() perform a regex test, which is what we want here.
> 
> While on it, improve some of the tests to be more picky with the
> patterns expected and add more comments to describe the tests.
> 
> Issue discovered while digging into a separate patch.

fairywren does not like that:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=fairywren&dt=2021-06-24%2022%3A36%3A14

not ok 302 - transaction format for 001_pgbench_log_2
not ok 311 - transaction format for 001_pgbench_log_3

I am not sure if this is a pre-existing bug in pgbench itself
regarding the way we generate the logs or an issue with fairywren's
perl installation.

Andrew, what's the format of the per-thread logs generated on this
host when running the commands?  I'd bet that the checks for the
client IDs are right, but that some parts of the regex are too picky
when it comes to this host.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 00:26  Michael Paquier <michael@paquier.xyz>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-25 00:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org; +Cc: Andrew Dunstan <andrew@dunslane.net>

(Forgot to add Andrew in CC, now done)

On Fri, Jun 25, 2021 at 08:51:19AM +0900, Michael Paquier wrote:
> Andrew, what's the format of the per-thread logs generated on this
> host when running the commands?  I'd bet that the checks for the
> client IDs are right, but that some parts of the regex are too picky
> when it comes to this host.

I have tested that on my own Windows host using MSVC and Active Perl,
and those tests pass.  I am not sure what's happening here.  A simple
way to figure out what's going on would be to make the tests more
talkative and show up the logs that don't match.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 01:36  Andrew Dunstan <andrew@dunslane.net>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 18+ messages in thread

From: Andrew Dunstan @ 2021-06-25 01:36 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; pgsql-committers@lists.postgresql.org


On 6/24/21 8:26 PM, Michael Paquier wrote:
> (Forgot to add Andrew in CC, now done)
>
> On Fri, Jun 25, 2021 at 08:51:19AM +0900, Michael Paquier wrote:
>> Andrew, what's the format of the per-thread logs generated on this
>> host when running the commands?  I'd bet that the checks for the
>> client IDs are right, but that some parts of the regex are too picky
>> when it comes to this host.
> I have tested that on my own Windows host using MSVC and Active Perl,
> and those tests pass.  I am not sure what's happening here.  A simple
> way to figure out what's going on would be to make the tests more
> talkative and show up the logs that don't match.



That's not really an equivalent test. I'm taking a look


cheers


andrew

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






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 01:53  Michael Paquier <michael@paquier.xyz>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-25 01:53 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

On Thu, Jun 24, 2021 at 09:36:53PM -0400, Andrew Dunstan wrote:
> That's not really an equivalent test. I'm taking a look

Thanks!
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 02:12  Andrew Dunstan <andrew@dunslane.net>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 2 replies; 18+ messages in thread

From: Andrew Dunstan @ 2021-06-25 02:12 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org


On 6/24/21 9:53 PM, Michael Paquier wrote:
> On Thu, Jun 24, 2021 at 09:36:53PM -0400, Andrew Dunstan wrote:
>> That's not really an equivalent test. I'm taking a look
> Thanks!




There's a whole lot wrong with this code. To start with, why is that
unchecked eval there. And why is it reading in log files on its own
instead of using TestLib::slurp_file, which, among other things,
normalizes line endings? There's a very good chance that this latter is
the issue. It only affects msys which is why you didn't see an issue on
MSVC. And also, why does it carefully unlink the log files so that any
trace of what's gone wrong is deleted?


Based on the little I've seen this file needs a serious code review.


cheers


andrew

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






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 02:26  Andrew Dunstan <andrew@dunslane.net>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 1 reply; 18+ messages in thread

From: Andrew Dunstan @ 2021-06-25 02:26 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org


On 6/24/21 10:12 PM, Andrew Dunstan wrote:
> On 6/24/21 9:53 PM, Michael Paquier wrote:
>> On Thu, Jun 24, 2021 at 09:36:53PM -0400, Andrew Dunstan wrote:
>>> That's not really an equivalent test. I'm taking a look
>> Thanks!
>
>
>
> There's a whole lot wrong with this code. To start with, why is that
> unchecked eval there. And why is it reading in log files on its own
> instead of using TestLib::slurp_file, which, among other things,
> normalizes line endings? There's a very good chance that this latter is
> the issue. It only affects msys which is why you didn't see an issue on
> MSVC. And also, why does it carefully unlink the log files so that any
> trace of what's gone wrong is deleted?
>
>
> Based on the little I've seen this file needs a serious code review.



... and there's the error:


check_pgbench_logs($bdir, '001_pgbench_log_2', 1, 8, 92,
    qr{^[01] \d{1,2} \d+ \d \d+ \d+$});


and one further down the same.


Since the file isn't read in using slurp_file, that $ won't match
because the lines will end \r\n instead of \n.


cheers


andrew

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






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 03:08  Michael Paquier <michael@paquier.xyz>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-25 03:08 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

On Thu, Jun 24, 2021 at 10:26:18PM -0400, Andrew Dunstan wrote:
> Since the file isn't read in using slurp_file, that $ won't match
> because the lines will end \r\n instead of \n.

I did not remember this one with Msys, thanks.  I am not sure that
there is any need for an eval block here actually once you remove
open()?  What do you think about something like the attached?
--
Michael

Attachments:

pgbench-tap-fix.patch (text/x-diff, 1.6K) download diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index ff5b31d4df..a136e18b0e 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -1193,28 +1193,29 @@ sub check_pgbench_logs my $log_number = 0; for my $log (sort @logs) { - eval { - open my $fh, '<', $log or die "$@"; - my @contents = <$fh>; - my $clen = @contents; - ok( $min <= $clen && $clen <= $max, - "transaction count for $log ($clen)"); - my $clen_match = grep(/$re/, @contents); - ok($clen_match == $clen, "transaction format for $prefix"); - # Show more information if some logs don't match - # to help with debugging. - if ($clen_match != $clen) + # Check the contents of each log file. + my $contents_raw = slurp_file($log); + + # On Msys, filter out any CRLF. + $contents_raw =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; + my @contents = split("\n", $contents_raw); + my $clen = @contents; + ok( $min <= $clen && $clen <= $max, + "transaction count for $log ($clen)"); + my $clen_match = grep(/$re/, @contents); + ok($clen_match == $clen, "transaction format for $prefix"); + + # Show more information if some logs don't match + # to help with debugging. + if ($clen_match != $clen) + { + foreach my $log (@contents) { - foreach my $log (@contents) - { - print "# Log entry not matching: $log\n" - unless $log =~ /$re/; - } + print "# Log entry not matching: $log\n" + unless $log =~ /$re/; } - close $fh or die "$@"; - }; + } } - ok(unlink(@logs), "remove log files"); return; }
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 10:12  Andrew Dunstan <andrew@dunslane.net>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 18+ messages in thread

From: Andrew Dunstan @ 2021-06-25 10:12 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org


On 6/24/21 11:08 PM, Michael Paquier wrote:
> On Thu, Jun 24, 2021 at 10:26:18PM -0400, Andrew Dunstan wrote:
>> Since the file isn't read in using slurp_file, that $ won't match
>> because the lines will end \r\n instead of \n.
> I did not remember this one with Msys, thanks.  I am not sure that
> there is any need for an eval block here actually once you remove
> open()?  What do you think about something like the attached?


+        # 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.


+        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.


cheers


andrew

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






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-25 12:24  Michael Paquier <michael@paquier.xyz>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 18+ messages in thread

From: Michael Paquier @ 2021-06-25 12:24 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-26 06:47  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 1 reply; 18+ messages in thread

From: Fabien COELHO @ 2021-06-26 06:47 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>


Hello Andrew & Michaël,

My 0.02€:

> There's a whole lot wrong with this code. To start with, why is that
> unchecked eval there.

Yep. The idea was that other tests would go on being collected eg if the 
file is not found, but it should have been checked anyway.

> And why is it reading in log files on its own instead of using 
> TestLib::slurp_file, which, among other things, normalizes line endings?

Indeed.

However, if slurp_file fails it raises an exception and aborts the whole 
TAP unexpectedly, which is pretty unclean. So I'd suggest to keep the 
eval, as attached. I tested it by changing the file name so that the slurp 
fails.

> There's a very good chance that this latter is the issue. It only 
> affects msys which is why you didn't see an issue on MSVC. And also, why 
> does it carefully unlink the log files so that any trace of what's gone 
> wrong is deleted?

> Based on the little I've seen this file needs a serious code review.

Probably: My very old perl expertise is fading away because I'm not using 
it much these days. Cannot say I miss it:-)

-- 
Fabien.

Attachments:

pgbench-tap-eval-1.patch (text/x-diff, 1.8K) download diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index 781cc08fb1..6a82a3494d 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -1190,29 +1190,32 @@ sub check_pgbench_logs ok(@logs == $nb, "number of log files"); ok(grep(/\/$prefix\.\d+(\.\d+)?$/, @logs) == $nb, "file name format"); - my $log_number = 0; for my $log (sort @logs) { - # Check the contents of each log file. - my $contents_raw = slurp_file($log); + eval { + # Check the contents of each log file. + my $contents_raw = slurp_file($log); - my @contents = split(/\n/, $contents_raw); - my $clen = @contents; - ok( $min <= $clen && $clen <= $max, - "transaction count for $log ($clen)"); - my $clen_match = grep(/$re/, @contents); - ok($clen_match == $clen, "transaction format for $prefix"); + my @contents = split(/\n/, $contents_raw); + my $clen = @contents; + ok( $min <= $clen && $clen <= $max, + "transaction count for $log ($clen)"); + my $clen_match = grep(/$re/, @contents); + ok($clen_match == $clen, "transaction format for $prefix"); - # Show more information if some logs don't match - # to help with debugging. - if ($clen_match != $clen) - { - foreach my $log (@contents) + # Show more information if some logs don't match + # to help with debugging. + if ($clen_match != $clen) { - print "# Log entry not matching: $log\n" - unless $log =~ /$re/; + foreach my $log (@contents) + { + print "# Log entry not matching: $log\n" + unless $log =~ /$re/; + } } - } + }; + # Tell if an exception was raised + ok(0, "Error while checking log file \"$log\": $@") if $@; } return; }
^ permalink raw reply [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-26 15:01  Andrew Dunstan <andrew@dunslane.net>
  parent: Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 2 replies; 18+ messages in thread

From: Andrew Dunstan @ 2021-06-26 15:01 UTC (permalink / raw)
  To: Fabien COELHO <coelho@cri.ensmp.fr>; Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>


On 6/26/21 2:47 AM, Fabien COELHO wrote:
>
> Hello Andrew & Michaël,
>
> My 0.02€:
>
>> There's a whole lot wrong with this code. To start with, why is that
>> unchecked eval there.
>
> Yep. The idea was that other tests would go on being collected eg if
> the file is not found, but it should have been checked anyway.
>
>> And why is it reading in log files on its own instead of using
>> TestLib::slurp_file, which, among other things, normalizes line endings?
>
> Indeed.
>
> However, if slurp_file fails it raises an exception and aborts the
> whole TAP unexpectedly, which is pretty unclean. So I'd suggest to
> keep the eval, as attached. I tested it by changing the file name so
> that the slurp fails.


Seem quite unnecessary. We haven't found that to be an issue elsewhere
in the code where slurp_file is used. And in the present case we know
the file exists because we got its name from list_files().


cheers


andrew

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






^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-26 16:08  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 0 replies; 18+ messages in thread

From: Fabien COELHO @ 2021-06-26 16:08 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Michael Paquier <michael@paquier.xyz>; pgsql-committers@lists.postgresql.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>


>> However, if slurp_file fails it raises an exception and aborts the
>> whole TAP unexpectedly, which is pretty unclean. So I'd suggest to
>> keep the eval, as attached. I tested it by changing the file name so
>> that the slurp fails.
>
> Seem quite unnecessary. We haven't found that to be an issue elsewhere
> in the code where slurp_file is used. And in the present case we know
> the file exists because we got its name from list_files().

Fine with me!

-- 
Fabien.





^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-27 01:22  Michael Paquier <michael@paquier.xyz>
  parent: Andrew Dunstan <andrew@dunslane.net>
  1 sibling, 1 reply; 18+ messages in thread

From: Michael Paquier @ 2021-06-27 01:22 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Fabien COELHO <coelho@cri.ensmp.fr>; pgsql-committers@lists.postgresql.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>

On Sat, Jun 26, 2021 at 11:01:07AM -0400, Andrew Dunstan wrote:
> On 6/26/21 2:47 AM, Fabien COELHO wrote:
>> However, if slurp_file fails it raises an exception and aborts the
>> whole TAP unexpectedly, which is pretty unclean. So I'd suggest to
>> keep the eval, as attached. I tested it by changing the file name so
>> that the slurp fails.
> 
> Seem quite unnecessary. We haven't found that to be an issue elsewhere
> in the code where slurp_file is used. And in the present case we know
> the file exists because we got its name from list_files().

Agreed.  That's an exchange between a hard failure mid-test and a
failure while letting the whole test run.  Here, we expect the test to
find the log file all the time, so a hard failure does not sound like
a bad thing to me either.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench
@ 2021-06-27 05:48  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 18+ messages in thread

From: Fabien COELHO @ 2021-06-27 05:48 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Andrew Dunstan <andrew@dunslane.net>; pgsql-committers@lists.postgresql.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>


>> Seem quite unnecessary. We haven't found that to be an issue elsewhere
>> in the code where slurp_file is used. And in the present case we know
>> the file exists because we got its name from list_files().
>
> Agreed.  That's an exchange between a hard failure mid-test and a
> failure while letting the whole test run.  Here, we expect the test to
> find the log file all the time, so a hard failure does not sound like
> a bad thing to me either.

Ok, fine with me!

-- 
Fabien.





^ permalink  raw  reply  [nested|flat] 18+ messages in thread


end of thread, other threads:[~2021-06-27 05:48 UTC | newest]

Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 21:54 pgsql: Fix pattern matching logic for logs in TAP tests of pgbench Michael Paquier <michael@paquier.xyz>
2021-06-24 23:51 ` Michael Paquier <michael@paquier.xyz>
2021-06-25 00:26   ` Michael Paquier <michael@paquier.xyz>
2021-06-25 01:36     ` Andrew Dunstan <andrew@dunslane.net>
2021-06-25 01:53       ` Michael Paquier <michael@paquier.xyz>
2021-06-25 02:12         ` Andrew Dunstan <andrew@dunslane.net>
2021-06-25 02:26           ` Andrew Dunstan <andrew@dunslane.net>
2021-06-25 03:08             ` Michael Paquier <michael@paquier.xyz>
2021-06-25 10:12               ` Andrew Dunstan <andrew@dunslane.net>
2021-06-25 12:24                 ` Michael Paquier <michael@paquier.xyz>
2021-06-26 06:47           ` Fabien COELHO <coelho@cri.ensmp.fr>
2021-06-26 15:01             ` Andrew Dunstan <andrew@dunslane.net>
2021-06-26 16:08               ` Fabien COELHO <coelho@cri.ensmp.fr>
2021-06-27 01:22               ` Michael Paquier <michael@paquier.xyz>
2021-06-27 05:48                 ` Fabien COELHO <coelho@cri.ensmp.fr>
2021-06-24 21:54 pgsql: Fix pattern matching logic for logs in TAP tests of pgbench Michael Paquier <michael@paquier.xyz>
2021-06-24 21:54 pgsql: Fix pattern matching logic for logs in TAP tests of pgbench Michael Paquier <michael@paquier.xyz>
2021-06-24 21:54 pgsql: Fix pattern matching logic for logs in TAP tests of pgbench Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox