Skip to content
Merged
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
26 changes: 26 additions & 0 deletions test/harness_selftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,30 @@ check "pgc_require_tools passes on tools that exist" \
check "pgc_require_tools fails on one that does not" \
"$(_probe pgc_require_tools pgc_no_such_tool_exists)" "1"

# ---- the harness must say which binary it is testing (#508 follow-up) -------
#
# Three separate defects this session were a suite reporting checks against a
# binary nobody had just built: a compile failure the harness did not check
# (#508), a PGC_SKIP_BUILD run that skipped the INSTALL and exercised a
# guard-removed leftover, and objects from another major linked into a third.
# Every one produced a plausible PASS/FAIL list, and every one is one line of
# md5sum away from being obvious.
#
# The first check is the line existing; the second is the one with teeth. It
# compares what is INSTALLED against what was just BUILT, using the build tree as
# an independent source rather than recomputing the installed hash the same way
# twice. Equal means the install actually happened.
_so_line="$(pgc_so_line)"
echo "$_so_line"

check "pgc_setup reports the installed .so" \
"$(grep -cE '^-- \.so: [0-9a-f]{12} ' <<<"$_so_line")" "1"

_so_installed="$(awk '{print $3}' <<<"$_so_line")"
_so_built="$(md5sum "$PGC_SRCDIR/pgcolumnar.so" 2>/dev/null | cut -c1-12)"
check "the installed .so is the one this run built" \
"$([ -n "$_so_built" ] && [ "$_so_installed" = "$_so_built" ] && echo yes \
|| echo "no (installed $_so_installed, built ${_so_built:-<none>})")" \
"yes"

pgc_summary
33 changes: 33 additions & 0 deletions test/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@ pgc_cluster_is_ours() {

# ---- setup / teardown ------------------------------------------------------

# pgc_so_line
# One line naming the shared library the suites are about to exercise.
#
# Printed on every run, not only when something looks wrong, because the failure
# it catches is invisible in a PASS/FAIL list: a suite reporting checks against a
# binary nobody just built. Three separate instances in one session -- a compile
# error the harness did not check (#508), a PGC_SKIP_BUILD run that skipped the
# INSTALL and exercised a guard-removed leftover, and objects from another major
# linked into a third -- all produced plausible results and all were one md5sum
# from being obvious.
#
# It also makes a red-on-change proof self-evidencing: two arms that report the
# same hash have proved nothing, whatever their check counts say.
pgc_so_line() {
local so
so="$("$PGC_PG_CONFIG" --pkglibdir)/pgcolumnar.so"
if [ -r "$so" ]; then
echo "-- .so: $(md5sum "$so" | cut -c1-12) $so"
else
echo "-- .so: NOT PRESENT at $so"
fi
}

pgc_setup() {
PGC_PG_CONFIG="${1:-/usr/local/pg17/bin/pg_config}"
PGC_BINDIR="$("$PGC_PG_CONFIG" --bindir)"
Expand Down Expand Up @@ -162,8 +185,18 @@ pgc_setup() {
echo " (refusing to report checks against the previously installed .so)" >&2
exit 1
fi
else
# Named because the variable is not what it says. It reads as "skip the
# build" and means "skip the build AND the install, and test whatever is
# already installed" -- correct for the matrix, which installs once per
# major before setting it, and a trap for a person who has just edited
# source and run make by hand.
echo "-- PGC_SKIP_BUILD=1: not building AND NOT INSTALLING;"
echo " whatever is already installed is what these checks measure"
fi

pgc_so_line

echo "-- initdb"
pgc_pg "initdb -D '$PGC_PGDATA' -A trust" >/dev/null 2>&1
{
Expand Down
Loading