joeylib2/scripts/check-dirtymark.sh
2026-10-13 14:01:46 -05:00

31 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
# See LICENSE.md for license information.
# SPDX-License-Identifier: MIT
#
# check-dirtymark.sh - Host-cc gate for the stage's dirty-band writers: the
# multi-row mark (surfaceMarkDirtyRows, whose four-row groups reuse a group's
# result for the next group that held the same bytes) and the whole-stage
# fills, held byte for byte to the plain per-row widen over randomized band
# states and marks of every height and phase (tests/host/dirtyMarkHost.c).
#
# This is the C marker, which the x86 ports run. The 68000 ports run its twin
# in src/m68k/stageBands.s; scripts/verify-atarist-dirtymark.sh runs the same
# harness against that under Hatari. A wrong mark is invisible to the UBER
# hashes (they hash the surface, not the bands), so this is where it shows.
#
# Built as a whole BLANK-port program (the check-blank.sh source set plus the
# harness). Exits nonzero on any mismatch.
set -euo pipefail
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
cc=${CC:-cc}
work=$(mktemp -d -t joeylib-dirtymark.XXXXXX)
trap 'rm -rf "$work"' EXIT
cd "$repo"
"$cc" -O2 -DJOEYLIB_PLATFORM_BLANK \
-Iinclude -Iinclude/joey -Isrc/core -Isrc/codegen -Wall -Wextra -Werror \
src/core/*.c src/generic/*.c src/blank/blank.c tests/host/dirtyMarkHost.c \
-o "$work/dirtyMarkHost"
"$work/dirtyMarkHost"