Re: Small TAP improvements

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Small TAP improvements
Date: 2022-06-14 17:14:15
Message-ID: f0c69b29-31e0-045f-91ac-ced818bef663@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-06-14 Tu 12:20, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> The first makes the argument for $node->config_data() optional. If it's
>> not supplied, pg_config is called without an argument and the whole
>> result is returned. Currently, if you try that you get back a nasty and
>> cryptic error.
> No opinion about whether that's useful.
>
>> The second changes the new GUCs TAP test to check against the installed
>> postgresql.conf.sample rather than the one in the original source
>> location. There are probably arguments both ways, but if we ever decided
>> to postprocess the file before installation, this would do the right thing.
> Seems like a good idea, especially since it also makes the test code
> shorter and more robust(-looking).
>
> Looking at the patch itself,
>
> +my $share_dir = $node->config_data('--sharedir');
> +chomp $share_dir;
> +$share_dir =~ s/^SHAREDIR = //;
> +my $sample_file = "$share_dir/postgresql.conf.sample";
>
> I kind of wonder why config_data() isn't doing the chomp itself;
> what caller would not want that? Pulling off the variable name
> might be helpful too, since it's hard to conceive of a use-case
> where you don't also need that.

It already chomps the output, and pg_config doesn't output "SETTING = "
if given an option argument, so we could just remove those two lines -
they are remnants of an earlier version. I'll do it that way.

cheers

andrew

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Wong 2022-06-14 17:40:06 Re: real/float example for testlibpq3
Previous Message Álvaro Herrera 2022-06-14 16:44:09 Re: Small TAP improvements