mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
The isolated-venue contract ran the native preflight contract under `set -e`, so a failure ended the script before its log was printed, and the directory it announced as retained is swept by the next win.sh call's preflight. A full Windows leg failed there once (not reproduced: three runs under the same protected temp root passed) and left nothing to attribute. The native log is now always printed, and on failure each case's output too, with PowerShell's UTF-16 bytes dropped so the log stays text. The VM verdict also reads the log as text (grep -a): a NUL or a UTF-16 byte-order mark made grep call the log binary and print no matches with -o, so failures after such bytes were counted as zero -- an iteration-mode run reporting "2 failed" with a lost exit status was green. The verdict contract pins that case (15 cases). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
51 lines
2.4 KiB
Bash
51 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Keep isolated Windows runs out of shared cleanup and on their own build paths.
|
|
set -euo pipefail
|
|
task_repo="${1:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
task_contract_dir="$(mktemp -d "${TMPDIR:-/tmp}/vm-cbm-isolation.XXXXXX")"
|
|
task_contract_done=0
|
|
task_contract_cleanup() {
|
|
if [ "$task_contract_done" -eq 1 ]; then
|
|
rm -rf -- "$task_contract_dir"
|
|
else
|
|
printf 'VM isolation diagnostics retained: %s\n' "$task_contract_dir" >&2
|
|
fi
|
|
}
|
|
trap task_contract_cleanup EXIT
|
|
env -u CBM_VM_RUNNER -u CBM_VM_SOAK_BINARY bash \
|
|
"$task_repo/tests/test_vm_isolated_dispatch.sh" "$task_repo" "$task_contract_dir/dispatch"
|
|
case "$(uname -s)" in
|
|
MINGW* | MSYS* | CYGWIN*)
|
|
# The log is printed before the verdict: the retained directory does not
|
|
# outlive the next win.sh call (its preflight sweeps cbm-* roots), so the
|
|
# leg's own log is the only post-mortem a failure leaves.
|
|
task_native_rc=0
|
|
MSYS2_ARG_CONV_EXCL='*' powershell.exe -NoLogo -NoProfile -NonInteractive \
|
|
-ExecutionPolicy Bypass \
|
|
-File "$(cygpath -w "$task_repo/tests/test_windows_preflight_contract.ps1")" \
|
|
-ScriptPath "$(cygpath -w "$task_repo/scripts/ci/clean-test-residue.ps1")" \
|
|
-OutputDirectory "$(cygpath -w "$task_contract_dir/native")" \
|
|
> "$task_contract_dir/native.log" 2>&1 || task_native_rc=$?
|
|
cat "$task_contract_dir/native.log"
|
|
if [ "$task_native_rc" -ne 0 ] ||
|
|
! grep -Fq 'WINDOWS_CHECK_ONLY_COMPLETE failures=0 sentinels=2' "$task_contract_dir/native.log"; then
|
|
echo "native preflight contract failed (exit $task_native_rc); per-case output:" >&2
|
|
for task_case_file in "$task_contract_dir"/native/*.out "$task_contract_dir"/native/*.err; do
|
|
[ -f "$task_case_file" ] || continue
|
|
echo "--- ${task_case_file##*/}" >&2
|
|
# PowerShell 5.1 redirects in UTF-16LE: drop the NULs and the
|
|
# byte-order mark, which would make the leg log read as binary.
|
|
LC_ALL=C tr -d '\000\376\377' <"$task_case_file" >&2
|
|
done
|
|
exit 1
|
|
fi
|
|
;;
|
|
*)
|
|
# Native PowerShell/DACL behavior is covered by this same contract on the
|
|
# real Windows leg. Unix runs exercise the shared Bash dispatch above.
|
|
echo 'Native preflight cases require Windows; Bash dispatch verified here.'
|
|
;;
|
|
esac
|
|
task_contract_done=1
|
|
echo 'VM isolation contract passed'
|