From 62636576bce8e8121a3d70f63547fae40a52f697 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 12 Oct 2026 11:41:05 +0200 Subject: chore: refactor --- scripts/docker_test.sh | 9 --------- scripts/run_suite.sh | 32 -------------------------------- scripts/test_examples.sh | 28 ++++++++++++++-------------- 3 files changed, 14 insertions(+), 55 deletions(-) delete mode 100755 scripts/docker_test.sh delete mode 100755 scripts/run_suite.sh (limited to 'scripts') diff --git a/scripts/docker_test.sh b/scripts/docker_test.sh deleted file mode 100755 index 5730e1d..0000000 --- a/scripts/docker_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -root="$(cd "$(dirname "$0")/.." && pwd)" -cd "$root" - -docker compose up -d >/dev/null - -docker compose exec -T -e "NO_COLOR=${NO_COLOR:-}" hdass bash /hdass/scripts/run_suite.sh &1 && meson compile -C build-linux 2>&1); then - printf '%s\n' "$build" - printf ' %s✘ build failed%s\n' "$red" "$reset" - exit 1 -fi -printf ' %s✔ compiler built%s\n\n' "$green" "$reset" - -printf '%s━━ unit tests ━━%s\n' "$bold" "$reset" -if units=$(./build-linux/tests 2>/dev/null); then - printf ' %s✔%s %s\n\n' "$green" "$reset" "$(printf '%s' "$units" | tail -1)" -else - printf '%s\n' "$units" - ./build-linux/tests || true - printf ' %s✘ unit tests failed%s\n' "$red" "$reset" - exit 1 -fi - -ASSEMBLER=nasm bash ./scripts/test_examples.sh || exit 1 -printf '\n' -ASSEMBLER=fasm bash ./scripts/test_examples.sh diff --git a/scripts/test_examples.sh b/scripts/test_examples.sh index ab4f184..f76b837 100755 --- a/scripts/test_examples.sh +++ b/scripts/test_examples.sh @@ -84,20 +84,20 @@ check() printf '%s━━ example programs (%s) ━━%s\n' "$bold" "$assembler" "$reset" -check hello_world "writes a greeting to stdout" examples/hello_world.hdass 0 "Hello, World!" -check greet "writes a fixed string" examples/greet.hdass 0 "hdass works!" -check exit_code "exits with a status code" examples/exit_code.hdass 42 "" -check arithmetic "integer compound-assignment math" examples/arithmetic.hdass 15 "" -check loop_sum "sums 1..5 with a countdown loop" examples/loop_sum.hdass 15 "" -check branch "selects the larger of two values" examples/branch.hdass 8 "" -check call "passes an argument through a proc" examples/call.hdass 21 "" -check logical "logical register names (r1..r14)" examples/logical.hdass 21 "" -check mul_div "multiply and non-rax division" examples/mul_div.hdass 8 "" -check modulo "the modulo operator (%)" examples/modulo.hdass 24 "" -check load "stores then loads through a pointer" examples/load.hdass 7 "" -check constants "hex literals and constant folding" examples/constants.hdass 42 "" -check records "enum values and struct field offsets" examples/records.hdass 42 "" -check circle "floating-point math on SSE registers" examples/circle.hdass 28 "" +check hello_world "writes a greeting to stdout" examples/hello_world.hdass 0 "Hello, World!" +check greet "writes a fixed string" examples/greet.hdass 0 "hdass works!" +check exit_code "exits with a status code" examples/exit_code.hdass 42 "" +check arithmetic "integer compound-assignment math" examples/arithmetic.hdass 15 "" +check loop_sum "sums 1..5 with a countdown loop" examples/loop_sum.hdass 15 "" +check branch "selects the larger of two values" examples/branch.hdass 8 "" +check call "passes an argument through a proc" examples/call.hdass 21 "" +check logical "logical register names (r1..r14)" examples/logical.hdass 21 "" +check mul_div "multiply and non-rax division" examples/mul_div.hdass 8 "" +check modulo "the modulo operator (%)" examples/modulo.hdass 24 "" +check load "stores then loads through a pointer" examples/load.hdass 7 "" +check constants "hex literals and constant folding" examples/constants.hdass 42 "" +check records "enum values and struct field offsets" examples/records.hdass 42 "" +check circle "floating-point math on SSE registers" examples/circle.hdass 28 "" check fibonacci "prints the first ten Fibonacci numbers" examples/fibonacci.hdass 0 "0 1 1 -- cgit v1.3