52 lines
2.1 KiB
Bash
Executable File
52 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Negative controls for scripts/tests/m3/diff/check.sh.
|
|
#
|
|
# scripts/tests/m3/diff/negative-control.sh
|
|
#
|
|
# The differential check must reject a TI golden whose real Screen.root or
|
|
# Display.screens displacement is wrong. This is a guard on the oracle
|
|
# itself: an earlier check matched `64`/`1152` anywhere in the function body,
|
|
# so the unrelated local `*FP(64)` (and the prefix `0x400`) satisfied it even
|
|
# after the real load was changed to 512. Each mutation below must make
|
|
# check.sh fail; the stored goldens are never modified.
|
|
#
|
|
# Overridable: the same variables as check.sh.
|
|
set -eu
|
|
|
|
DIR=$(cd "$(dirname "$0")" && pwd)
|
|
TMP=$(mktemp -d "${TMPDIR:-/tmp}/m3-diff-neg.XXXXXX")
|
|
trap 'rm -rf "$TMP"' EXIT HUP INT TERM
|
|
|
|
expect_fail() { # expect_fail WHAT MUTATED_GOLDEN
|
|
if TI_XHELLO=$2 "$DIR/check.sh" > "$TMP/out" 2>&1; then
|
|
echo "M3 diff negative control: FAIL: check.sh accepted $1" >&2
|
|
sed 's/^/ /' "$TMP/out" >&2
|
|
exit 1
|
|
fi
|
|
echo " ok negative control: $1 rejected"
|
|
grep 'M3 diff: FAIL' "$TMP/out" | sed 's/^/ /'
|
|
}
|
|
|
|
# Screen.root: *A7(64),*FP(32),1 -> *A7(512),*FP(32),1
|
|
sed 's/\*A7(64),\*FP(32)/*A7(512),*FP(32)/' \
|
|
"$DIR/ti-xhello.s" > "$TMP/root-512.s"
|
|
grep -q '\*A7(512),\*FP(32)' "$TMP/root-512.s" \
|
|
|| { echo "M3 diff negative control: mutation did not apply" >&2; exit 1; }
|
|
expect_fail "Screen.root displacement 512" "$TMP/root-512.s"
|
|
|
|
# Display.screens: *A7(1152) -> *A7(512)
|
|
sed 's/\*A7(1152)/*A7(512)/' \
|
|
"$DIR/ti-xhello.s" > "$TMP/screens-512.s"
|
|
grep -q '\*A7(512)' "$TMP/screens-512.s" \
|
|
|| { echo "M3 diff negative control: mutation did not apply" >&2; exit 1; }
|
|
expect_fail "Display.screens displacement 512" "$TMP/screens-512.s"
|
|
|
|
# Boundary: *A7(1152) -> *A7(0x4800), which shares the 0x480 prefix.
|
|
sed 's/\*A7(1152)/*A7(0x4800)/' \
|
|
"$DIR/ti-xhello.s" > "$TMP/screens-4800.s"
|
|
grep -q '\*A7(0x4800)' "$TMP/screens-4800.s" \
|
|
|| { echo "M3 diff negative control: mutation did not apply" >&2; exit 1; }
|
|
expect_fail "Display.screens displacement 0x4800 (hex boundary)" "$TMP/screens-4800.s"
|
|
|
|
echo "M3 diff negative controls: PASS"
|