From 6966d3c736fbefc4b44aa1a977f14594d8058908 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Sat, 1 Aug 2026 16:47:25 -0500 Subject: [PATCH 1/2] Add PGXNTOOL_ENABLE_FS_INSTALL and PGXNTOOL_ENABLE_PGXN_INSTALL `test`/`verify-results`/`installcheck`/`test-build` always filesystem-installed the extension via PGXS's `install`, with no way to disable it. That defeated "existing mode" testing, where the extension under test was deployed some other way (e.g. a pg_tle registration, or a real pg_upgrade) -- the whole point is to prove that other deployment path works, not to filesystem-install as a side effect. `PGXNTOOL_ENABLE_FS_INSTALL` (default `yes`) now gates `install` out of all four. `installcheck` also unconditionally auto-installed the pgtap dependency via `pgxn install pgtap --sudo` -- itself a filesystem-install side effect. `PGXNTOOL_ENABLE_PGXN_INSTALL` independently gates that (defaulting to follow `PGXNTOOL_ENABLE_FS_INSTALL`, but overridable on its own). Documented both in README.asc's make-targets and environment-variable reference sections. Fixes #55. Fixes #90. Related changes in pgxntool-test: - Added BATS coverage in `test/standard/make-test.bats`: default/override behavior for both variables, structural proof (`make -p -n`) that `install`/`pgtap` prerequisites are genuinely removed, and end-to-end proof that `make test PGXNTOOL_ENABLE_FS_INSTALL=no` succeeds against an already-installed tree but fails against a genuinely uninstalled one. Co-Authored-By: Claude --- HISTORY.asc | 20 ++++++++++++ README.asc | 10 ++++++ README.html | 49 +++++++++++++++++++++++------ base.mk | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 156 insertions(+), 11 deletions(-) diff --git a/HISTORY.asc b/HISTORY.asc index bdd5121..7e50038 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -1,3 +1,23 @@ +STABLE +------ +== Add `PGXNTOOL_ENABLE_FS_INSTALL` and `PGXNTOOL_ENABLE_PGXN_INSTALL` +`test`/`verify-results` unconditionally filesystem-installed the extension +(via PGXS's `install`), and `installcheck` unconditionally auto-installed +the pgtap dependency via `pgxn install pgtap --sudo` when it wasn't already +present -- with no way to disable either. That defeated "existing mode" +testing, where the extension (and/or pgtap) was deployed some other way, +e.g. registered via pg_tle instead of the filesystem: calling `test` or +`verify-results` would silently filesystem-install as a side effect, +undermining the point of proving the other deployment path works. + +`PGXNTOOL_ENABLE_FS_INSTALL` (default `yes`) now gates `install` as a +prerequisite of `test`/`verify-results`, and whether `installcheck` depends +on `install`. `PGXNTOOL_ENABLE_PGXN_INSTALL` (default: follows +`PGXNTOOL_ENABLE_FS_INSTALL`, but can be set independently) gates the pgtap +auto-install. Set either to `no` to disable. + +Issues fixed in this release: #55, #90 + 2.3.0 ----- == Rename `PGTLE_VERSION` to `PGXNTOOL_PGTLE_VERSION` diff --git a/README.asc b/README.asc index 45c4b59..3a3e19a 100644 --- a/README.asc +++ b/README.asc @@ -55,6 +55,8 @@ NOTE: `test` exits non-zero (after printing `regression.diffs`) if any test fail NOTE: While you can still run `make installcheck` or any other valid PGXS make target directly, it's recommended to use `make test` when using pgxntool. The `test` target ensures proper test isolation and correct dependency installation. +Whether `test`/`installcheck`/`verify-results` filesystem-install the extension first is controlled by `PGXNTOOL_ENABLE_FS_INSTALL`, and whether `installcheck` auto-installs the pgtap dependency via `pgxn install` is controlled by `PGXNTOOL_ENABLE_PGXN_INSTALL` — see <<_pgxntool_enable_fs_install>> and <<_pgxntool_enable_pgxn_install>> for "existing mode"/pg_tle-style testing, where the extension (and/or pgtap) was deployed some other way and a filesystem install would defeat the point of the test. + === test-build Validates that extension SQL files are syntactically correct before running the full test suite. This feature runs SQL files from `test/build/` through `pg_regress`, providing better error messages than `CREATE EXTENSION` failures when there are syntax errors in your extension code. @@ -718,6 +720,14 @@ Default: auto-detected -- `yes` if `test/build/*.sql` files exist, `no` otherwis Default: auto-detected -- `yes` if `test/install/*.sql` files exist, `no` otherwise. Enables or disables the <<_testinstall,test/install>> schedule-based setup feature. Same explicit-override semantics as `PGXNTOOL_ENABLE_TEST_BUILD`. +=== PGXNTOOL_ENABLE_FS_INSTALL * + +Default: `yes`. Controls whether `install` is a prerequisite of `test`/`verify-results`, and whether `installcheck` depends on `install`. Set to `no` for "existing mode" testing, where the extension under test was deployed some other way (e.g. registered via pg_tle instead of the filesystem, or installed by a binary pg_upgrade) -- with this set, `make test`/`make installcheck`/`make verify-results` run against whatever is already installed instead of filesystem-installing first. + +=== PGXNTOOL_ENABLE_PGXN_INSTALL * + +Default: follows `PGXNTOOL_ENABLE_FS_INSTALL` (so it's off automatically whenever filesystem install is off), but can be set independently. Controls whether `installcheck` auto-installs the pgtap dependency via `pgxn install pgtap --sudo` when it isn't already filesystem-installed. Set to `no` to make this a complete no-op, e.g. when pgtap is already provided some other way and you don't want a `sudo pgxn install` invoked as a side effect of testing. + === PGXNTOOL_ENABLE_VERIFY_RESULTS * Default: `yes`. Enables or disables the <<_verify_results_safeguard,verify-results safeguard>> that blocks `make results` when tests are failing. Setting it to empty on the command line (`make PGXNTOOL_ENABLE_VERIFY_RESULTS= results`) also disables it. diff --git a/README.html b/README.html index ba71c2a..db633b5 100644 --- a/README.html +++ b/README.html @@ -507,10 +507,12 @@

