aboutsummaryrefslogtreecommitdiff
path: root/tests/makefile
blob: 081170f8da41789f411f28cb5683422c34268faf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
include ./tests.mk

LLVM		?= 0
COMPILER	!= [ -n "$(CROSS_COMPILE)" ]						\
			&& {								\
				[ "$(LLVM)" != "0" ]					\
					&& echo clang --target="$(CROSS_COMPILE)"	\
					|| echo $(CROSS_COMPILE)gcc			\
					;						\
			}								\
			|| echo $(CC)

RELEASE		?= 0
OPTFLAGS	!= [ "$(RELEASE)" != "0" ] \
			&& echo "-O2" \
			|| echo "-O0"

LTO		?= 0
LTOFLAGS	!= [ "$(LTO)" != "0" ] \
			&& echo "-flto=auto"

DEBUG		?= 1
DEBUGFLAGS	!= [ "$(DEBUG)" != "0" ] \
			&& echo "-DDEBUG=1" \
			|| echo "-DNDEBUG=1"

OBFLAGS			:= -g
WARNFLAGS		:= -Wall -Wextra
INCLUDE_FLAGS		:= -I include
COMPILE_TEST		:= $(COMPILER) $(WARNFLAGS) $(OPTFLAGS) $(LTOFLAGS) \
			   $(OBFLAGS) $(CFLAGS) $(DEBUGFLAGS) $(INCLUDE_FLAGS)

.PHONY: check
check: $(TESTS)
	@echo "Running bytecode tests..."
	@set -e; for test in $(TESTS); do \
		echo "Testing: $$test"; \
		./$$test; \
	done
	@echo "Running jit tests..."
	@set -e; for test in $(TESTS); do \
		echo "Testing: $$test"; \
		./$$test 1; \
	done
	@echo "Success!"