2015-07-29 23:53:57 +03:00
|
|
|
TOP = ../..
|
2017-02-25 14:49:47 +03:00
|
|
|
include $(TOP)/Makefile
|
2016-10-01 22:06:53 +03:00
|
|
|
SRC = $(TOPSRC)/tests/tests2
|
|
|
|
VPATH = $(SRC)
|
2012-06-18 21:27:32 +04:00
|
|
|
|
2018-06-01 00:51:51 +03:00
|
|
|
TESTS = $(patsubst %.c,%.test,\
|
|
|
|
$(sort $(notdir $(wildcard $(SRC)/??_*.c)))\
|
|
|
|
$(sort $(notdir $(wildcard $(SRC)/???_*.c))))
|
2013-02-05 17:27:38 +04:00
|
|
|
|
2017-04-25 22:01:54 +03:00
|
|
|
# some tests do not pass on all platforms, remove them for now
|
|
|
|
SKIP = 34_array_assignment.test # array assignment is not in C standard
|
|
|
|
ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
|
|
|
SKIP += 22_floating_point.test
|
|
|
|
endif
|
|
|
|
ifdef CONFIG_OSX
|
|
|
|
SKIP += 40_stdio.test 42_function_pointer.test
|
|
|
|
FLAGS += -w
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),x86_64)
|
|
|
|
SKIP += 73_arm64.test
|
|
|
|
endif
|
2017-09-10 12:02:48 +03:00
|
|
|
ifeq (,$(filter i386,$(ARCH)))
|
2017-09-10 13:20:02 +03:00
|
|
|
SKIP += 98_al_ax_extend.test 99_fastcall.test
|
2017-09-10 12:02:48 +03:00
|
|
|
endif
|
2017-04-25 22:01:54 +03:00
|
|
|
ifeq (,$(filter i386 x86_64,$(ARCH)))
|
|
|
|
SKIP += 85_asm-outside-function.test
|
2020-01-18 00:58:39 +03:00
|
|
|
SKIP += 112_backtrace.test
|
2017-04-25 22:01:54 +03:00
|
|
|
endif
|
2017-07-20 23:21:27 +03:00
|
|
|
ifeq (-$(findstring gcc,$(CC))-,--)
|
2017-07-14 20:26:01 +03:00
|
|
|
SKIP += $(patsubst %.expect,%.test,$(GEN-ALWAYS))
|
|
|
|
endif
|
|
|
|
ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-)
|
2017-09-25 04:03:26 +03:00
|
|
|
SKIP += 95_bitfields%.test # type_align is different on 32bit-non-windows
|
2017-07-14 20:26:01 +03:00
|
|
|
endif
|
2019-10-23 14:14:41 +03:00
|
|
|
ifneq (-$(CONFIG_WIN32)$(CONFIG_WIN64)-,--)
|
|
|
|
SKIP += 106_pthread.test # No pthread support
|
|
|
|
endif
|
2017-04-25 22:01:54 +03:00
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
# Some tests might need arguments
|
|
|
|
ARGS =
|
|
|
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
|
|
|
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
|
|
|
|
|
|
|
|
# And some tests don't test the right thing with -run
|
|
|
|
NORUN =
|
|
|
|
42_function_pointer.test : NORUN = true
|
|
|
|
|
|
|
|
# Some tests might need different flags
|
|
|
|
FLAGS =
|
|
|
|
76_dollars_in_identifiers.test : FLAGS += -fdollars-in-identifiers
|
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
# These tests run several snippets from the same file one by one
|
2019-01-11 12:35:44 +03:00
|
|
|
60_errors_and_warnings.test : FLAGS += -dt
|
2017-07-20 23:21:27 +03:00
|
|
|
96_nodata_wanted.test : FLAGS += -dt
|
2017-07-16 13:10:00 +03:00
|
|
|
|
|
|
|
# Always generate certain .expects (don't put these in the GIT),
|
|
|
|
GEN-ALWAYS =
|
2017-07-23 22:24:11 +03:00
|
|
|
# GEN-ALWAYS += 95_bitfields.expect # does not work
|
2017-07-16 13:10:00 +03:00
|
|
|
|
|
|
|
# using the ms compiler for the really ms-compatible bitfields
|
|
|
|
95_bitfields_ms.test : GEN = $(GEN-MSC)
|
|
|
|
|
2019-06-22 00:22:13 +03:00
|
|
|
# this test compiles/links two files:
|
2019-06-22 09:47:57 +03:00
|
|
|
104_inline.test : FLAGS += $(SRC)/104+_inline.c
|
2019-06-22 00:22:13 +03:00
|
|
|
104_inline.test : GEN = $(GEN-TCC)
|
|
|
|
|
2019-10-22 21:45:03 +03:00
|
|
|
# this test needs pthread
|
|
|
|
106_pthread.test: FLAGS += -pthread
|
2019-10-23 14:14:41 +03:00
|
|
|
106_pthread.test: NORUN = true
|
2019-10-22 21:45:03 +03:00
|
|
|
|
2019-10-29 09:02:58 +03:00
|
|
|
# constructor/destructor
|
|
|
|
108_constructor.test: NORUN = true
|
|
|
|
|
2020-01-18 00:58:39 +03:00
|
|
|
112_backtrace.test: FLAGS += -dt -b
|
|
|
|
112_backtrace.test: FILTER += -e 's;[0-9A-Fa-fx]\{8,\};........;g'
|
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
# Filter source directory in warnings/errors (out-of-tree builds)
|
2020-01-18 00:58:39 +03:00
|
|
|
FILTER = 2>&1 | sed -e 's,$(SRC)/,,g'
|
2017-07-16 13:10:00 +03:00
|
|
|
|
2017-07-14 20:26:01 +03:00
|
|
|
all test tests2.all: $(filter-out $(SKIP),$(TESTS)) ;
|
2014-04-07 13:20:45 +04:00
|
|
|
|
tccpp: fix issues, add tests
* fix some macro expansion issues
* add some pp tests in tests/pp
* improved tcc -E output for better diff'ability
* remove -dD feature (quirky code, exotic feature,
didn't work well)
Based partially on ideas / researches from PipCet
Some issues remain with VA_ARGS macros (if used in a
rather tricky way).
Also, to keep it simple, the pp doesn't automtically
add any extra spaces to separate tokens which otherwise
would form wrong tokens if re-read from tcc -E output
(such as '+' '=') GCC does that, other compilers don't.
* cleanups
- #line 01 "file" / # 01 "file" processing
- #pragma comment(lib,"foo")
- tcc -E: forward some pragmas to output (pack, comment(lib))
- fix macro parameter list parsing mess from
a3fc54345949535524d01319e1ca6378b7c2c201
a715d7143d9d17da17e67fec6af1c01409a71a31
(some coffee might help, next time ;)
- introduce TOK_PPSTR - to have character constants as
written in the file (similar to TOK_PPNUM)
- allow '\' appear in macros
- new functions begin/end_macro to:
- fix switching macro levels during expansion
- allow unget_tok to unget more than one tok
- slight speedup by using bitflags in isidnum_table
Also:
- x86_64.c : fix decl after statements
- i386-gen,c : fix a vstack leak with VLA on windows
- configure/Makefile : build on windows (MSYS) was broken
- tcc_warning: fflush stderr to keep output order (win32)
2015-05-09 15:29:39 +03:00
|
|
|
%.test: %.c %.expect
|
2012-06-18 21:27:32 +04:00
|
|
|
@echo Test: $*...
|
2017-07-16 13:10:00 +03:00
|
|
|
@$(if $(NORUN),$(T1),$(T2)) $(if $(NODIFF),,$(T3))
|
2017-07-14 20:26:01 +03:00
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
T1 = $(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS)
|
|
|
|
T2 = $(TCC) $(FLAGS) -run $< $(ARGS)
|
|
|
|
T3 = $(FILTER) >$*.output 2>&1 || true \
|
various stuff
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
2017-10-11 19:13:43 +03:00
|
|
|
&& diff -Nbu $(filter %.expect,$^) $*.output \
|
2017-07-16 13:10:00 +03:00
|
|
|
&& rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
|
2017-07-14 20:26:01 +03:00
|
|
|
|
|
|
|
# run single test and update .expect file, e.g. "make tests2.37+"
|
|
|
|
tests2.%+:
|
|
|
|
@$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory
|
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
# just run tcc to see the output, e.g. "make tests2.37-"
|
|
|
|
tests2.%-:
|
|
|
|
@$(MAKE) $(call F1,$*) NODIFF=true --no-print-directory
|
|
|
|
|
2017-07-14 20:26:01 +03:00
|
|
|
# run single test, e.g. "make tests2.37"
|
|
|
|
tests2.%:
|
|
|
|
@$(MAKE) $(call F1,$*) --no-print-directory
|
tccpp: fix issues, add tests
* fix some macro expansion issues
* add some pp tests in tests/pp
* improved tcc -E output for better diff'ability
* remove -dD feature (quirky code, exotic feature,
didn't work well)
Based partially on ideas / researches from PipCet
Some issues remain with VA_ARGS macros (if used in a
rather tricky way).
Also, to keep it simple, the pp doesn't automtically
add any extra spaces to separate tokens which otherwise
would form wrong tokens if re-read from tcc -E output
(such as '+' '=') GCC does that, other compilers don't.
* cleanups
- #line 01 "file" / # 01 "file" processing
- #pragma comment(lib,"foo")
- tcc -E: forward some pragmas to output (pack, comment(lib))
- fix macro parameter list parsing mess from
a3fc54345949535524d01319e1ca6378b7c2c201
a715d7143d9d17da17e67fec6af1c01409a71a31
(some coffee might help, next time ;)
- introduce TOK_PPSTR - to have character constants as
written in the file (similar to TOK_PPNUM)
- allow '\' appear in macros
- new functions begin/end_macro to:
- fix switching macro levels during expansion
- allow unget_tok to unget more than one tok
- slight speedup by using bitflags in isidnum_table
Also:
- x86_64.c : fix decl after statements
- i386-gen,c : fix a vstack leak with VLA on windows
- configure/Makefile : build on windows (MSYS) was broken
- tcc_warning: fflush stderr to keep output order (win32)
2015-05-09 15:29:39 +03:00
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test)
|
|
|
|
F2 = $1 UPDATE="$(patsubst %.test,%.expect,$1)"
|
|
|
|
|
tccpp: fix issues, add tests
* fix some macro expansion issues
* add some pp tests in tests/pp
* improved tcc -E output for better diff'ability
* remove -dD feature (quirky code, exotic feature,
didn't work well)
Based partially on ideas / researches from PipCet
Some issues remain with VA_ARGS macros (if used in a
rather tricky way).
Also, to keep it simple, the pp doesn't automtically
add any extra spaces to separate tokens which otherwise
would form wrong tokens if re-read from tcc -E output
(such as '+' '=') GCC does that, other compilers don't.
* cleanups
- #line 01 "file" / # 01 "file" processing
- #pragma comment(lib,"foo")
- tcc -E: forward some pragmas to output (pack, comment(lib))
- fix macro parameter list parsing mess from
a3fc54345949535524d01319e1ca6378b7c2c201
a715d7143d9d17da17e67fec6af1c01409a71a31
(some coffee might help, next time ;)
- introduce TOK_PPSTR - to have character constants as
written in the file (similar to TOK_PPNUM)
- allow '\' appear in macros
- new functions begin/end_macro to:
- fix switching macro levels during expansion
- allow unget_tok to unget more than one tok
- slight speedup by using bitflags in isidnum_table
Also:
- x86_64.c : fix decl after statements
- i386-gen,c : fix a vstack leak with VLA on windows
- configure/Makefile : build on windows (MSYS) was broken
- tcc_warning: fflush stderr to keep output order (win32)
2015-05-09 15:29:39 +03:00
|
|
|
# automatically generate .expect files with gcc:
|
2017-07-14 20:26:01 +03:00
|
|
|
%.expect :
|
|
|
|
@echo Generating: $@
|
2017-07-16 13:10:00 +03:00
|
|
|
@$(call GEN,$(SRC)/$*.c) $(FILTER) >$@ 2>&1
|
|
|
|
@rm -f *.exe *.obj *.pdb
|
2017-07-14 20:26:01 +03:00
|
|
|
|
2017-07-20 23:21:27 +03:00
|
|
|
# using TCC for .expect if -dt in FLAGS
|
|
|
|
GEN = $(if $(filter -dt,$(FLAGS)),$(GEN-TCC),$(GEN-CC))
|
2017-07-16 13:10:00 +03:00
|
|
|
GEN-CC = $(CC) -w -std=gnu99 $(FLAGS) $1 -o a.exe && ./a.exe $(ARGS)
|
|
|
|
GEN-TCC = $(TCC) $(FLAGS) -run $1 $(ARGS)
|
|
|
|
GEN-MSC = $(MS-CC) $1 && ./$(basename $@).exe
|
2017-07-14 20:26:01 +03:00
|
|
|
MS-CC = cl
|
2014-04-07 13:20:45 +04:00
|
|
|
|
tccpp: fix issues, add tests
* fix some macro expansion issues
* add some pp tests in tests/pp
* improved tcc -E output for better diff'ability
* remove -dD feature (quirky code, exotic feature,
didn't work well)
Based partially on ideas / researches from PipCet
Some issues remain with VA_ARGS macros (if used in a
rather tricky way).
Also, to keep it simple, the pp doesn't automtically
add any extra spaces to separate tokens which otherwise
would form wrong tokens if re-read from tcc -E output
(such as '+' '=') GCC does that, other compilers don't.
* cleanups
- #line 01 "file" / # 01 "file" processing
- #pragma comment(lib,"foo")
- tcc -E: forward some pragmas to output (pack, comment(lib))
- fix macro parameter list parsing mess from
a3fc54345949535524d01319e1ca6378b7c2c201
a715d7143d9d17da17e67fec6af1c01409a71a31
(some coffee might help, next time ;)
- introduce TOK_PPSTR - to have character constants as
written in the file (similar to TOK_PPNUM)
- allow '\' appear in macros
- new functions begin/end_macro to:
- fix switching macro levels during expansion
- allow unget_tok to unget more than one tok
- slight speedup by using bitflags in isidnum_table
Also:
- x86_64.c : fix decl after statements
- i386-gen,c : fix a vstack leak with VLA on windows
- configure/Makefile : build on windows (MSYS) was broken
- tcc_warning: fflush stderr to keep output order (win32)
2015-05-09 15:29:39 +03:00
|
|
|
# tell make not to delete
|
|
|
|
.PRECIOUS: %.expect
|
2012-11-07 17:54:43 +04:00
|
|
|
|
2017-07-16 13:10:00 +03:00
|
|
|
# force .expect generation for these files
|
2017-07-14 20:26:01 +03:00
|
|
|
$(sort $(GEN-ALWAYS) $(UPDATE)) : force
|
|
|
|
force:
|
|
|
|
|
2012-11-07 17:54:43 +04:00
|
|
|
clean:
|
2017-07-14 20:26:01 +03:00
|
|
|
rm -f fred.txt *.output a.exe $(GEN-ALWAYS)
|