#!/usr/bin/env bash # run_one.sh # # Probe one file with clawhdf5 (PROBE) and with h5py (PY ref.py), and with # h5dump too when WITH_H5DUMP is set. Each side runs under a timeout (TMO # seconds, SIGKILL) and an address-space limit (MEM_KB), with core dumps off. # Writes /.{json,err,rc}; rc 137 = killed by the timeout. set -u f="$1"; out="$2"; mkdir -p "$out" HERE="$(cd "$(dirname "$0")" && pwd)" : "${PROBE:?PROBE must name the conformance-probe binary}" : "${PY:?PY must name a python with h5py}" TMO="${TMO:-20}" MEM_KB="${MEM_KB:-4194304}" run() { # name cmd... local name=$1; shift ( ulimit -v "$MEM_KB"; ulimit -c 0; RUST_BACKTRACE=1 exec timeout -s KILL "$TMO" "$@" ) \ >"$out/$name.json" 2>"$out/$name.err" echo $? >"$out/$name.rc" } run ours "$PROBE" "$f" run ref "$PY" "$HERE/ref.py" "$f" if [ -n "${WITH_H5DUMP:-}" ]; then run h5dump h5dump "$f" : >"$out/h5dump.json" # h5dump's text dump is not compared, only its exit status fi exit 0