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 a627bd8..a969b91 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,13 @@ 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_file_exists "$out/build/results/build_check.out" + assert_repo_clean "after make test" }