29 lines
1.0 KiB
Bash
Executable File
29 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
# The break engine scenarios as native
|
|
# code. Thousands of ticks per scenario are too many for the portable interpreter.
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
bin=${1:-"$root/build/packages/ziran/build/bin"}
|
|
work=$root/build/break-engine-zi-test
|
|
include=${ZIRAN_INCLUDE:-"$root/build/packages/ziran/include"}
|
|
kryon_ui=${KRYON_UI_DIR:-"$root/build/packages/kryon/src/ui"}
|
|
|
|
rm -rf "$work"
|
|
mkdir -p "$work/c"
|
|
"$bin/zi2c" --no-main --root "$root/tests" --module-path "$root/src" --module-path "$kryon_ui" --module-path "$root/build/packages/ziran/std" \
|
|
-o "$work/c" "$root/tests/break_engine_behavior.zi"
|
|
cat > "$work/c/main.c" <<'C'
|
|
#include <stdio.h>
|
|
#include "break_engine_behavior.h"
|
|
int main(void)
|
|
{
|
|
int result = Check();
|
|
if (result != 0) fprintf(stderr, "break engine check %d failed\n", result);
|
|
return result == 0 ? 0 : 1;
|
|
}
|
|
C
|
|
"${CC:-cc}" -std=c11 -I"$include" -I"$work/c" "$work/c"/*.c -lm -o "$work/test"
|
|
env -u DISPLAY -u WAYLAND_DISPLAY "$work/test"
|
|
echo "break engine Ziran test passed"
|