fixup! riscv: Implement large addend for global address
[tinycc.git] / tests / tests2 / Makefile
blobf485b2540b004e10ab1763663adaec9b606d7b03
1 TOP = ../..
2 include $(TOP)/Makefile
3 SRC = $(TOPSRC)/tests/tests2
4 VPATH = $(SRC)
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
14 endif
15 ifeq (,$(filter i386,$(ARCH)))
16 SKIP += 98_al_ax_extend.test 99_fastcall.test
17 endif
18 ifeq (,$(filter i386 x86_64,$(ARCH)))
19 SKIP += 85_asm-outside-function.test # x86 asm
20 SKIP += 127_asm_goto.test # hardcodes x86 asm
21 endif
22 ifeq ($(CONFIG_backtrace),no)
23 SKIP += 113_btdll.test
24 CONFIG_bcheck = no
25 # no bcheck without backtrace
26 endif
27 ifeq ($(CONFIG_bcheck),no)
28 SKIP += 112_backtrace.test
29 SKIP += 114_bound_signal.test
30 SKIP += 115_bound_setjmp.test
31 SKIP += 116_bound_setjmp2.test
32 SKIP += 117_builtins.test
33 SKIP += 126_bound_global.test
34 endif
35 ifeq ($(CONFIG_dll),no)
36 SKIP += 113_btdll.test # no shared lib support yet
37 endif
38 ifeq (-$(findstring gcc,$(CC))-,--)
39 SKIP += $(patsubst %.expect,%.test,$(GEN-ALWAYS))
40 endif
41 ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-)
42 SKIP += 95_bitfields%.test # type_align is different on 32bit-non-windows
43 endif
44 ifeq (-$(CONFIG_WIN32)-,-yes-)
45 SKIP += 106_versym.test # No pthread support
46 SKIP += 114_bound_signal.test # No pthread support
47 SKIP += 117_builtins.test # win32 port doesn't define __builtins
48 SKIP += 124_atomic_counter.test # No pthread support
49 endif
50 ifneq (,$(filter OpenBSD FreeBSD NetBSD,$(TARGETOS)))
51 SKIP += 106_versym.test # no pthread_condattr_setpshared
52 SKIP += 114_bound_signal.test # libc problem signal/fork
53 SKIP += 116_bound_setjmp2.test # No TLS_FUNC/TLS_VAR in bcheck.c
54 endif
56 # Some tests might need arguments
57 ARGS =
58 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
59 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
61 # And some tests don't test the right thing with -run
62 NORUN =
63 42_function_pointer.test : NORUN = true
65 # Some tests might need different flags
66 FLAGS =
67 76_dollars_in_identifiers.test : FLAGS += -fdollars-in-identifiers
68 ifneq (-$(CONFIG_WIN32)-,-yes-)
69 22_floating_point.test: FLAGS += -lm
70 24_math_library.test: FLAGS += -lm
71 endif
73 # These tests run several snippets from the same file one by one
74 60_errors_and_warnings.test : FLAGS += -dt
75 96_nodata_wanted.test : FLAGS += -dt
77 # Always generate certain .expects (don't put these in the GIT),
78 GEN-ALWAYS =
79 # GEN-ALWAYS += 95_bitfields.expect # does not work
81 # using the ms compiler for the really ms-compatible bitfields
82 95_bitfields_ms.test : GEN = $(GEN-MSC)
84 # this test compiles/links two files:
85 104_inline.test : FLAGS += $(subst 104,104+,$1)
86 104_inline.test : GEN = $(GEN-TCC)
88 # this test needs two files, and we want to invoke the linker
89 120_alias.test : FLAGS += $(subst 120,120+,$1)
90 120_alias.test : GEN = $(GEN-TCC)
91 120_alias.test : NORUN = true
93 # this test needs pthread
94 106_versym.test: FLAGS += -pthread
95 106_versym.test: NORUN = true
97 # constructor/destructor
98 108_constructor.test: NORUN = true
100 112_backtrace.test: FLAGS += -dt -b
101 112_backtrace.test 113_btdll.test 126_bound_global.test: FILTER += \
102 -e 's;[0-9A-Fa-fx]\{5,\};........;g' \
103 -e 's;0x[0-9A-Fa-f]\{1,\};0x?;g'
105 # this test creates two DLLs and an EXE
106 113_btdll.test: T1 = \
107 $(TCC) -bt $1 -shared -D DLL=1 -o a1$(DLLSUF) && \
108 $(TCC) -bt $1 -shared -D DLL=2 -o a2$(DLLSUF) && \
109 $(TCC) -bt $1 a1$(DLLSUF) a2$(DLLSUF) -Wl,-rpath=. -o $(basename $@).exe && \
110 ./$(basename $@).exe
112 114_bound_signal.test: FLAGS += -b
113 114_bound_signal.test: NORUN = true # tcc -run does not support fork and -b and SELINUX
114 115_bound_setjmp.test: FLAGS += -b
115 116_bound_setjmp2.test: FLAGS += -b
116 117_builtins.test: T1 = ( $(TCC) -run $1 && $(TCC) -b -run $1 )
117 ifneq ($(CONFIG_bcheck),no)
118 121_struct_return.test: FLAGS += -b
119 122_vla_reuse.test: FLAGS += -b
120 endif
121 125_atomic_misc.test: FLAGS += -dt
122 124_atomic_counter.test: FLAGS += -pthread
123 126_bound_global.test: FLAGS += -b
124 126_bound_global.test: NORUN = true
125 128_run_atexit.test: FLAGS += -dt
126 132_bound_test.test: FLAGS += -b
128 # Filter source directory in warnings/errors (out-of-tree builds)
129 FILTER = 2>&1 | sed -e 's,$(SRC)/,,g'
131 all test tests2.all: $(filter-out $(SKIP),$(TESTS))
132 @$(MAKE) clean --no-print-directory -s
134 %.test: %.c %.expect
135 @echo Test: $*...
136 @$(call T1,$<) $(T3)
138 T1 = $(TCC) $(FLAGS) $(T2) $(ARGS)
139 T2 = $(if $(NORUN),$1 -o $(basename $@).exe && ./$(basename $@).exe,-run $1)
140 T3 = $(FILTER) >$*.output 2>&1 || true \
141 && diff -Nbu $(filter %.expect,$^) $*.output \
142 && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
144 # run single test and update .expect file, e.g. "make tests2.37+"
145 tests2.%+:
146 @$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory
148 # just run tcc to see the output, e.g. "make tests2.37-"
149 tests2.%-:
150 @$(MAKE) $(call F1,$*) T3= --no-print-directory
152 # run single test, e.g. "make tests2.37"
153 tests2.%:
154 @$(MAKE) $(call F1,$*) --no-print-directory
156 F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test)
157 F2 = $1 UPDATE="$(patsubst %.test,%.expect,$1)"
159 # automatically generate .expect files with gcc:
160 %.expect :
161 @echo Generating: $@
162 @$(call GEN,$(SRC)/$*.c) $(FILTER) >$@ 2>&1
163 @rm -f *.exe *.obj *.pdb
165 # using TCC for .expect if -dt in FLAGS
166 GEN = $(if $(filter -dt -bt -b,$(FLAGS)),$(GEN-TCC),$(GEN-CC))
167 GEN-CC = $(CC) -w -std=gnu99 $(FLAGS) $1 -o $(basename $@).exe && ./$(basename $@).exe $(ARGS)
168 GEN-TCC = $(T1)
169 GEN-MSC = $(MS-CC) $1 && ./$(basename $@).exe
170 MS-CC = cl
172 # tell make not to delete
173 .PRECIOUS: %.expect
175 # force .expect generation for these files
176 $(sort $(GEN-ALWAYS) $(UPDATE)) : force
177 force:
179 clean :
180 rm -f fred.txt *.output *.exe *.dll *.so *.def $(GEN-ALWAYS)