History

build: restore out-of-tree support

grischka committed 10 years ago

Commit afdbc5b1 parent 0a624786 files · +58 −48Browse files

Showing the changes to tests (3 of 6 files). Show all

Unified · Split

3 files
  1. tests/Makefile +8 −8
  2. tests/pp/Makefile +8 −3
  3. tests/tests2/Makefile +11 −11
tests/Makefile+8−8
@@ -4,8 +4,8 @@ · 3 unmodified lines
4 4
5TOP = ..5TOP = ..
6include $(TOP)/Makefile6include $(TOP)/Makefile
7VPATH = $(TOP)/tests $(TOP)7VPATH = $(TOPSRC)/tests $(TOPSRC) $(TOP)
8CFLAGS = -I$(TOP)8CFLAGS = -I$(TOPSRC) -I$(TOP)
9 9
10# what tests to run10# what tests to run
11TESTS = \11TESTS = \
@@ -42,14 +42,14 @@ ifeq ($(CONFIG_arm_eabi),yes) · 30 unmodified lines
42endif42endif
43 43
44# run local version of tcc with local libraries and includes44# run local version of tcc with local libraries and includes
45TCCFLAGS = -B$(TOP) -I$(TOP)45TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
46ifdef CONFIG_WIN3246ifdef 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.dll48 PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll
49endif49endif
50 50
51TCC = $(TOP)/tcc $(TCCFLAGS)51TCC = $(TOP)/tcc $(TCCFLAGS)
52RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS)52RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS)
53 53
54ifeq ($(TARGETOS),Darwin)54ifeq ($(TARGETOS),Darwin)
55 CFLAGS += -Wl,-flat_namespace,-undefined,warning55 CFLAGS += -Wl,-flat_namespace,-undefined,warning
@@ -154,9 +154,9 @@ btest: boundtest.c · 98 unmodified lines
154speedtest: ex2 ex3154speedtest: ex2 ex3
155 @echo ------------ $@ ------------155 @echo ------------ $@ ------------
156 time ./ex2 1238 2 3 4 10 13 4156 time ./ex2 1238 2 3 4 10 13 4
157 time $(TCC) -run $(TOP)/examples/ex2.c 1238 2 3 4 10 13 4157 time $(TCC) -run $(TOPSRC)/examples/ex2.c 1238 2 3 4 10 13 4
158 time ./ex3 35158 time ./ex3 35
159 time $(TCC) -run $(TOP)/examples/ex3.c 35159 time $(TCC) -run $(TOPSRC)/examples/ex3.c 35
160 160
161weaktest: tcctest.c test.ref161weaktest: tcctest.c test.ref
162 $(TCC) -c $< -o weaktest.tcc.o162 $(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.txt165 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
168ex%: $(TOP)/examples/ex%.c168ex%: $(TOPSRC)/examples/ex%.c
169 $(CC) -o $@ $< $(CFLAGS)169 $(CC) -o $@ $< $(CFLAGS)
170 170
171# tiny assembler testing171# tiny assembler testing
tests/pp/Makefile+8−3
@@ -2,8 +2,13 @@ · 1 unmodified line
2# credits: 01..13.c from the pcc cpp-tests suite2# credits: 01..13.c from the pcc cpp-tests suite
3#3#
4 4
5TOP = ../..
6include $(TOP)/config.mak
7SRC = $(TOPSRC)/tests/pp
8VPATH = $(SRC)
9
5TCC = ../../tcc10TCC = ../../tcc
6files = $(patsubst %.$1,%.test,$(wildcard *.$1))11files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
7TESTS = $(call files,c) $(call files,S)12TESTS = $(call files,c) $(call files,S)
8 13
9all test : $(sort $(TESTS))14all test : $(sort $(TESTS))
@@ -13,13 +18,13 @@ DIFF_OPTS = -Nu -b -B -I "^\#" · 3 unmodified lines
13%.test: %.c %.expect18%.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 $*.output22 && rm -f $*.output
18 23
19%.test: %.S %.expect24%.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 $*.output28 && rm -f $*.output
24 29
25# automatically generate .expect files with gcc:30# automatically generate .expect files with gcc:
tests/tests2/Makefile+11−11
@@ -1,14 +1,16 @@
1TOP = ../..1TOP = ../..
2include $(TOP)/Makefile2include $(TOP)/config.mak
3SRC = $(TOPSRC)/tests/tests2
4VPATH = $(SRC)
3 5
4# run local version of tcc with local libraries and includes6# run local version of tcc with local libraries and includes
5TCCFLAGS = -B$(TOP) -I$(TOP)7TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include
6ifdef CONFIG_WIN328ifdef CONFIG_WIN32
7 TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP)9 TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP)
8endif10endif
9TCC = $(TOP)/tcc $(TCCFLAGS)11TCC = $(TOP)/tcc $(TCCFLAGS)
10 12
11TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c)))13TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c))))
12 14
13# 34_array_assignment.test -- array assignment is not in C standard15# 34_array_assignment.test -- array assignment is not in C standard
14SKIP = 34_array_assignment.test16SKIP = 34_array_assignment.test
@@ -34,15 +36,16 @@ endif · 19 unmodified lines
34# Some tests might need arguments36# Some tests might need arguments
35ARGS =37ARGS =
3631_args.test : ARGS = arg1 arg2 arg3 arg4 arg53831_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
3746_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c3946_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
38 40
39# Some tests might need different flags41# Some tests might need different flags
4076_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers4276_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers
41 43
44# Filter source directory in warnings/errors (out-of-tree builds)
45FILTER = 2>&1 | sed 's,$(SRC)/,,g'
42# Filter some always-warning46# Filter some always-warning
43FILTER =
44ifeq (-$(findstring arm,$(ARCH))-,-arm-)47ifeq (-$(findstring arm,$(ARCH))-,-arm-)
45FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported'48FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported'
46endif49endif
47 50
48all test: $(filter-out $(SKIP),$(TESTS))51all 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 -run55# test -run
53 @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true56 @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true
54 @diff -Nbu $*.expect $*.output && rm -f $*.output57 @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 :

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t