#!/usr/bin/env bash
# misc_br_static — `bug-report --yes` with NO --model and ALL
# auto-pickups suppressed. Asserts the bundle contains the static
# files (version, host, env, mcrl2, README) and NO `model/`
# entry — proving scripted runs cannot bundle source by accident.
set -euo pipefail

"$NUCLEOS" bug-report --yes --no-last-panic --no-infer --no-last-run \
    -o "$NUCTEST_TMPDIR/bug.tar.gz" \
    < /dev/null > "$NUCTEST_TMPDIR/out.txt" 2> "$NUCTEST_TMPDIR/err.txt"

# Inventory check.
listing=$(tar tzf "$NUCTEST_TMPDIR/bug.tar.gz")
if echo "$listing" | grep -q '/model/'; then
    echo "FAIL: unexpected model/ entry in archive" >&2
    echo "$listing" >&2
    exit 1
fi
for f in README.txt version.txt host.txt env.txt mcrl2-version.txt; do
    if ! echo "$listing" | grep -q "/$f$"; then
        echo "FAIL: missing $f from bundle" >&2
        echo "$listing" >&2
        exit 1
    fi
done
