2 include $(TOP
)/Makefile
3 SRC
= $(TOPSRC
)/tests
/tests2
6 TESTS
= $(patsubst %.c
,%.
test,$(sort $(notdir $(wildcard $(SRC
)/*.c
))))
8 # some tests do not pass on all platforms, remove them for now
9 SKIP
= 34_array_assignment.
test # array assignment is not in C standard
10 ifeq ($(CONFIG_arm_eabi
),yes
) # not ARM soft-float
11 SKIP
+= 22_floating_point.
test
14 SKIP
+= 40_stdio.
test 42_function_pointer.
test
20 ifeq (,$(filter i386
,$(ARCH
)))
21 SKIP
+= 98_al_ax_extend.
test 99_fastcall.
test
23 ifeq (,$(filter i386 x86_64
,$(ARCH
)))
24 SKIP
+= 85_asm-outside-function.
test
26 ifeq (-$(findstring gcc
,$(CC
))-,--)
27 SKIP
+= $(patsubst %.expect
,%.
test,$(GEN-ALWAYS
))
29 ifeq (-$(CONFIG_WIN32
)-$(CONFIG_i386
)$(CONFIG_arm
)-,--yes-
)
30 SKIP
+= 95_bitfields
%.
test # type_align is differnt on 32bit-non-windows
33 # Some tests might need arguments
35 31_args.
test : ARGS
= arg1 arg2 arg3 arg4 arg5
36 46_grep.
test : ARGS
= '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC
)/46_grep.c
38 # And some tests don't test the right thing with -run
40 42_function_pointer.
test : NORUN
= true
42 # Some tests might need different flags
44 76_dollars_in_identifiers.
test : FLAGS
+= -fdollars-in-identifiers
46 # These tests run several snippets from the same file one by one
47 60_errors_and_warnings.
test : FLAGS
+= -dt
48 96_nodata_wanted.
test : FLAGS
+= -dt
50 # Always generate certain .expects (don't put these in the GIT),
52 # GEN-ALWAYS += 95_bitfields.expect # does not work
54 # using the ms compiler for the really ms-compatible bitfields
55 95_bitfields_ms.
test : GEN
= $(GEN-MSC
)
57 # Filter source directory in warnings/errors (out-of-tree builds)
58 FILTER
= 2>&1 | sed
's,$(SRC)/,,g'
59 # Filter some always-warning
60 ifeq (-$(findstring arm
,$(ARCH
))-,-arm-
)
61 FILTER
+= 2>&1 | grep
-v
'warning: soft float ABI currently not supported'
64 all test tests2.
all: $(filter-out $(SKIP
),$(TESTS
)) ;
68 @
$(if
$(NORUN
),$(T1
),$(T2
)) $(if
$(NODIFF
),,$(T3
))
70 T1
= $(TCC
) $(FLAGS
) $< -o a.exe
&& .
/a.exe
$(ARGS
)
71 T2
= $(TCC
) $(FLAGS
) -run
$< $(ARGS
)
72 T3
= $(FILTER
) >$*.output
2>&1 || true \
73 && diff
-Nbu
-I
"^\#" $(filter %.expect
,$^
) $*.output \
74 && rm -f
$*.output
$(filter $*.expect
,$(GEN-ALWAYS
))
76 # run single test and update .expect file, e.g. "make tests2.37+"
78 @
$(MAKE
) $(call F2
,$(call F1
,$*)) --no-print-directory
80 # just run tcc to see the output, e.g. "make tests2.37-"
82 @
$(MAKE
) $(call F1
,$*) NODIFF
=true
--no-print-directory
84 # run single test, e.g. "make tests2.37"
86 @
$(MAKE
) $(call F1
,$*) --no-print-directory
88 F1
= $(or
$(filter $1_%,$(TESTS
)),$1_???.
test)
89 F2
= $1 UPDATE
="$(patsubst %.test,%.expect,$1)"
91 # automatically generate .expect files with gcc:
94 @
$(call GEN
,$(SRC
)/$*.c
) $(FILTER
) >$@
2>&1
95 @
rm -f
*.exe
*.obj
*.pdb
97 # using TCC for .expect if -dt in FLAGS
98 GEN
= $(if
$(filter -dt
,$(FLAGS
)),$(GEN-TCC
),$(GEN-CC
))
99 GEN-CC
= $(CC
) -w
-std
=gnu99
$(FLAGS
) $1 -o a.exe
&& .
/a.exe
$(ARGS
)
100 GEN-TCC
= $(TCC
) $(FLAGS
) -run
$1 $(ARGS
)
101 GEN-MSC
= $(MS-CC
) $1 && .
/$(basename $@
).exe
104 # tell make not to delete
107 # force .expect generation for these files
108 $(sort $(GEN-ALWAYS
) $(UPDATE
)) : force
112 rm -f fred.txt
*.output a.exe
$(GEN-ALWAYS
)