From b29db00c07b9dcaabb0a42ecd2d34d99c3c36701 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Fri, 16 Oct 2026 16:21:39 -0500 Subject: [PATCH 1/2] Test `test/install` with a separate `TESTOUT` Add tests for pgxntool commit ad8cde4 (`test/install` when `TESTOUT` differs from `TESTDIR`): - `_test-install-output-link` makes `$(TESTOUT)/install` a symlink to `$(TESTDIR)/install`, and fails rather than replace a pre-existing directory there (no Postgres needed) - `make test TESTOUT=` passes on the template, with results in that directory Both are folded into existing tests in `test-test-install.bats`. --- test/standard/test-test-install.bats | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/standard/test-test-install.bats b/test/standard/test-test-install.bats index a627bd8..46954b4 100644 --- a/test/standard/test-test-install.bats +++ b/test/standard/test-test-install.bats @@ -5,6 +5,7 @@ # Tests the complete test/install lifecycle: # - Auto-detection: enabled when test/install/ has SQL files # - Schedule generation with ../install/ relative paths +# - The $(TESTOUT)/install symlink used when TESTOUT differs from TESTDIR # - Core contract: install state persists into main test suite # - Disabling via PGXNTOOL_ENABLE_TEST_INSTALL # - PGXNTOOL_ENABLE_TEST_INSTALL=yes erroring when test/install/ is empty @@ -45,6 +46,24 @@ setup() { # Schedule should reference install files with relative path run grep "../install/" test/install/schedule assert_success + + # Those ../install/ paths resolve against TESTOUT for actual output but + # against TESTDIR for expected output, so a separate TESTOUT gets a + # symlink back to TESTDIR's install directory. + local out="$BATS_TEST_TMPDIR/testout" target + target="$(pwd -P)/test/install" + run make _test-install-output-link TESTOUT="$out" + assert_success + [ -L "$out/install" ] + [ "$(readlink "$out/install")" = "$target" ] + + # Anything else already at that path is left alone, and fails the build. + rm "$out/install" + mkdir "$out/install" + run make _test-install-output-link TESTOUT="$out" + assert_failure + echo "$output" | grep -q "exists and is not a symlink to $target" + [ -d "$out/install" ] && [ ! -L "$out/install" ] } @test "install schedule orders files by name, not filesystem/creation order (issue #111)" { @@ -88,6 +107,12 @@ setup() { run diff test/expected/verify_install_marker.out test/results/verify_install_marker.out assert_success + # The same suite passes with output sent to a separate TESTOUT. + local out="$BATS_TEST_TMPDIR/testout" + run make test TESTOUT="$out" + assert_success + assert_file_exists "$out/results/verify_install_marker.out" + assert_repo_clean "after make test" } From 8ee202af1917e5b23e7c749c0bcb3c44de29b57d Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Fri, 16 Oct 2026 16:24:53 -0500 Subject: [PATCH 2/2] Test that `test-build` output follows `TESTOUT` Add tests for pgxntool commit fb1b256 (`test-build` output follows `TESTOUT`): - `make -n test-build TESTOUT=...` passes `--outputdir=/build` - `make test TESTOUT=` leaves test-build output in `/build/results/` --- test/standard/test-test-build.bats | 5 +++++ test/standard/test-test-install.bats | 1 + 2 files changed, 6 insertions(+) diff --git a/test/standard/test-test-build.bats b/test/standard/test-test-build.bats index 145eef0..f671052 100644 --- a/test/standard/test-test-build.bats +++ b/test/standard/test-test-build.bats @@ -29,6 +29,11 @@ setup() { run make -n test 2>&1 assert_success echo "$output" | grep -q "test-build" + + # Actual output follows TESTOUT; input and expected files stay in TESTDIR. + run make -n test-build TESTOUT=/nonexistent/testout 2>&1 + assert_success + echo "$output" | grep -q -- "--inputdir=test/build --outputdir=/nonexistent/testout/build" } @test "test-build runs successfully with template files" { diff --git a/test/standard/test-test-install.bats b/test/standard/test-test-install.bats index 46954b4..a969b91 100644 --- a/test/standard/test-test-install.bats +++ b/test/standard/test-test-install.bats @@ -112,6 +112,7 @@ setup() { run make test TESTOUT="$out" assert_success assert_file_exists "$out/results/verify_install_marker.out" + assert_file_exists "$out/build/results/build_check.out" assert_repo_clean "after make test" }