aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile40
-rw-r--r--tests2/Makefile12
2 files changed, 41 insertions, 11 deletions
diff --git a/tests/Makefile b/tests/Makefile
index e07cdc3..e5c3294 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,17 +2,36 @@
# Tiny C Compiler Makefile - tests
#
+TOP = ..
+include $(TOP)/Makefile
+
# what tests to run
-TESTS = libtest test3
+TESTS = libtest \
+ test1 \
+ test2 \
+ test3 \
+ speedtest \
+ btest \
+ weaktest
+
+ # test4 # this test does not seem to work on any platform
+ # asmtest # this test does not seem to work on any platform
# these should work too
# TESTS += test1 test2 speedtest btest weaktest
-# these don't work as they should
-# TESTS += test4 asmtest
-
-TOP = ..
-include $(TOP)/Makefile
+# some tests do not pass on all platforms, remove them for now
+ifeq ($(TARGETOS),Linux)
+ TESTS := $(filter-out btest,$(TESTS))
+ TESTS := $(filter-out weaktest,$(TESTS))
+endif
+ifeq ($(TARGETOS),Darwin)
+ TESTS := $(filter-out test1,$(TESTS))
+ TESTS := $(filter-out test2,$(TESTS))
+ TESTS := $(filter-out test3,$(TESTS))
+ TESTS := $(filter-out btest,$(TESTS))
+ TESTS := $(filter-out weaktest,$(TESTS))
+endif
ifdef DISABLE_STATIC
export LD_LIBRARY_PATH:=$(CURDIR)/..
@@ -25,7 +44,10 @@ NATIVE_DEFINES+=-D_ANSI_SOURCE
endif
# run local version of tcc with local libraries and includes
-TCC = ../tcc -B..
+TCC = ../tcc -B.. $(NATIVE_DEFINES)
+ifdef CONFIG_WIN32
+ TCC := $(TCC) -I $(TOP)/win32/include -L$(TOP)
+endif
RUN_TCC = $(NATIVE_DEFINES) -run -DONE_SOURCE ../tcc.c -B..
DISAS=objdump -d
@@ -46,13 +68,13 @@ libtest: libtcc_test$(EXESUF) $(LIBTCC1)
./libtcc_test$(EXESUF) lib_path=..
libtcc_test$(EXESUF): libtcc_test.c ../$(LIBTCC)
- $(CC) -o $@ $^ -I.. $(CFLAGS) $(LIBS) $(LINK_LIBTCC)
+ $(CC) -o $@ $^ -I.. $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC)
# test.ref - generate using gcc
# copy only tcclib.h so GCC's stddef and stdarg will be used
test.ref: tcctest.c
cp ../include/tcclib.h .
- $(CC) -o tcctest.gcc $< -I. -w $(CFLAGS) -std=gnu99
+ $(CC) -o tcctest.gcc $< -I. -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99
./tcctest.gcc > $@
# auto test
diff --git a/tests2/Makefile b/tests2/Makefile
index cc13cde..b57028b 100644
--- a/tests2/Makefile
+++ b/tests2/Makefile
@@ -67,9 +67,18 @@ TESTS= 00_assignment.test \
# 34_array_assignment.test \ # array assignment is not in C standard
# 46_grep.test \ # does not compile even with gcc
+# some tests do not pass on all platforms, remove them for now
+ifeq ($(TARGETOS),Darwin)
+ TESTS := $(filter-out 40_stdio.test,$(TESTS))
+endif
+ifdef CONFIG_WIN32
+ TESTS := $(filter-out 24_math_library.test,$(TESTS))
+ TESTS := $(filter-out 28_strings.test,$(TESTS))
+endif
+
%.test: %.expect %.c
@echo Test: $*...
- -@if [ "x`echo $* | grep args`" != "x" ]; \
+ @if [ "x`echo $* | grep args`" != "x" ]; \
then \
../tcc -B.. $(TCCFLAGS) -run $*.c - arg1 arg2 arg3 arg4 2>&1 >$*.output; \
else \
@@ -78,7 +87,6 @@ TESTS= 00_assignment.test \
@if diff -bu $*.expect $*.output ; \
then \
rm -f $*.output \
- : \
else \
echo "ERROR: test $*"; \
fi