Skip to content

Makefile: add installcheck-existing target and improve readability#2437

Open
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:cleanup_Makefile
Open

Makefile: add installcheck-existing target and improve readability#2437
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:cleanup_Makefile

Conversation

@jrgemignani

Copy link
Copy Markdown
Contributor

Add an "installcheck-existing" target that runs the regression suite against an already-running PostgreSQL server, complementing the default "installcheck" (which builds a private temp instance). It points pg_regress at the server via the standard libpq variables (PGHOST/PGPORT/PGUSER; PGDATABASE defaults to contrib_regression) and lets pg_regress create the database and load the extension through --load-extension=age. It deliberately avoids --use-existing -- that option skips database creation and disables --load-extension -- so no manual CREATE EXTENSION step is required. The upgrade test (age_upgrade) is excluded because it stages synthetic extension files into the local sharedir that a running server would not see.

Readability and maintainability improvements (no behavior change):

  • Derive age_sql from AGE_CURR_VER (read from age.control) so the version number is defined in exactly one place.
  • Add section banners and a top-of-file layout/target index; group the scattered upgrade-test pieces and move the ag_scanner flex rule in with the other parser-generation rules.
  • Wrap the long REGRESS_OPTS and EXTRA_CLEAN assignments across lines.
  • Fix the DATA filter-out pattern to use a double dash (age--%--y.y.y.sql) matching the actual template filename; the prior single-dash pattern only matched via greedy '%' expansion.
  • Anchor the age.control version regex (/^default_version/).
  • Replace the hardcoded "31 tests" comment with generic wording and add a "help" target listing the common targets.

Verified on PostgreSQL 18: make installcheck (temp instance) and make installcheck-existing both pass; clean rebuild and make clean unaffected.

Co-authored-by: GitHub Copilot noreply@github.com

modified: Makefile

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the extension build/test Makefile by adding an installcheck-existing target to run the regression suite against an already-running PostgreSQL server (via libpq connection parameters), while also restructuring the Makefile for improved readability and reduced duplication (e.g., deriving the install SQL filename from age.control).

Changes:

  • Add installcheck-existing to run pg_regress against a running server and exclude the synthetic upgrade regression test from that path.
  • Derive age_sql from AGE_CURR_VER (read from age.control) and tighten/clarify upgrade-test related patterns and regexes.
  • Reorganize/annotate Makefile sections and wrap long variable assignments for maintainability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Add an "installcheck-existing" target that runs the regression suite
against an already-running PostgreSQL server, complementing the default
"installcheck" (which builds a private temp instance). It points
pg_regress at the server via the standard libpq variables
(PGHOST/PGPORT/PGUSER; PGDATABASE defaults to contrib_regression) and
lets pg_regress create the database and load the extension through
--load-extension=age. It deliberately avoids --use-existing -- that
option skips database creation and disables --load-extension -- so no
manual CREATE EXTENSION step is required. The upgrade test (age_upgrade)
is excluded because it stages synthetic extension files into the local
sharedir that a running server would not see.

Readability and maintainability improvements (no behavior change):
- Derive age_sql from AGE_CURR_VER (read from age.control) so the
  version number is defined in exactly one place.
- Add section banners and a top-of-file layout/target index; group the
  scattered upgrade-test pieces and move the ag_scanner flex rule in
  with the other parser-generation rules.
- Wrap the long REGRESS_OPTS and EXTRA_CLEAN assignments across lines.
- Fix the DATA filter-out pattern to use a double dash
  (age--%--y.y.y.sql) matching the actual template filename; the prior
  single-dash pattern only matched via greedy '%' expansion.
- Anchor the age.control version regex (/^default_version/).
- Replace the hardcoded "31 tests" comment with generic wording and add
  a "help" target listing the common targets.

Verified on PostgreSQL 18: make installcheck (temp instance) and
make installcheck-existing both pass; clean rebuild and make clean
unaffected.

Co-authored-by: GitHub Copilot <noreply@github.com>

modified:   Makefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants