From f90bad092510c751afbd9286b9946691a416d2a1 Mon Sep 17 00:00:00 2001 From: grischka Date: Mon, 7 Apr 2014 11:20:45 +0200 Subject: tests2: cleanup - remove -norunsrc switch Meaning and usage (-run -norun...???) look sort of screwed. Also general usefulness is unclear, so it was actually to support exactly one (not even very interesting) test This partially reverts e31579b0769e1f9c0947d12e83316d1149307b1a --- tests/tests2/Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'tests/tests2/Makefile') diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index e5790c7..4d5546d 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -46,9 +46,11 @@ TESTS = \ 27_sizeof.test \ 28_strings.test \ 29_array_address.test \ + 30_hanoi.test \ 31_args.test \ 32_led.test \ 33_ternary_op.test \ + 34_array_assignment.test \ 35_sizeof.test \ 36_array_initialisers.test \ 37_sprintf.test \ @@ -60,6 +62,7 @@ TESTS = \ 43_void_param.test \ 44_scoped_declarations.test \ 45_empty_for.test \ + 46_grep.test \ 47_switch_return.test \ 48_nested_break.test \ 49_bracket_evaluation.test \ @@ -81,31 +84,31 @@ TESTS = \ # 34_array_assignment.test -- array assignment is not in C standard # 46_grep.test -- does not compile even with gcc +SKIP = 30_hanoi.test 34_array_assignment.test 46_grep.test + # some tests do not pass on all platforms, remove them for now ifeq ($(TARGETOS),Darwin) - TESTS := $(filter-out 40_stdio.test,$(TESTS)) + SKIP += 40_stdio.test endif ifdef CONFIG_WIN32 - TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS)) + SKIP += 24_math_library.test # don't have round() + SKIP += 28_strings.test # don't have r/index() / strings.h endif +# Some tests might need arguments +ARGS = +31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5 + +all test: $(filter-out $(SKIP),$(TESTS)) + %.test: %.c %.expect @echo Test: $*... - @if [ "x`echo $* | grep args`" != "x" ]; \ - then $(TCC) $< -norunsrc -run $(notdir $<) - arg1 arg2 arg3 arg4 >$*.output 2>&1; \ - else $(TCC) -run $< >$*.output 2>&1; \ - ($(TCC) -o $*.exe $< && ./$*.exe) >$*.output2 2>&1; \ - fi || true - @if diff -bu $(<:.c=.expect) $*.output ; \ - then rm -f $*.output; \ - else exit 1; \ - fi - @if test -f $*.output2; then if diff -bu $(<:.c=.expect) $*.output2 ; \ - then rm -f $*.output2; \ - else exit 1; \ - fi; fi -all test: $(TESTS) + @$(TCC) -run $< $(ARGS) >$*.output 2>&1 || true + @diff -bu $*.expect $*.output && rm -f $*.output + + @($(TCC) $< -o $*.exe && ./$*.exe $(ARGS)) >$*.output2 2>&1 || true + @diff -bu $*.expect $*.output2 && rm -f $*.output2 $*.exe clean: rm -vf fred.txt *.output* *.exe -- cgit v1.3.1