Adds `crucible nwsync emit` and `crucible nwsync assemble`, the split replacement for upstream nwn_nwsync_write, which cannot be used because it wants every hak, the TLK and the module present in one run on one disk. emit explodes one artifact — a .hak/.erf or a loose file such as the TLK — into NWSync blobs (NWCompressedBuffer framing, magic NSYC, zstd) plus a NSYM v3 manifest describing only that artifact, with the same .json sidecar upstream writes. Blob names are the sha1 of the uncompressed bytes, restypes nss/ndb/gic are always skipped, an unresolvable restype is a hard error, a resource over 15 MB fails closed, and no latest or .origin file is ever written. assemble merges the per-artifact manifests into one, reading no bulk data. The merge rule is resref shadowing, not concatenation: a resref present in more than one artifact resolves to the earliest artifact in --order, the way the game resolves it. It refuses to merge across mismatched emitter versions, and takes --group-id from the caller (1 current, 2 testing; 0 is absent). Refs #53.
66 lines
2.4 KiB
Bash
Executable File
66 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Smoke test the built Crucible binaries:
|
|
# - the dispatcher reports version + lists builders
|
|
# - an unwired builder (no migrated logic yet) fails closed with exit 70
|
|
# - a wired builder rejects a missing subcommand with a usage error (exit 64,
|
|
# NOT 70) and exits cleanly under --help — proof it delegates to the migrated
|
|
# nwn-tool surface rather than faking an artifact
|
|
# - each standalone shim agrees with the dispatcher
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
bin=bin
|
|
|
|
[[ -x "${bin}/crucible" ]] || { echo "no ${bin}/crucible — run scripts/build-binaries.sh first" >&2; exit 1; }
|
|
|
|
"${bin}/crucible" version >/dev/null
|
|
"${bin}/crucible" list >/dev/null
|
|
|
|
# Keep in sync with internal/dispatch.Registry (Wired flag).
|
|
unwired=()
|
|
wired=(assets depot hak module nwsync topdata wiki)
|
|
|
|
exit_of() { set +e; "$@" >/dev/null 2>&1; local c=$?; set -e; echo "${c}"; }
|
|
|
|
for b in "${unwired[@]}"; do
|
|
[[ -x "${bin}/crucible-${b}" ]] || { echo "missing ${bin}/crucible-${b}" >&2; exit 1; }
|
|
via_dispatch="$(exit_of "${bin}/crucible" "${b}")"
|
|
via_shim="$(exit_of "${bin}/crucible-${b}")"
|
|
if [[ "${via_dispatch}" -ne 70 ]]; then
|
|
echo "FAIL: crucible ${b} exit=${via_dispatch}, want 70 (unwired must fail closed)" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "${via_shim}" -ne 70 ]]; then
|
|
echo "FAIL: crucible-${b} exit=${via_shim}, want 70 (must match dispatcher)" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
for b in "${wired[@]}"; do
|
|
[[ -x "${bin}/crucible-${b}" ]] || { echo "missing ${bin}/crucible-${b}" >&2; exit 1; }
|
|
|
|
# --help is a clean exit for a wired builder.
|
|
help_code="$(exit_of "${bin}/crucible" "${b}" --help)"
|
|
if [[ "${help_code}" -ne 0 ]]; then
|
|
echo "FAIL: crucible ${b} --help exit=${help_code}, want 0 (wired builder)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# No subcommand is a usage error, and crucially NOT the unwired 70.
|
|
via_dispatch="$(exit_of "${bin}/crucible" "${b}")"
|
|
via_shim="$(exit_of "${bin}/crucible-${b}")"
|
|
for pair in "dispatch:${via_dispatch}" "shim:${via_shim}"; do
|
|
code="${pair#*:}"
|
|
if [[ "${code}" -eq 70 ]]; then
|
|
echo "FAIL: ${pair%%:*} crucible ${b} still fails closed (70) but is wired" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "${code}" -ne 64 ]]; then
|
|
echo "FAIL: ${pair%%:*} crucible ${b} exit=${code}, want 64 (missing subcommand)" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
done
|
|
|
|
echo "smoke ok: ${#unwired[@]} unwired fail closed (70), ${#wired[@]} wired delegate to nwn-tool logic"
|