public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Gustafsson <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Is pg_regress --use-existing used by anyone or is it broken?
Date: Mon, 28 Aug 2023 15:11:15 +0200
Message-ID: <[email protected]> (raw)
When looking at pg_regress I noticed that the --use-existing support didn't
seem to work. ISTM that the removal/creation of test databases and roles
doesn't run since the conditional is reversed. There is also no support for
using a non-default socket directory with PG_REGRESS_SOCK_DIR. The attached
hack fixes these and allows the tests to execute for me, but even with that the
test_setup suite fails due to the tablespace not being dropped and recreated
like databases and roles.
Is it me who is too thick to get it working, or is it indeed broken? If it's
the latter, it's been like that for a long time which seems to indicate that it
isn't really used and should probably be removed rather than fixed?
Does anyone here use it?
--
Daniel Gustafsson
Attachments:
[application/octet-stream] pg_regress_use_existing.diff (1.6K, ../[email protected]/2-pg_regress_use_existing.diff)
download | inline diff:
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index ec67588cf5..6ba5b13be9 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -880,11 +880,17 @@ initialize_environment(void)
pgport = getenv("PGPORT");
if (!pghost)
{
- /* Keep this bit in sync with libpq's default host location: */
- if (DEFAULT_PGSOCKET_DIR[0])
- /* do nothing, we'll print "Unix socket" below */ ;
+ sockdir = getenv("PG_REGRESS_SOCK_DIR");
+ if (sockdir)
+ setenv("PGHOST", sockdir, 1);
else
- pghost = "localhost"; /* DefaultHost in fe-connect.c */
+ {
+ /* Keep this bit in sync with libpq's default host location: */
+ if (DEFAULT_PGSOCKET_DIR[0])
+ /* do nothing, we'll print "Unix socket" below */ ;
+ else
+ pghost = "localhost"; /* DefaultHost in fe-connect.c */
+ }
}
if (pghost && pgport)
@@ -2562,7 +2568,7 @@ regression_main(int argc, char *argv[],
* Using an existing installation, so may need to get rid of
* pre-existing database(s) and role(s)
*/
- if (!use_existing)
+ if (use_existing)
{
for (sl = dblist; sl; sl = sl->next)
drop_database_if_exists(sl->str);
@@ -2574,13 +2580,10 @@ regression_main(int argc, char *argv[],
/*
* Create the test database(s) and role(s)
*/
- if (!use_existing)
- {
- for (sl = dblist; sl; sl = sl->next)
- create_database(sl->str);
- for (sl = extraroles; sl; sl = sl->next)
- create_role(sl->str, dblist);
- }
+ for (sl = dblist; sl; sl = sl->next)
+ create_database(sl->str);
+ for (sl = extraroles; sl; sl = sl->next)
+ create_role(sl->str, dblist);
/*
* Ready to run the tests
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Is pg_regress --use-existing used by anyone or is it broken?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox