Ziran no longer has the C++ or Plan 9 targets, so the Plan 9 build, PTY, test hosts and plan9-c targets go, with the C++ test variants. Bundles use the .zx suffix, the test hosts provide Kryon's mesh raster call, and ziran.lock pins Ziran 8e36629 and Kryon c3840d2.
28 lines
1.1 KiB
Bash
28 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# Compile and run the Ziran parser benchmark without a graphics host.
|
|
set -eu
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$root"
|
|
unset DISPLAY WAYLAND_DISPLAY XAUTHORITY ENV BASH_ENV
|
|
target=${1:-c}
|
|
form=${2:-source}
|
|
case "$target" in c) ;; *) echo 'Expected c' >&2; exit 2 ;; esac
|
|
case "$form" in source|saved) ;; *) echo 'Expected source or saved' >&2; exit 2 ;; esac
|
|
ziran=${ZIRAN:-"$root/scripts/ziran.sh"}
|
|
lock_flags=
|
|
if test ! -f ziran.local.toml; then lock_flags=--locked; fi
|
|
mkdir -p build/ziran
|
|
work=$(mktemp -d "$root/build/ziran/parser-replay.XXXXXX")
|
|
trap 'rm -rf "$work"' EXIT HUP INT TERM
|
|
input=benchmarks/parser_replay.zi
|
|
if test "$form" = saved; then
|
|
"$ziran" ir --project $lock_flags --entry parser_replay:main -o "$work/ir" "$input"
|
|
input=$work/ir/parser_replay.zir
|
|
fi
|
|
"$ziran" build --project $lock_flags --target="$target" --entry parser_replay:main \
|
|
-o "$work/generated" "$input"
|
|
compiler=${CC:-cc}; standard=c11; extension=c
|
|
"$compiler" -std="$standard" -O2 -I"$work/generated" \
|
|
"$work/generated"/*."$extension" -o "$work/run"
|
|
timeout --kill-after=2s "${TERMINAL_BENCH_TIMEOUT:-30}s" "$work/run"
|