Re: Improve error reporting in 027_stream_regress test - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Improve error reporting in 027_stream_regress test
Date
Msg-id aIgn6JoNY7aPXkXS@paquier.xyz
Whole thread Raw
In response to Re: Improve error reporting in 027_stream_regress test  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: Improve error reporting in 027_stream_regress test
Re: Improve error reporting in 027_stream_regress test
List pgsql-hackers
On Mon, Jul 28, 2025 at 03:34:06PM +0300, Nazir Bilal Yavuz wrote:
> I wanted to show what is in my mind, v4 is attached. Summary is:
>
> - 0001 introduces the read_file_ends() function, which reads lines
> from either the beginning or end of a given file. It includes a
> force_line_count argument that, when set to true, ensures that the
> specified number of lines is read from the file regardless of whether
> the PG_TEST_FILE_READ_LINES environment variable is set.

Hmm.  I am really wondering if 'head' and 'tail' should just be
shortcuts of some regexp patterns based on ^ and $, and that we could
allow the subroutine to use a regexp for the pattern matching.  I'll
look at that in details, but it may take me a couple of days before
getting down to it.

> - 0002 is the actual patch that improves error reporting in the
> 027_stream_regress test by using the read_file_ends() function. It
> adds a regression_log_helper() function, which reads the
> PG_TEST_FILE_READ_LINES environment variable and then calls
> read_file_ends() with force_line_count set to true. This approach
> avoids any potential race condition where the environment variable
> might be modified after being read in the regression_log_helper() and
> before used in the read_file_ends().

Why do you think the environment variable could be changed mid-flight
in the context of a single test run?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Support getrandom() for pg_strong_random() source
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: 024_add_drop_pub.pl might fail due to deadlock