diff options
| author | hachem <im@hachem.wtf> | 2026-10-12 11:41:05 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-10-12 11:41:05 +0200 |
| commit | 62636576bce8e8121a3d70f63547fae40a52f697 (patch) | |
| tree | 077dfe4f04235cce63b7abb1b05bb539232ae74a /scripts | |
| parent | c0f000ea166a24781fcdbf23c080b203cd9b8ed7 (diff) | |
chore: refactor
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/docker_test.sh | 9 | ||||
| -rwxr-xr-x | scripts/run_suite.sh | 32 | ||||
| -rwxr-xr-x | scripts/test_examples.sh | 28 |
3 files changed, 14 insertions, 55 deletions
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 </dev/null diff --git a/scripts/run_suite.sh b/scripts/run_suite.sh deleted file mode 100755 index 56854e5..0000000 --- a/scripts/run_suite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd "$(cd "$(dirname "$0")/.." && pwd)" - -if [ -z "${NO_COLOR:-}" ]; then - bold=$'\033[1m'; red=$'\033[31m'; green=$'\033[32m'; reset=$'\033[0m' -else - bold=; red=; green=; reset= -fi - -printf '%s━━ building compiler ━━%s\n' "$bold" "$reset" -if ! build=$({ [ -d build-linux ] || meson setup build-linux; } 2>&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 |
