diff options
| author | grischka <grischka> | 2017-07-16 12:10:00 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2017-07-16 12:10:00 +0200 |
| commit | 7f1ab9b1e111b9ea9261eec4b7c6fb0f42591eef (patch) | |
| tree | 303c1656ec1a7023247fad8047f3b86acd3542c6 /tests/tests2/Makefile | |
| parent | 69a137ff889f552b3ce58b861f3f0601c1818d6b (diff) | |
| download | tinycc-7f1ab9b1e111b9ea9261eec4b7c6fb0f42591eef.tar.gz tinycc-7f1ab9b1e111b9ea9261eec4b7c6fb0f42591eef.tar.bz2 | |
tccgen: nodata_wanted
The existing variable 'nocode_wanted' is now used to control
output of static data too. So...
(nocode_wanted == 0)
code and data (normal within functions)
(nocode_wanted < 0)
means: no code, but data (global or static data)
(nocode_wanted > 0)
means: no code and no data (code and data suppressed)
(nocode_wanted & 0xC0000000)
means: we're in declaration of static data
Also: new option '-dT' to be used with -run
tcc -dT -run file.c
This will look in file.c for certain comment-boundaries:
/*-* test-xxx: ...some description */
and then for each test below run it from memory. This way
various features and error messages can be tested with one
single file. See 96_nodata_wanted.c for an example.
Also: tccgen.c: one more bitfield fix
Diffstat (limited to 'tests/tests2/Makefile')
| -rw-r--r-- | tests/tests2/Makefile | 91 |
1 files changed, 51 insertions, 40 deletions
diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index 44f20f7..832aa49 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -5,29 +5,6 @@ VPATH = $(SRC) TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c)))) -# 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 - -# Always generate certain .expects (don't put these in the GIT), -GEN-ALWAYS = 95_bitfields.expect - -# Filter source directory in warnings/errors (out-of-tree builds) -FILTER = 2>&1 | sed 's,$(SRC)/,,g' -# Filter some always-warning -ifeq (-$(findstring arm,$(ARCH))-,-arm-) -FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported' -endif - # 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 @@ -50,46 +27,80 @@ ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-) SKIP += 95_bitfields_ms.test # type_align is differnt on 32bit-non-windows endif +# 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 + +# run the source file cut into snippets +96_nodata_wanted.test : FLAGS = -dT + +# Always generate certain .expects (don't put these in the GIT), +GEN-ALWAYS = +GEN-ALWAYS += 95_bitfields.expect + +# using the ms compiler for the really ms-compatible bitfields +95_bitfields_ms.test : GEN = $(GEN-MSC) + +# Filter source directory in warnings/errors (out-of-tree builds) +FILTER = 2>&1 | sed 's,$(SRC)/,,g' +# Filter some always-warning +ifeq (-$(findstring arm,$(ARCH))-,-arm-) +FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported' +endif + all test tests2.all: $(filter-out $(SKIP),$(TESTS)) ; %.test: %.c %.expect @echo Test: $*... - @$(if $(NORUN),\ - ($(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS)),\ - $(TCC) $(FLAGS) -run $< $(ARGS)\ - ) $(FILTER) >$*.output 2>&1 || true - @diff -Nbu $(filter %.expect,$^) $*.output \ - && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) + @$(if $(NORUN),$(T1),$(T2)) $(if $(NODIFF),,$(T3)) -F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test) -F2 = $1 UPDATE="$(patsubst %.test,%.expect,$1)" +T1 = $(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS) +T2 = $(TCC) $(FLAGS) -run $< $(ARGS) +T3 = $(FILTER) >$*.output 2>&1 || true \ + && diff -Nbu $(filter %.expect,$^) $*.output \ + && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) # run single test and update .expect file, e.g. "make tests2.37+" tests2.%+: @$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory +# just run tcc to see the output, e.g. "make tests2.37-" +tests2.%-: + @$(MAKE) $(call F1,$*) NODIFF=true --no-print-directory + # run single test, e.g. "make tests2.37" tests2.%: @$(MAKE) $(call F1,$*) --no-print-directory +F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test) +F2 = $1 UPDATE="$(patsubst %.test,%.expect,$1)" + # automatically generate .expect files with gcc: %.expect : @echo Generating: $@ - @$(CC) -w -std=gnu99 $(FLAGS) $(SRC)/$*.c -o a.exe - @./a.exe $(ARGS) $(FILTER) >$@ 2>&1 - @rm -f a.exe + @$(call GEN,$(SRC)/$*.c) $(FILTER) >$@ 2>&1 + @rm -f *.exe *.obj *.pdb -# using the ms compiler for the really ms-compatible bitfields +# using TCC for .expect if -dT in FLAGS +GEN = $(if $(findstring -dT,$(FLAGS)),$(GEN-TCC),$(GEN-CC)) +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 MS-CC = cl -95_bitfields_ms.expect : - @echo Generating: $@ - @$(MS-CC) $(basename $@).c - @./$(basename $@).exe >$@ 2>&1 - @rm -f *.exe *.obj *.pdb # tell make not to delete .PRECIOUS: %.expect +# force .expect generation for these files $(sort $(GEN-ALWAYS) $(UPDATE)) : force force: |
