]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Allow TestLib::slurp_file to skip contents, and use as needed
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 16 Apr 2021 20:54:04 +0000 (16:54 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 16 Apr 2021 21:35:20 +0000 (17:35 -0400)
commite480c6dd33f40bf4a2ae561799b08a1cd7c3073b
treeeb0edd37c542bbff460795b20619f9ab8c99c753
parent0e8acd39ecdf9a68ebdaf9652a56b943f34c9c58
Allow TestLib::slurp_file to skip contents, and use as needed

In order to avoid getting old logfile contents certain functions in
PostgresNode were doing one of two things. On Windows it rotated the
logfile and restarted the server, while elsewhere it truncated the log
file. Both of these are unnecessary. We borrow from the buildfarm which
does this instead: note the size of the logfile before we start, and
then when fetching the logfile skip to that position before accumulating
contents. This is spelled differently on Windows but the effect is the
same. This is largely centralized in TestLib's slurp_file function,
which has a new optional parameter, the offset to skip to before
starting to reading the file. Code in the client becomes much neater.

Backpatch to all live branches.

Michael Paquier, slightly modified by me.

Discussion: https://postgr.es/m/YHajnhcMAI3++pJL@paquier.xyz
src/test/perl/PostgresNode.pm
src/test/perl/TestLib.pm