AtlatestRepositorysigil-doc

sigil-doc / tree / testgate-d4a.sh

1#!/usr/bin/env bash
2set -euo pipefail
3repo_dir="$(cd "$(dirname "$0")/.." && pwd)"
4cd "$repo_dir"
5mkdir -p build
6sigil="${SIGIL_D1_COMPILER:-$repo_dir/../task-sigil-language-readers/build/dev/bin/sigil}"
7redirects="${SIGIL_D1_REDIRECTS:-$repo_dir/dev-redirects.sgl}"
8sigil_sxml_root="${SIGIL_SXML_ROOT:-$repo_dir/../sigil-sxml}"
9cache_dir=$(mktemp -d "$repo_dir/build/d4a-cache.XXXXXX")
10export XDG_CACHE_HOME="$cache_dir"
11export SIGIL_REDIRECTS="$redirects"
13"$sigil" -L "$sigil_sxml_root/src" -L src -L test test \
14 test/test-publication-html.sgl test/test-model.sgl test/test-reader.sgl test/test-examples.sgl --report \
15 | tee "$cache_dir/publication.log"
16rg -q '37 passed' "$cache_dir/publication.log"
17echo D4A_GATE_01_D0_D2_D3_PUBLICATION_37_37
19# Hidden example checks run real subjects, so they need the executable.
20SIGIL_BIN="$sigil" "$sigil" -L "$sigil_sxml_root/src" -L src -L test test \
21 test/test-example-check.sgl --report \
22 | tee "$cache_dir/example-check.log"
23rg -q '10 passed' "$cache_dir/example-check.log"
24echo D4A_GATE_01B_EXAMPLE_CHECKS_10_10
26"$sigil" -L "$sigil_sxml_root/src" -L src -L test eval -f test/d4a-trusted-presentation.sgl \
27 | tee "$cache_dir/trusted.log"
28rg -q D4A_TRUSTED_PRESENTATION_GREEN "$cache_dir/trusted.log"
29echo D4A_GATE_02_TRUSTED_RESULT
31rg -q '@chapter\["Change the Question" authors:' test/fixtures/practical-sigil-change-question.sgd
32rg -q '@ref \["first-script"\]' test/fixtures/practical-sigil-change-question.sgd
33echo D4A_GATE_03_SECOND_CHAPTER_AUTHORING_CONTRACT
35# The semantic adapter must not grow into a site generator. Press owns these.
36# Subject-existence pins: to `if rg`, a missing file (exit 2) reads as clean
37# (exit 1), so a rename would disarm this boundary sweep silently.
38test -f src/sigil/doc/render/html.sgl
39test -f src/sigil/doc/publication.sgl
40if rg -n -i '<html|<head|stylesheet|site-nav|sitemap|robots\.txt|write-file|copy-file|output-directory' \
41 src/sigil/doc/render/html.sgl src/sigil/doc/publication.sgl; then
42 echo 'D4A renderer leaked Press/site-generation responsibility' >&2
43 exit 1
44fi
45echo D4A_GATE_04_PRESS_BOUNDARY
46echo D4A_GATE_GREEN