tests: Minor adjustments selecting which tests are run on each platform.

The intent is for 'make test' to pass cleanly on each platform, and thus easier
spotting of regressions. Linux is best supported by most tests running and
passing. Mac OSX passes mosts tests that do not make/link with binary files,
due to lack of mach-o file support.

!!! I have very limited knowledge of Windows platform, and cannot comment why
all tests(1) fail. I have posted to newsgroup asking for someone to test
Windows platform.
master
Milutin Jovanović 2012-06-27 13:04:27 -04:00
parent 240064c03b
commit d54e24cc0e
2 changed files with 41 additions and 11 deletions

View File

@ -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

View File

@ -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