Showing the changes to tests (3 of 6 files). Show all
Unified · Split
| @@ -4,8 +4,8 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | TOP = .. | 5 | TOP = .. |
| 6 | include $(TOP)/Makefile | 6 | include $(TOP)/Makefile |
| 7 | VPATH = $(TOP)/tests $(TOP) | 7 | VPATH = $(TOPSRC)/tests $(TOPSRC) $(TOP) |
| 8 | CFLAGS = -I$(TOP) | 8 | CFLAGS = -I$(TOPSRC) -I$(TOP) |
| 9 | 9 | ||
| 10 | # what tests to run | 10 | # what tests to run |
| 11 | TESTS = \ | 11 | TESTS = \ |
| @@ -42,14 +42,14 @@ ifeq ($(CONFIG_arm_eabi),yes) · 30 unmodified lines | |||
| 42 | endif | 42 | endif |
| 43 | 43 | ||
| 44 | # run local version of tcc with local libraries and includes | 44 | # run local version of tcc with local libraries and includes |
| 45 | TCCFLAGS = -B$(TOP) -I$(TOP) | 45 | TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) |
| 46 | ifdef CONFIG_WIN32 | 46 | ifdef CONFIG_WIN32 |
| 47 | TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP) | 47 | TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) |
| 48 | PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll | 48 | PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll |
| 49 | endif | 49 | endif |
| 50 | 50 | ||
| 51 | TCC = $(TOP)/tcc $(TCCFLAGS) | 51 | TCC = $(TOP)/tcc $(TCCFLAGS) |
| 52 | RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS) | 52 | RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) |
| 53 | 53 | ||
| 54 | ifeq ($(TARGETOS),Darwin) | 54 | ifeq ($(TARGETOS),Darwin) |
| 55 | CFLAGS += -Wl,-flat_namespace,-undefined,warning | 55 | CFLAGS += -Wl,-flat_namespace,-undefined,warning |
| @@ -154,9 +154,9 @@ btest: boundtest.c · 98 unmodified lines | |||
| 154 | speedtest: ex2 ex3 | 154 | speedtest: ex2 ex3 |
| 155 | @echo ------------ $@ ------------ | 155 | @echo ------------ $@ ------------ |
| 156 | time ./ex2 1238 2 3 4 10 13 4 | 156 | time ./ex2 1238 2 3 4 10 13 4 |
| 157 | time $(TCC) -run $(TOP)/examples/ex2.c 1238 2 3 4 10 13 4 | 157 | time $(TCC) -run $(TOPSRC)/examples/ex2.c 1238 2 3 4 10 13 4 |
| 158 | time ./ex3 35 | 158 | time ./ex3 35 |
| 159 | time $(TCC) -run $(TOP)/examples/ex3.c 35 | 159 | time $(TCC) -run $(TOPSRC)/examples/ex3.c 35 |
| 160 | 160 | ||
| 161 | weaktest: tcctest.c test.ref | 161 | weaktest: tcctest.c test.ref |
| 162 | $(TCC) -c $< -o weaktest.tcc.o | 162 | $(TCC) -c $< -o weaktest.tcc.o |
| @@ -165,7 +165,7 @@ weaktest: tcctest.c test.ref · 2 unmodified lines | |||
| 165 | objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt | 165 | objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt |
| 166 | diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK" | 166 | diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK" |
| 167 | 167 | ||
| 168 | ex%: $(TOP)/examples/ex%.c | 168 | ex%: $(TOPSRC)/examples/ex%.c |
| 169 | $(CC) -o $@ $< $(CFLAGS) | 169 | $(CC) -o $@ $< $(CFLAGS) |
| 170 | 170 | ||
| 171 | # tiny assembler testing | 171 | # tiny assembler testing |
| @@ -2,8 +2,13 @@ · 1 unmodified line | |||
| 2 | # credits: 01..13.c from the pcc cpp-tests suite | 2 | # credits: 01..13.c from the pcc cpp-tests suite |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | TOP = ../.. | ||
| 6 | include $(TOP)/config.mak | ||
| 7 | SRC = $(TOPSRC)/tests/pp | ||
| 8 | VPATH = $(SRC) | ||
| 9 | |||
| 5 | TCC = ../../tcc | 10 | TCC = ../../tcc |
| 6 | files = $(patsubst %.$1,%.test,$(wildcard *.$1)) | 11 | files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1))) |
| 7 | TESTS = $(call files,c) $(call files,S) | 12 | TESTS = $(call files,c) $(call files,S) |
| 8 | 13 | ||
| 9 | all test : $(sort $(TESTS)) | 14 | all test : $(sort $(TESTS)) |
| @@ -13,13 +18,13 @@ DIFF_OPTS = -Nu -b -B -I "^\#" · 3 unmodified lines | |||
| 13 | %.test: %.c %.expect | 18 | %.test: %.c %.expect |
| 14 | @echo PPTest $* ... | 19 | @echo PPTest $* ... |
| 15 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ | 20 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ |
| 16 | diff $(DIFF_OPTS) $*.expect $*.output \ | 21 | diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ |
| 17 | && rm -f $*.output | 22 | && rm -f $*.output |
| 18 | 23 | ||
| 19 | %.test: %.S %.expect | 24 | %.test: %.S %.expect |
| 20 | @echo PPTest $* ... | 25 | @echo PPTest $* ... |
| 21 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ | 26 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ |
| 22 | diff $(DIFF_OPTS) $*.expect $*.output \ | 27 | diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ |
| 23 | && rm -f $*.output | 28 | && rm -f $*.output |
| 24 | 29 | ||
| 25 | # automatically generate .expect files with gcc: | 30 | # automatically generate .expect files with gcc: |
| @@ -1,14 +1,16 @@ | |||
| 1 | TOP = ../.. | 1 | TOP = ../.. |
| 2 | include $(TOP)/Makefile | 2 | include $(TOP)/config.mak |
| 3 | SRC = $(TOPSRC)/tests/tests2 | ||
| 4 | VPATH = $(SRC) | ||
| 3 | 5 | ||
| 4 | # run local version of tcc with local libraries and includes | 6 | # run local version of tcc with local libraries and includes |
| 5 | TCCFLAGS = -B$(TOP) -I$(TOP) | 7 | TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include |
| 6 | ifdef CONFIG_WIN32 | 8 | ifdef CONFIG_WIN32 |
| 7 | TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP) | 9 | TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP) |
| 8 | endif | 10 | endif |
| 9 | TCC = $(TOP)/tcc $(TCCFLAGS) | 11 | TCC = $(TOP)/tcc $(TCCFLAGS) |
| 10 | 12 | ||
| 11 | TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c))) | 13 | TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c)))) |
| 12 | 14 | ||
| 13 | # 34_array_assignment.test -- array assignment is not in C standard | 15 | # 34_array_assignment.test -- array assignment is not in C standard |
| 14 | SKIP = 34_array_assignment.test | 16 | SKIP = 34_array_assignment.test |
| @@ -34,15 +36,16 @@ endif · 19 unmodified lines | |||
| 34 | # Some tests might need arguments | 36 | # Some tests might need arguments |
| 35 | ARGS = | 37 | ARGS = |
| 36 | 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5 | 38 | 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5 |
| 37 | 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c | 39 | 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c |
| 38 | 40 | ||
| 39 | # Some tests might need different flags | 41 | # Some tests might need different flags |
| 40 | 76_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers | 42 | 76_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers |
| 41 | 43 | ||
| 44 | # Filter source directory in warnings/errors (out-of-tree builds) | ||
| 45 | FILTER = 2>&1 | sed 's,$(SRC)/,,g' | ||
| 42 | # Filter some always-warning | 46 | # Filter some always-warning |
| 43 | FILTER = | ||
| 44 | ifeq (-$(findstring arm,$(ARCH))-,-arm-) | 47 | ifeq (-$(findstring arm,$(ARCH))-,-arm-) |
| 45 | FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported' | 48 | FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported' |
| 46 | endif | 49 | endif |
| 47 | 50 | ||
| 48 | all test: $(filter-out $(SKIP),$(TESTS)) | 51 | all test: $(filter-out $(SKIP),$(TESTS)) |
| @@ -51,10 +54,7 @@ all test: $(filter-out $(SKIP),$(TESTS)) · 2 unmodified lines | |||
| 51 | @echo Test: $*... | 54 | @echo Test: $*... |
| 52 | # test -run | 55 | # test -run |
| 53 | @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true | 56 | @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true |
| 54 | @diff -Nbu $*.expect $*.output && rm -f $*.output | 57 | @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output |
| 55 | # test exe (disabled for speed) | ||
| 56 | # @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \ | ||
| 57 | # diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe | ||
| 58 | 58 | ||
| 59 | # automatically generate .expect files with gcc: | 59 | # automatically generate .expect files with gcc: |
| 60 | %.expect : | 60 | %.expect : |