From 8bdb7d30b1cbbd75d73dcd324082646c4b82d42a Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 7 Oct 2026 16:31:40 -0500 Subject: [PATCH] Test that installcheck creates a missing test/sql/ Add tests for pgxntool commit 1fe6987 (https://github.com/Postgres-Extensions/pgxntool/pull/133): - The `$(TESTDIR)/sql` directory rule now matches `installcheck`'s `$(TESTDIR)/sql/` order-only prerequisite, so `make test` works in a project without test/sql/ `base-mk-misc.bats` runs `make -n installcheck` with TESTDIR pointed at a directory that doesn't exist, and asserts the rules for sql/, expected/ and results/ all resolve. Overriding TESTDIR reproduces a project without test/sql/ without changing the shared test environment, which setup.sh has already given a test/sql/. Co-Authored-By: Claude Opus 5.5 --- test/standard/base-mk-misc.bats | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/standard/base-mk-misc.bats b/test/standard/base-mk-misc.bats index 9018f27..9b6923d 100644 --- a/test/standard/base-mk-misc.bats +++ b/test/standard/base-mk-misc.bats @@ -35,6 +35,8 @@ # - check-duplicate-docs warns about DOCS entries sharing a basename (issue # #115): PGXS installs DOCS into one flat directory and refuses to overwrite # a file it just installed, so one collision fails the whole install. +# - installcheck's order-only directory prerequisites each have a rule that +# creates them, so a project with no test/sql/ can still run `make test`. load ../lib/helpers @@ -147,6 +149,22 @@ EOF rm -f docs-duplicate-test.mk } +@test "installcheck creates missing test/sql/, test/expected/ and results/" { + # Make treats `dir` and `dir/` as different targets, so each order-only + # prerequisite must be spelled exactly like the rule that creates it. + # Pointing TESTDIR at a directory that doesn't exist reproduces a project + # without test/sql/ without touching the shared test environment; setup.sh + # creates test/sql/, which is why the foundation itself can't show this. + local testdir="$SCRATCH_DIR/test" + + run make -n installcheck TESTDIR="$testdir" 2>&1 + assert_success + assert_not_contains "$output" "No rule to make target" + assert_contains "$output" "mkdir -p $testdir/sql/" + assert_contains "$output" "mkdir -p $testdir/expected/" + assert_contains "$output" "mkdir -p $testdir/results/" +} + @test "bin/version prints a stamped version number" { echo "2.1.0" > "$SCRATCH_DIR/HISTORY.asc"