#!/usr/bin/env bash # ============================================================================= # run_ref_tests.sh -- assert the object-reference surface (docs/reference/POINTERS.md). # # target.ref the implicit VM-level reference of an object # Ptr.valid/id/gen/... tier-2 views of a reference # Class.deref(p) the typed way back to an object # # Covers identity, the tier-2 views, null/forged refs failing closed, a stale # ref after collection, slot reuse never aliasing, the "declared field named # ref wins" rule, read-only enforcement, and argument checking. # # Usage: run_ref_tests.sh [path-to-sleela-binary] (run from anywhere) # ============================================================================= set -u ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" BIN="${1:-$ROOT/impl/build/sleela}" HERE="$ROOT/impl/tests/refs" cd "$ROOT" export SLEELA_SHEET="${SLEELA_SHEET:-$ROOT/SHEET.sheet}" export SLEELA_SHA256_MANIFEST="${SLEELA_SHA256_MANIFEST:-$ROOT/security/sha256-manifest.json}" fail=0 # Drop the visible security/memory records; they are not program output. strip() { sed -E -e '/^verification: PASS \([0-9]+ item\(s\)\)$/d' \ -e '/^\[security\]/d' -e '/^\[defender\]/d' -e '/^\[memory-manager\]/d'; } # expect_output