PGXNtool

  • 8.7. PGXNTOOL_VERIFY_RESULTS_MODE
  • 8.8. PGXNTOOL_ENABLE_TEST_BUILD *
  • 8.9. PGXNTOOL_ENABLE_TEST_INSTALL *
  • -
  • 8.10. PGXNTOOL_ENABLE_VERIFY_RESULTS *
  • -
  • 8.11. PGXNTOOL_ENABLE_CHECK_STALE_EXPECTED *
  • -
  • 8.12. PGXNTOOL_CHECK_EXPECTED_FILE_TYPES *
  • -
  • 8.13. PGXNTOOL_NO_PGXS_INCLUDE
  • +
  • 8.10. PGXNTOOL_ENABLE_FS_INSTALL *
  • +
  • 8.11. PGXNTOOL_ENABLE_PGXN_INSTALL *
  • +
  • 8.12. PGXNTOOL_ENABLE_VERIFY_RESULTS *
  • +
  • 8.13. PGXNTOOL_ENABLE_CHECK_STALE_EXPECTED *
  • +
  • 8.14. PGXNTOOL_CHECK_EXPECTED_FILE_TYPES *
  • +
  • 8.15. PGXNTOOL_NO_PGXS_INCLUDE
  • 9. Copyright
  • @@ -635,11 +637,26 @@

    Note +test exits non-zero (after printing regression.diffs) if any test fails. Previously it always exited 0 regardless of test results, silently masking failures from CI and other automation that relies on the exit code. + + + + +
    + + + +
    +
    Note
    +
    While you can still run make installcheck or any other valid PGXS make target directly, it’s recommended to use make test when using pgxntool. The test target ensures proper test isolation and correct dependency installation.
    +

    4.3. test-build

    @@ -1071,7 +1088,7 @@

    4.9. pgxntool-sync

    -

    This rule will pull down the latest released version of PGXNtool via git subtree pull and then reconcile the files setup.sh copied into your project (.gitignore, test/deps.sql) with a 3-way merge.

    +

    This rule will pull down the latest released version of PGXNtool via git subtree pull and then reconcile the files setup.sh copied into your project (.gitignore, test/deps.sql) with a 3-way merge (it also verifies the test/pgxntool symlink, recreating it if missing).

    @@ -1941,13 +1958,25 @@

    -

    8.10. PGXNTOOL_ENABLE_VERIFY_RESULTS *

    +

    8.10. PGXNTOOL_ENABLE_FS_INSTALL *

    +
    +

    Default: yes. Controls whether install is a prerequisite of test/verify-results, and whether installcheck depends on install. Set to no for "existing mode" testing, where the extension under test was deployed some other way (e.g. registered via pg_tle instead of the filesystem, or installed by a binary pg_upgrade) — with this set, make test/make installcheck/make verify-results run against whatever is already installed instead of filesystem-installing first.

    +
    + +
    +

    8.11. PGXNTOOL_ENABLE_PGXN_INSTALL *

    +
    +

    Default: follows PGXNTOOL_ENABLE_FS_INSTALL (so it’s off automatically whenever filesystem install is off), but can be set independently. Controls whether installcheck auto-installs the pgtap dependency via pgxn install pgtap --sudo when it isn’t already filesystem-installed. Set to no to make this a complete no-op, e.g. when pgtap is already provided some other way and you don’t want a sudo pgxn install invoked as a side effect of testing.

    +
    +
    +
    +

    8.12. PGXNTOOL_ENABLE_VERIFY_RESULTS *

    Default: yes. Enables or disables the verify-results safeguard that blocks make results when tests are failing. Setting it to empty on the command line (make PGXNTOOL_ENABLE_VERIFY_RESULTS= results) also disables it.

    -

    8.11. PGXNTOOL_ENABLE_CHECK_STALE_EXPECTED *

    +

    8.13. PGXNTOOL_ENABLE_CHECK_STALE_EXPECTED *

    Default: yes. Enables or disables the check-stale-expected safeguard, which fails make test if test/expected/ (or test/build/expected/) contains a .out file with no corresponding .sql file — catching a stale file left behind after a test was renamed or removed. Set to no to make the check a complete no-op (it’s dropped from TEST_DEPS entirely).

    @@ -1956,13 +1985,13 @@

    -

    8.12. PGXNTOOL_CHECK_EXPECTED_FILE_TYPES *

    +

    8.14. PGXNTOOL_CHECK_EXPECTED_FILE_TYPES *

    Default: yes. Sub-check of check-stale-expected, independent of PGXNTOOL_ENABLE_CHECK_STALE_EXPECTED: fails (with a distinct error message and exit code from the orphaned-.out check) if test/expected/ (or test/build/expected/) contains any file that isn’t *.out. Set to no to disable just this sub-check while leaving the orphaned-.out check active.

    -

    8.13. PGXNTOOL_NO_PGXS_INCLUDE

    +

    8.15. PGXNTOOL_NO_PGXS_INCLUDE

    Default: unset (PGXS is included normally). Skips including PGXS ($(PGXS)) entirely. This is only for advanced scenarios where you need to manage the PGXS include yourself; most projects should never set this.

    @@ -1983,7 +2012,7 @@