2 include $(TOP
)/Makefile
3 SRC
= $(TOPSRC
)/tests
/tests2
6 TESTS
= $(patsubst %.c
,%.
test,\
7 $(sort $(notdir $(wildcard $(SRC
)/??_
*.c
)))\
8 $(sort $(notdir $(wildcard $(SRC
)/???_
*.c
))))
10 # some tests do not pass on all platforms, remove them for now
11 SKIP
= 34_array_assignment.
test # array assignment is not in C standard
12 ifeq (-$(CONFIG_arm_eabi
)-$(CONFIG_arm_vfp
)-,-yes--
)
13 SKIP
+= 22_floating_point.
test
16 SKIP
+= 40_stdio.
test 42_function_pointer.
test
21 ifeq (,$(filter i386
,$(ARCH
)))
22 SKIP
+= 98_al_ax_extend.
test 99_fastcall.
test
24 ifeq (,$(filter i386 x86_64
,$(ARCH
)))
25 SKIP
+= 85_asm-outside-function.
test # x86 asm
26 SKIP
+= 124_atomic_counter.
test
27 SKIP
+= 125_atomic_misc.
test # currently only x86 supported
28 SKIP
+= 127_asm_goto.text
# hardcodes x86 asm
30 ifeq ($(CONFIG_backtrace
),no
)
31 SKIP
+= 113_btdll.
test
33 # no bcheck without backtrace
35 ifeq ($(CONFIG_bcheck
),no
)
36 SKIP
+= 112_backtrace.
test
37 SKIP
+= 114_bound_signal.
test
38 SKIP
+= 115_bound_setjmp.
test
39 SKIP
+= 116_bound_setjmp2.
test
40 SKIP
+= 117_builtins.
test
42 ifeq ($(CONFIG_dll
),no
)
43 SKIP
+= 113_btdll.
test # no shared lib support yet
45 ifeq (-$(findstring gcc
,$(CC
))-,--)
46 SKIP
+= $(patsubst %.expect
,%.
test,$(GEN-ALWAYS
))
48 ifeq (-$(CONFIG_WIN32
)-$(CONFIG_i386
)$(CONFIG_arm
)-,--yes-
)
49 SKIP
+= 95_bitfields
%.
test # type_align is different on 32bit-non-windows
51 ifeq (-$(CONFIG_WIN32
)-,-yes-
)
52 SKIP
+= 106_versym.
test # No pthread support
53 SKIP
+= 114_bound_signal.
test # No pthread support
54 SKIP
+= 117_builtins.
test # win32 port doesn't define __builtins
55 SKIP
+= 124_atomic_counter.
test # No pthread support
57 ifneq (,$(filter OpenBSD FreeBSD NetBSD
,$(TARGETOS
)))
58 SKIP
+= 106_versym.
test # no pthread_condattr_setpshared
59 SKIP
+= 114_bound_signal.
test # libc problem signal/fork
60 SKIP
+= 116_bound_setjmp2.
test # No TLS_FUNC/TLS_VAR in bcheck.c
62 ifneq (,$(filter Darwin
,$(TARGETOS
)))
63 SKIP
+= 126_bound_global.
test # bt-exe.c problem on apple
66 # Some tests might need arguments
68 31_args.
test : ARGS
= arg1 arg2 arg3 arg4 arg5
69 46_grep.
test : ARGS
= '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC
)/46_grep.c
71 # And some tests don't test the right thing with -run
73 42_function_pointer.
test : NORUN
= true
75 # Some tests might need different flags
77 76_dollars_in_identifiers.
test : FLAGS
+= -fdollars-in-identifiers
79 # These tests run several snippets from the same file one by one
80 60_errors_and_warnings.
test : FLAGS
+= -dt
81 96_nodata_wanted.
test : FLAGS
+= -dt
83 # Always generate certain .expects (don't put these in the GIT),
85 # GEN-ALWAYS += 95_bitfields.expect # does not work
87 # using the ms compiler for the really ms-compatible bitfields
88 95_bitfields_ms.
test : GEN
= $(GEN-MSC
)
90 # this test compiles/links two files:
91 104_inline.
test : FLAGS
+= $(subst 104,104+,$1)
92 104_inline.
test : GEN
= $(GEN-TCC
)
94 # this test needs two files, and we want to invoke the linker
95 120_alias.
test : FLAGS
+= $(subst 120,120+,$1)
96 120_alias.
test : GEN
= $(GEN-TCC
)
97 120_alias.
test : NORUN
= true
99 # this test needs pthread
100 106_versym.
test: FLAGS
+= -pthread
101 106_versym.
test: NORUN
= true
103 # constructor/destructor
104 108_constructor.
test: NORUN
= true
106 112_backtrace.
test: FLAGS
+= -dt
-b
107 112_backtrace.
test 113_btdll.
test 126_bound_global.
test: FILTER
+= \
108 -e
's;[0-9A-Fa-fx]\{5,\};........;g' \
109 -e
's;0x[0-9A-Fa-f]\{1,\};0x?;g'
111 # this test creates two DLLs and an EXE
112 113_btdll.
test: T1
= \
113 $(TCC
) -bt
$1 -shared
-D DLL
=1 -o a1
$(DLLSUF
) && \
114 $(TCC
) -bt
$1 -shared
-D DLL
=2 -o a2
$(DLLSUF
) && \
115 $(TCC
) -bt
$1 a1
$(DLLSUF
) a2
$(DLLSUF
) -Wl
,-rpath
=.
-o a.exe
&& \
118 114_bound_signal.
test: FLAGS
+= -b
119 114_bound_signal.
test: NORUN
= true
# tcc -run does not support fork and -b and SELINUX
120 115_bound_setjmp.
test: FLAGS
+= -b
121 116_bound_setjmp2.
test: FLAGS
+= -b
122 117_builtins.
test: T1
= ( $(TCC
) -run
$1 && $(TCC
) -b
-run
$1 )
123 ifneq ($(CONFIG_bcheck
),no
)
124 121_struct_return.
test: FLAGS
+= -b
125 122_vla_reuse.
test: FLAGS
+= -b
127 125_atomic_misc.
test: FLAGS
+= -dt
128 124_atomic_counter.
test: FLAGS
+= -pthread
129 126_bound_global.
test: FLAGS
+= -b
130 126_bound_global.
test: NORUN
= true
132 # Filter source directory in warnings/errors (out-of-tree builds)
133 FILTER
= 2>&1 | sed
-e
's,$(SRC)/,,g'
135 all test tests2.
all: $(filter-out $(SKIP
),$(TESTS
))
136 @
$(MAKE
) clean --no-print-directory
-s
142 T1
= $(TCC
) $(FLAGS
) $(T2
) $(ARGS
)
143 T2
= $(if
$(NORUN
),$1 -o a.exe
&& .
/a.exe
,-run
$1)
144 T3
= $(FILTER
) >$*.output
2>&1 || true \
145 && diff
-Nbu
$(filter %.expect
,$^
) $*.output \
146 && rm -f
$*.output
$(filter $*.expect
,$(GEN-ALWAYS
))
148 # run single test and update .expect file, e.g. "make tests2.37+"
150 @
$(MAKE
) $(call F2
,$(call F1
,$*)) --no-print-directory
152 # just run tcc to see the output, e.g. "make tests2.37-"
154 @
$(MAKE
) $(call F1
,$*) T3
= --no-print-directory
156 # run single test, e.g. "make tests2.37"
158 @
$(MAKE
) $(call F1
,$*) --no-print-directory
160 F1
= $(or
$(filter $1_%,$(TESTS
)),$1_???.
test)
161 F2
= $1 UPDATE
="$(patsubst %.test,%.expect,$1)"
163 # automatically generate .expect files with gcc:
166 @
$(call GEN
,$(SRC
)/$*.c
) $(FILTER
) >$@
2>&1
167 @
rm -f
*.exe
*.obj
*.pdb
169 # using TCC for .expect if -dt in FLAGS
170 GEN
= $(if
$(filter -dt
-bt
-b
,$(FLAGS
)),$(GEN-TCC
),$(GEN-CC
))
171 GEN-CC
= $(CC
) -w
-std
=gnu99
$(FLAGS
) $1 -o a.exe
&& .
/a.exe
$(ARGS
)
173 GEN-MSC
= $(MS-CC
) $1 && .
/$(basename $@
).exe
176 # tell make not to delete
179 # force .expect generation for these files
180 $(sort $(GEN-ALWAYS
) $(UPDATE
)) : force
184 rm -f fred.txt
*.output a.exe
*.dll
*.so
*.def
$(GEN-ALWAYS
)