Re: pgsql: Add TAP test to automate the equivalent of check_guc

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christoph Berg <myon(at)debian(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Add TAP test to automate the equivalent of check_guc
Date: 2022-02-11 15:35:49
Message-ID: 20220211153549.GE31460@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, Feb 11, 2022 at 09:59:55AM -0500, Tom Lane wrote:
> Christoph Berg <myon(at)debian(dot)org> writes:
> > this test is failing at Debian package compile time:
> > Could not open /usr/share/postgresql/15/postgresql.conf.sample: No such file or directory at t/003_check_guc.pl line 47.
>
> > So it's trying to read from /usr/share/postgresql which doesn't exist
> > yet at build time.
>
> > The relevant part of the test is this:
>
> > # Find the location of postgresql.conf.sample, based on the information
> > # provided by pg_config.
> > my $sample_file =
> > $node->config_data('--sharedir') . '/postgresql.conf.sample';
>
> This seems like a pretty bad idea even if it weren't failing outright.
> We should be examining the version of the file that's in the source
> tree; the one in the installation tree might have version-skew
> problems, if you've not yet done "make install".

My original way used the source tree, but Michael thought it would be an issue
for "installcheck" where the config may not be available.

https://www.postgresql.org/message-id/YfTg/WHNLVVygy8v%40paquier.xyz

This is what I had written:

-- test that GUCS are in postgresql.conf
SELECT lower(name) FROM tab_settings_flags WHERE NOT not_in_sample EXCEPT
SELECT regexp_replace(ln, '^#?([_[:alpha:]]+) (= .*|[^ ]*$)', '\1') AS guc
FROM (SELECT regexp_split_to_table(pg_read_file('postgresql.conf'), '\n') AS ln) conf
WHERE ln ~ '^#?[[:alpha:]]'
ORDER BY 1;
lower
-----------------------------
config_file
plpgsql.check_asserts
plpgsql.extra_errors
plpgsql.extra_warnings
plpgsql.print_strict_params
plpgsql.variable_conflict
(6 rows)

-- test that lines in postgresql.conf that look like GUCs are GUCs
SELECT regexp_replace(ln, '^#?([_[:alpha:]]+) (= .*|[^ ]*$)', '\1') AS guc
FROM (SELECT regexp_split_to_table(pg_read_file('postgresql.conf'), '\n') AS ln) conf
WHERE ln ~ '^#?[[:alpha:]]'
EXCEPT SELECT lower(name) FROM tab_settings_flags WHERE NOT not_in_sample
ORDER BY 1;
guc
-------------------
include
include_dir
include_if_exists
(3 rows)

--
Justin

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-02-11 15:41:27 Re: pgsql: Add TAP test to automate the equivalent of check_guc
Previous Message Tom Lane 2022-02-11 14:59:55 Re: pgsql: Add TAP test to automate the equivalent of check_guc

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-02-11 15:36:14 Re: OpenSSL conflicts with wincrypt.h
Previous Message Juan José Santamaría Flecha 2022-02-11 15:33:11 pg_receivewal.exe unhandled exception in zlib1.dll