#!/usr/bin/env bash # run.sh — build and execute the html_sanitizer acceptance corpus. # # Compiles tests/html_sanitizer/runner.el via the canonical native elc, # links against the shared C runtime, then runs the binary against # cases.json. Exits non-zero on any FAIL. set -euo pipefail cd "$(dirname "$0")" EL_HOME="${EL_HOME:-$(cd ../.. && pwd)}" ELC="${EL_HOME}/dist/platform/elc" RUNTIME_DIR="${EL_HOME}/el-compiler/runtime" if [ ! -x "${ELC}" ]; then echo "elc not found at ${ELC}" >&2 exit 1 fi OUT_C="$(mktemp -t html_sanitizer.XXXXXX).c" OUT_BIN="$(mktemp -t html_sanitizer.XXXXXX)" trap 'rm -f "${OUT_C}" "${OUT_BIN}"' EXIT echo "==> Compiling runner.el via ${ELC}" "${ELC}" runner.el > "${OUT_C}" echo "==> Linking against ${RUNTIME_DIR}/el_runtime.c" cc -O2 -I "${RUNTIME_DIR}" "${OUT_C}" "${RUNTIME_DIR}/el_runtime.c" \ -lcurl -lpthread -o "${OUT_BIN}" echo "==> Running" "${OUT_BIN}"