diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-08-27 13:56:43 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-08-28 10:37:10 -0400 |
| commit | 45e9fbe26925d64ad3da4ff4a2a53ffcc5df4c0d (patch) | |
| tree | d27051700b4f5c7b139b21554321d60c966741dc | |
| parent | image digest: include headings in image scan (diff) | |
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)
| -rw-r--r-- | org/test_shell_script_ssp_document_abstraction.org | 12 | ||||
| -rwxr-xr-x | test/test-abstraction-ssp.sh | 12 |
2 files changed, 24 insertions, 0 deletions
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)" |
