From 49aa680ccdac46d1d2a7f9f250999b7ff7099548 Mon Sep 17 00:00:00 2001
From: Kimplul <kimi.h.kuparinen@gmail.com>
Date: Sat, 29 Jun 2024 14:20:07 +0300
Subject: start adding tests

---
 tests/makefile | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 tests/makefile

(limited to 'tests/makefile')

diff --git a/tests/makefile b/tests/makefile
new file mode 100644
index 0000000..3ab921a
--- /dev/null
+++ b/tests/makefile
@@ -0,0 +1,32 @@
+include ./tests.mk
+
+LLVM			?= 0
+CROSS_COMPILE 		:=
+COMPILER		!= [ "$(LLVM)" != "0" ] \
+				&& echo clang --target="$(CROSS_COMPILE)" \
+				|| echo $(CROSS_COMPILE)gcc
+
+CFLAGS			:= -Wall -Wextra -O0 -g
+INCLUDE_FLAGS		:= -I include
+COMPILE_JIT_TEST 	:= $(COMPILER) $(CFLAGS) $(INCLUDE_FLAGS)
+COMPILE_BCODE_TEST	:= $(COMPILER) $(CFLAGS) $(INCLUDE_FLAGS) -DFORCE_BCODE=1
+
+.PHONY: check
+check: $(BCODE_TESTS) $(JIT_TESTS)
+	echo "Success!"
+
+.PHONY: check-bcode
+check-bcode:
+	@echo "Running bytecode tests..."
+	@set -e; for test in $(BCODE_TESTS); do \
+		echo "Testing: $$test"; \
+		./$$test; \
+	done
+
+.PHONY: check-jit
+check-jit:
+	@echo "Running jit tests..."
+	@set -e; for test in $(JIT_TESTS); do \
+		echo "Testing: $$test"; \
+		./$$test; \
+	done
-- 
cgit v1.2.3