From 45e9fbe26925d64ad3da4ff4a2a53ffcc5df4c0d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 27 Aug 2026 13:56:43 -0400 Subject: test-abstraction-ssp.sh: fail if $SpinePOD is unset test-abstraction-ssp.sh should fail if $SpinePOD is unset. SAMPLES_RAW="$SPINE_DIR/$SpinePOD" resolves to the spine directory itself when the variable is unset. That directory exists, so the "sample documents not found" check did not fire and spine was handed every file in the spine tree. Fail early instead, naming the variable and giving the path the samples are usually at. (assisted by Claude-Code) --- org/test_shell_script_ssp_document_abstraction.org | 12 ++++++++++++ test/test-abstraction-ssp.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/org/test_shell_script_ssp_document_abstraction.org b/org/test_shell_script_ssp_document_abstraction.org index 18b04ef..dbff60c 100644 --- a/org/test_shell_script_ssp_document_abstraction.org +++ b/org/test_shell_script_ssp_document_abstraction.org @@ -44,6 +44,18 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SPINE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + +# $SpinePOD names the sample pod directory, relative to the spine directory. +# Unset, "$SPINE_DIR/$SpinePOD" is the spine directory itself, which exists, +# so the "sample documents not found" check below would not catch it and +# spine would be handed every file in the spine tree. +if [ -z "$SpinePOD" ]; then + echo "ERROR: \$SpinePOD is not set." >&2 + echo " Set it to the sample pod directory, relative to $SPINE_DIR" >&2 + echo " e.g. SpinePOD=../../markup/sisudoc-spine-samples/markup/pod-samples/pod" >&2 + exit 2 +fi + SAMPLES_RAW="$SPINE_DIR/$SpinePOD" if [ -d "$SAMPLES_RAW" ]; then SAMPLES_DIR="$(cd "$SAMPLES_RAW" && pwd)" diff --git a/test/test-abstraction-ssp.sh b/test/test-abstraction-ssp.sh index d03f70c..f7b85c0 100755 --- a/test/test-abstraction-ssp.sh +++ b/test/test-abstraction-ssp.sh @@ -22,6 +22,18 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SPINE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + +# $SpinePOD names the sample pod directory, relative to the spine directory. +# Unset, "$SPINE_DIR/$SpinePOD" is the spine directory itself, which exists, +# so the "sample documents not found" check below would not catch it and +# spine would be handed every file in the spine tree. +if [ -z "$SpinePOD" ]; then + echo "ERROR: \$SpinePOD is not set." >&2 + echo " Set it to the sample pod directory, relative to $SPINE_DIR" >&2 + echo " e.g. SpinePOD=../../markup/sisudoc-spine-samples/markup/pod-samples/pod" >&2 + exit 2 +fi + SAMPLES_RAW="$SPINE_DIR/$SpinePOD" if [ -d "$SAMPLES_RAW" ]; then SAMPLES_DIR="$(cd "$SAMPLES_RAW" && pwd)" -- cgit v1.2.3