Re: pg_upgrade: Make testing different transfer modes easier

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: pg_upgrade: Make testing different transfer modes easier
Дата
Msg-id F058DDCF-21DF-401E-A1B1-99BB0B3A78C4@yesql.se
обсуждение исходный текст
Ответ на pg_upgrade: Make testing different transfer modes easier  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Ответы Re: pg_upgrade: Make testing different transfer modes easier  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Список pgsql-hackers
> On 1 Dec 2022, at 16:18, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>
> I wanted to test the different pg_upgrade transfer modes (--link, --clone), but that was not that easy, because there
ismore than one place in the test script you have to find and manually change.  So I wrote a little patch to make that
easier. It's still manual, but it's a start.  (In principle, we could automatically run the tests with each supported
modein a loop, but that would be very slow.) 

Wouldn't it be possible, and less change-code-manual, to accept this via an
extension to PROVE_FLAGS?  Any options after :: to prove are passed to the
test(s) [0] so we could perhaps inspect @ARGV for the mode if we invent a new
way to pass arguments.  Something along the lines of the untested sketch
below in the pg_upgrade test:

+# Optionally set the file transfer mode for the tests via arguments to PROVE
+my $mode = (@ARGV);
+$mode = '--copy' unless defined;

.. together with an extension to Makefile.global.in ..

-   $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
+   $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) $(PROVE_TEST_ARGS)

.. should *I think* allow for passing the mode to the tests via:

make -C src/bin/pg_upgrade check PROVE_TEST_ARGS=":: --link"

The '::' part should of course ideally be injected automatically but the above
is mostly thinking out loud pseudocode so I didn't add that.

This could probably benefit other tests as well, to make it eas{y|ier} to run
extended testing on certain buildfarm animals or in the CFBot CI on specific
patches in the commitfest.

> While doing that, I also found it strange that the default transfer mode (referred to as "copy" internally) did not
haveany external representation, so it is awkward to refer to it in text, and obscure to see where it is used for
examplein those test scripts.  So I added an option --copy, which effectively does nothing, but it's not uncommon to
haveoptions that select default behaviors explicitly.  (I also thought about something like a "mode" option with an
argument,but given that we already have --link and --clone, this seemed the most sensible.) 

Agreed, +1 on adding --copy regardless of the above.

--
Daniel Gustafsson        https://vmware.com/

[0] https://perldoc.perl.org/prove#Arguments-to-Tests


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Perform streaming logical transactions by background workers and parallel apply
Следующее
От: John Naylor
Дата:
Сообщение: Re: Optimizing Node Files Support