#!/usr/bin/env bash # check-save.sh - Host-cc harness for the save-file core (src/core/save.c). # Compiles it with a POSIX save HAL (tests/host/saveHost.c) and runs real # save/read/exists/delete/disk-free round-trips inside a throwaway temp cwd, so # the SAVES/ directory it creates lands in that temp dir and is cleaned up. # # The BLANK platform block registers no JL_HAS_SAVE_*, so the save op flags are # passed on the command line to route jlpSave*/jlpDiskFree to the host HAL # instead of the generic no-op. Exits nonzero on any failed check (CI gate). set -euo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) cc=${CC:-cc} work=$(mktemp -d -t joeylib-save.XXXXXX) trap 'rm -rf "$work"' EXIT "$cc" -DJOEYLIB_PLATFORM_BLANK \ -DJL_HAS_SAVE_DIR_ENSURE -DJL_HAS_SAVE_DELETE -DJL_HAS_DISK_FREE \ -I"$repo/include" -I"$repo/include/joey" -I"$repo/src/core" -Wall -Wextra \ "$repo/src/core/save.c" "$repo/tests/host/saveHost.c" \ -o "$work/saveHost" # Run from the temp dir so the SAVES/ tree it creates is disposable. cd "$work" "$work/saveHost"