From d9c846f16b3280711e352e491c41e2c456232c29 Mon Sep 17 00:00:00 2001 From: ChronicallyJD Date: Sat, 8 Aug 2026 15:12:57 -0600 Subject: [PATCH] test: print the .so under test, and name what PGC_SKIP_BUILD actually skips Three separate defects in one session were a suite reporting checks against a binary nobody had just built: - a compile error the harness did not check, which reported 19 green checks against a source file containing invalid C (#508); - a PGC_SKIP_BUILD=1 run that skipped the INSTALL, not just the build, and exercised a guard-removed leftover from an earlier removal proof -- three suites failing for a reason that had nothing to do with the change; - objects from one major linked into another's .so, which surfaces as a cluster that will not start behind a message naming nothing. Every one produced a plausible PASS/FAIL list. Every one is one line of md5sum away from being obvious. So pgc_setup now prints that line on every run, whether or not anything looks wrong -- the point is precisely that nothing does. It also makes a red-on-change proof self-evidencing. Two arms reporting the same hash have proved nothing whatever their check counts say, and that is currently something each person has to remember to verify by hand. PGC_SKIP_BUILD is named in the same change 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". That is 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 -- which is exactly how the second defect above happened. harness_selftest gains two checks. The first is that the line exists. 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. Proved by reproducing the original incident rather than by deleting the check: build a genuinely different binary, do not install it, run with PGC_SKIP_BUILD=1. installed 8b58d7fdcb0d, built 7564d4f138ed -> FAIL, as it should The first attempt at that proof appended a comment to a source file and rebuilt. The binary was byte-identical, both hashes matched, and the check passed -- which the fingerprint line itself is what revealed. A perturbation that does not perturb is not a proof, and this one says so out loud. Refs #508 --- test/harness_selftest.sh | 26 ++++++++++++++++++++++++++ test/lib.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/test/harness_selftest.sh b/test/harness_selftest.sh index 37e5462..c4a3f95 100755 --- a/test/harness_selftest.sh +++ b/test/harness_selftest.sh @@ -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:-})")" \ + "yes" + pgc_summary diff --git a/test/lib.sh b/test/lib.sh index 4989fd4..13689b0 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -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)" @@ -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 {