From 8dd0c4f27aae02dd60f029db4cf03f9902cba26f Mon Sep 17 00:00:00 2001 From: Linnnus Date: Tue, 8 Apr 2025 01:07:22 +0000 Subject: feat: Initial commit At this point we have some allocation routines but no work on the actual language has been done. --- scripts/build_debug.sh | 5 +++++ scripts/build_release.sh | 5 +++++ scripts/git-pre-commit-hook.sh | 12 ++++++++++++ scripts/unit_test.sh | 5 +++++ 4 files changed, 27 insertions(+) create mode 100755 scripts/build_debug.sh create mode 100755 scripts/build_release.sh create mode 100755 scripts/git-pre-commit-hook.sh create mode 100755 scripts/unit_test.sh (limited to 'scripts') diff --git a/scripts/build_debug.sh b/scripts/build_debug.sh new file mode 100755 index 0000000..fcdf16a --- /dev/null +++ b/scripts/build_debug.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e -u -o pipefail +mkdir -p bin/debug +clang -std=c23 -ggdb -O0 -Wall -Wextra -fsanitize=undefined,address -o bin/debug/sand src/{cli,core}/*.c +clang -std=c23 -ggdb -O0 -Wall -Wextra -fsanitize=undefined,address -o bin/debug/unit src/{unit,core}/*.c diff --git a/scripts/build_release.sh b/scripts/build_release.sh new file mode 100755 index 0000000..6f42aed --- /dev/null +++ b/scripts/build_release.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e -u -o pipefail +mkdir -p bin/release +clang -std=c23 -O3 -Wall -Wextra -o bin/release/sand src/{cli,core}/*.c +clang -std=c23 -O3 -Wall -Wextra -o bin/release/unit src/{unit,core}/*.c diff --git a/scripts/git-pre-commit-hook.sh b/scripts/git-pre-commit-hook.sh new file mode 100755 index 0000000..d6297e7 --- /dev/null +++ b/scripts/git-pre-commit-hook.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e -u -o pipefail + +# All of this is output for humans, not programs. +exec >&2 + +unit="$(scripts/unit_test.sh)" +if [ $? -ne 0 ]; then + echo "$unit" + echo "You have failing unit tests. Aborting git commit." + exit 1 +fi diff --git a/scripts/unit_test.sh b/scripts/unit_test.sh new file mode 100755 index 0000000..6369974 --- /dev/null +++ b/scripts/unit_test.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e -u -o pipefail +mode="${1:-debug}" +scripts/build_$mode.sh +bin/$mode/unit || gdb bin/$mode/unit -- cgit v1.2.3