kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

arm32batch.sh (1571B)


      1 #!/usr/bin/env bash
      2 # arm32batch.sh — run the whole toy corpus through the arm32 bare lane at O0+O1,
      3 # print a compact PASS/FAIL summary + the failing list. Reuses one stub setup.
      4 set -u
      5 ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
      6 export KIT="${KIT:-$ROOT/build/release/kit}"
      7 source "$ROOT/test/lib/exec_bare.sh"
      8 WORK="${ARM32PROBE_WORK:-/tmp/arm32batch}"; mkdir -p "$WORK"
      9 exec_bare_setup arm32 "$WORK" main >"$WORK/setup.log" 2>&1 || { echo "setup failed"; cat "$WORK/setup.log"; exit 3; }
     10 pass=0; fail=0; fails=""
     11 for f in "$ROOT"/test/toy/cases/*.toy; do
     12   name=$(basename "${f%.toy}")
     13   [ -e "${f%.toy}.arm32.skip" ] && continue
     14   grep -q 'asmnop' "$f" 2>/dev/null && continue
     15   exp=$(( $(cat "${f%.toy}.expected" 2>/dev/null || echo 0) & 255 ))
     16   for opt in 0 1; do
     17     obj="$WORK/$name.O$opt.o"
     18     if ! "$KIT" cc -O"$opt" -target arm-none-eabi -mcpu=cortex-m3 -mfloat-abi=soft \
     19             -ffreestanding -c "$f" -o "$obj" >"$WORK/cc.out" 2>"$WORK/cc.err"; then
     20       fail=$((fail+1)); fails="$fails $name/O$opt(cc)"; continue
     21     fi
     22     [ -s "$WORK/cc.err" ] && { fail=$((fail+1)); fails="$fails $name/O$opt(stderr)"; continue; }
     23     if ! exec_bare_run arm32 "$obj" "$WORK" "$WORK/rc" >/dev/null 2>&1; then
     24       fail=$((fail+1)); fails="$fails $name/O$opt(link)"; continue
     25     fi
     26     rc=$(cat "$WORK/rc" 2>/dev/null || echo 99)
     27     if [ "$rc" -eq "$exp" ]; then pass=$((pass+1)); else fail=$((fail+1)); fails="$fails $name/O$opt(exp=$exp,got=$rc)"; fi
     28   done
     29 done
     30 echo "PASS=$pass FAIL=$fail"
     31 echo "FAILS:"; for x in $fails; do echo "  $x"; done