([^<]*)
|\n# \1\n|g' "$o.grid" > "$o.cols.raw" 110 { while IFS= read -r l; do case "$l" in '# '*) printf '%s\n' "$l";; *) links "$l" || true;; esac; done < "$o.cols.raw"; } > "$o.cols" 111 absol "$(cut1 "$f" '' '
')" > "$o.si" || return 1 112 } 113 release "$T/ref/layout.html" > "$T/ref/release.html" 114 parts "$(cat "$T/ref/release.html")" "$T/ref/p" || die "reference layout: header or footer part not found" 115 # Projects is the forge's entry; its target, not the former label Forge, determines current marking. 116 grep -qx $'Projects\thttps://interplane.io/explore' "$T/ref/p.nav" || die "reference Main nav has no Projects entry to https://interplane.io/explore" 117 [ "$(wc -l < "$T/ref/p.nav")" -ge 5 ] && [ "$(grep -c '^# ' "$T/ref/p.cols")" = 3 ] || die "reference parts look wrong: $(wc -l < "$T/ref/p.nav") nav entries" 118 ok "reference parts read: $(wc -l < "$T/ref/p.nav") Main nav entries, $(grep -vc '^# ' "$T/ref/p.cols") footer links in 3 columns" 119 120 # cmpparts PREFIX WHAT: compare a page's parts with the reference; prints the first difference 121 cmpparts() { 122 local p=$1 x 123 for x in nav button brand grid cols si; do 124 if ! cmp -s "$T/ref/p.$x" "$p.$x"; then echo "$x differs:"; diff "$T/ref/p.$x" "$p.$x" | head -6; return 1; fi 125 done 126 } 127 128 # ---- the forge, built from this tree 129 RID=z4ChromeFixtureRid1111111111 130 mkdir -p "$T/repo" "$T/storage" "$T/data/logs" "$T/ng" "$T/bin" 131 cp server/tests/fake/rad server/tests/fake/getent "$T/bin/" 132 chmod 755 "$T/bin/rad" "$T/bin/getent" 133 : > "$T/ng/dl.log"; : > "$T/ng/access.log" 134 printf 'chrome fixture\n' > "$T/repo/README.md" 135 git -C "$T/repo" init -q -b main 136 git -C "$T/repo" add . 137 git -C "$T/repo" -c user.name=Fixture -c user.email=fixture@example.invalid commit -qm 'chrome fixture' 138 git clone -q --bare "$T/repo" "$T/storage/$RID" 139 printf '| repo | RID | default branch |\n|---|---|---|\n| chromefixture | rad:%s | main |\n' "$RID" > "$T/RIDS.md" 140 # STORE_VARIANT=1 (with IPL_DIR): the same gates on the store-reading build (the fixture made a store) 141 SV=${STORE_VARIANT:-0} 142 if [ "$SV" = 1 ]; then 143 bash store/tests/fixstore.sh "$T/RIDS.md" "$T/storage" "$T/store" || die "fixture store" 144 export FORGE_STORE=$T/store 145 echo "STORE_VARIANT: store-reading build, store $T/store" 146 fi 147 # build NAME [SED]: compose this tree's units with every live target moved into $T, compile to $T/NAME.bin 148 build() { 149 local name=$1 extra=() 150 [ -n "${2:-}" ] && extra=(-e "$2") 151 { printf 'om2\n'; for u in $(./run.sh units); do cat "$u"; done; } > "$T/$name.base.om" 152 sed -e "s|`2130706433` 18480|`2130706433` $PORT|" \ 153 -e "s|/home/drakestapleton/handoffs/radicle/RIDS.md|$T/RIDS.md|g" \ 154 -e "s|/home/drakestapleton/.radicle/storage/|$T/storage/|g" \ 155 -e "s|/home/drakestapleton/forge-data/|$T/data/|g" \ 156 -e "s|^text tfzp0 \".*\"|text tfzp0 \"$T/ng/dl.log\"|" \ 157 -e "s|^text tfzp1 \".*\"|text tfzp1 \"$T/ng/access.log\"|" \ 158 -e "s|^text tfzwal \".*\"|text tfzwal \"$T/ng/wal\"|" \ 159 -e "s|^text tfzrad \".*\"|text tfzrad \"$T/bin/rad\"|" \ 160 -e "s|^text tfzspth \".*\"|text tfzspth \"$T/counts.snapshot\"|" \ 161 -e "s|^text tfzgent \".*\"|text tfzgent \"$T/bin/getent\"|" "${extra[@]}" "$T/$name.base.om" > "$T/$name.om" 162 local marks=("`2130706433` $PORT" "$T/RIDS.md" "$T/storage/" "$T/data/") 163 [ "$SV" = 1 ] && marks=("`2130706433` $PORT" "$T/store/" "$T/data/") 164 for marker in "${marks[@]}"; do grep -qF "$marker" "$T/$name.om"; done 165 if grep -qE '`2130706433` 18480|/home/drakestapleton/(forge-data|\.radicle|handoffs/radicle)' "$T/$name.om"; then 166 die "live target remains in $name" 167 fi 168 run "$OMC" < "$T/$name.om" > "$T/$name.bin" 2> "$T/$name.err" || { cat "$T/$name.err"; die "compile $name"; } 169 chmod 755 "$T/$name.bin" 170 } 171 start() { 172 FORGE_SOCIAL_DIR="$T/data/" taskset -c "${FORGED_CPUS:-4,5}" nice -n 10 "$T/$1.bin" > "$T/$1.log" 2>&1 & 173 pid=$! 174 for _ in $(seq 50); do 175 kill -0 "$pid" 2>/dev/null || die "$1 server exited during startup" 176 curl --max-time 1 -fsS -o /dev/null "http://127.0.0.1:$PORT/explore" && return 0 177 sleep 0.1 178 done 179 die "$1 server not ready" 180 } 181 stop() { kill "$pid" 2>/dev/null || true; wait "$pid" 2>/dev/null || true; pid=; } 182 # get PATH BASE: status on stdout; body $T/body, headers $T/hdr 183 get() { 184 local p=$1 b=$2; shift 2 185 curl --max-time 10 -sS -o "$T/body" -D "$T/hdr" -H "X-Forge-Base: $b" "$@" "http://127.0.0.1:$PORT/$p" -w '%{http_code}' 186 } 187 hdr() { grep -i "^$1:" "$T/hdr" | head -1 | tr -d '\r' | cut -d' ' -f2-; } 188 PAGES="explore:200 drakestapleton/chromefixture:200 drakestapleton/chromefixture/patches:200 drakestapleton/chromefixture/issues:200 search?q=chrome:200 stars:303 login:200 no-such-page-xyz:404" 189 # Both builds serve patch and issue lists: the store build uses patch/ and collab/native/. 190 # Keep the same 200 + chrome checks there, rather than the old pre-native 501 expectations. 191 # pagechecks BASE: checks 1 to 3 and 6 on every page; returns 1 with the reason on the first failure 192 pagechecks() { 193 local b=$1 pc page want code body cur 194 for pc in $PAGES; do 195 page=${pc%:*}; want=${pc##*:} 196 code=$(get "$page" "$b") 197 [ "$code" = "$want" ] || { echo "$b$page HTTP $code, expected $want"; return 1; } 198 # stars without a session sends the visitor to sign in: no page of its own to check 199 if [ "$code" = 303 ]; then 200 [ "$(hdr location)" = "${b}login" ] || { echo "$b$page Location '$(hdr location)'"; return 1; } 201 continue 202 fi 203 [ "$(hdr content-security-policy)" = "$CSP" ] || { echo "$b$page CSP '$(hdr content-security-policy)'"; return 1; } 204 body=$(flat "$T/body") 205 [ "$(grep -o '