Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/standard/test-test-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
26 changes: 26 additions & 0 deletions test/standard/test-test-install.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)" {
Expand Down Expand Up @@ -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"
}

Expand Down
Loading