2013-02-05 17:27:38 +04:00
|
|
|
TOP = ../..
|
2012-06-18 21:27:32 +04:00
|
|
|
include $(TOP)/Makefile
|
|
|
|
|
2013-02-05 17:27:38 +04:00
|
|
|
ifdef CONFIG_WIN32
|
|
|
|
TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
|
2014-04-07 13:13:19 +04:00
|
|
|
else
|
|
|
|
TCCFLAGS = -B$(TOP) -I$(top_srcdir)/include -lm
|
2012-06-18 21:27:32 +04:00
|
|
|
endif
|
|
|
|
|
2013-02-05 17:27:38 +04:00
|
|
|
ifeq ($(TARGETOS),Darwin)
|
|
|
|
CFLAGS += -Wl,-flat_namespace,-undefined,warning
|
|
|
|
TCCFLAGS += -D_ANSI_SOURCE
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET:=10.2
|
2012-06-18 21:27:32 +04:00
|
|
|
endif
|
|
|
|
|
2013-04-17 23:32:07 +04:00
|
|
|
TCC = $(TOP)/tcc $(TCCFLAGS)
|
2012-06-18 21:27:32 +04:00
|
|
|
|
2013-02-05 17:27:38 +04:00
|
|
|
TESTS = \
|
|
|
|
00_assignment.test \
|
|
|
|
01_comment.test \
|
|
|
|
02_printf.test \
|
|
|
|
03_struct.test \
|
|
|
|
04_for.test \
|
|
|
|
05_array.test \
|
|
|
|
06_case.test \
|
|
|
|
07_function.test \
|
|
|
|
08_while.test \
|
|
|
|
09_do_while.test \
|
|
|
|
10_pointer.test \
|
|
|
|
11_precedence.test \
|
|
|
|
12_hashdefine.test \
|
|
|
|
13_integer_literals.test \
|
|
|
|
14_if.test \
|
|
|
|
15_recursion.test \
|
|
|
|
16_nesting.test \
|
|
|
|
17_enum.test \
|
|
|
|
18_include.test \
|
|
|
|
19_pointer_arithmetic.test \
|
|
|
|
20_pointer_comparison.test \
|
|
|
|
21_char_array.test \
|
|
|
|
22_floating_point.test \
|
|
|
|
23_type_coercion.test \
|
|
|
|
24_math_library.test \
|
|
|
|
25_quicksort.test \
|
|
|
|
26_character_constants.test \
|
|
|
|
27_sizeof.test \
|
|
|
|
28_strings.test \
|
|
|
|
29_array_address.test \
|
2014-04-07 13:20:45 +04:00
|
|
|
30_hanoi.test \
|
2013-02-05 17:27:38 +04:00
|
|
|
31_args.test \
|
|
|
|
32_led.test \
|
|
|
|
33_ternary_op.test \
|
2014-04-07 13:20:45 +04:00
|
|
|
34_array_assignment.test \
|
2013-02-05 17:27:38 +04:00
|
|
|
35_sizeof.test \
|
|
|
|
36_array_initialisers.test \
|
|
|
|
37_sprintf.test \
|
|
|
|
38_multiple_array_index.test \
|
|
|
|
39_typedef.test \
|
|
|
|
40_stdio.test \
|
|
|
|
41_hashif.test \
|
|
|
|
42_function_pointer.test \
|
|
|
|
43_void_param.test \
|
|
|
|
44_scoped_declarations.test \
|
|
|
|
45_empty_for.test \
|
2014-04-07 13:20:45 +04:00
|
|
|
46_grep.test \
|
2013-02-05 17:27:38 +04:00
|
|
|
47_switch_return.test \
|
|
|
|
48_nested_break.test \
|
|
|
|
49_bracket_evaluation.test \
|
|
|
|
50_logical_second_arg.test \
|
|
|
|
51_static.test \
|
|
|
|
52_unnamed_enum.test \
|
|
|
|
54_goto.test \
|
2014-03-25 16:54:19 +04:00
|
|
|
55_lshift_type.test \
|
|
|
|
56_btype_excess-1.test \
|
2014-03-30 08:55:32 +04:00
|
|
|
57_btype_excess-2.test \
|
|
|
|
58_function_redefinition.test \
|
|
|
|
59_function_array.test \
|
|
|
|
60_enum_redefinition.test \
|
|
|
|
61_undefined_enum.test \
|
2014-03-31 18:58:17 +04:00
|
|
|
62_enumerator_redefinition.test \
|
2014-04-07 19:30:57 +04:00
|
|
|
63_local_enumerator_redefinition.test \
|
2014-04-08 18:19:48 +04:00
|
|
|
64_macro_nesting.test \
|
|
|
|
65_macro_concat_start.test \
|
2014-04-12 08:00:13 +04:00
|
|
|
66_macro_concat_end.test \
|
2014-06-29 16:35:57 +04:00
|
|
|
67_macro_concat.test \
|
2014-07-01 19:54:49 +04:00
|
|
|
68_macro_param_list_err_1.test \
|
|
|
|
69_macro_param_list_err_2.test
|
2013-02-05 17:27:38 +04:00
|
|
|
|
|
|
|
# 34_array_assignment.test -- array assignment is not in C standard
|
2012-06-18 21:27:32 +04:00
|
|
|
|
2014-04-12 22:04:10 +04:00
|
|
|
SKIP = 34_array_assignment.test
|
2014-04-07 13:20:45 +04:00
|
|
|
|
2012-06-27 21:04:27 +04:00
|
|
|
# some tests do not pass on all platforms, remove them for now
|
|
|
|
ifeq ($(TARGETOS),Darwin)
|
2014-04-07 13:20:45 +04:00
|
|
|
SKIP += 40_stdio.test
|
2012-06-27 21:04:27 +04:00
|
|
|
endif
|
|
|
|
ifdef CONFIG_WIN32
|
2014-04-07 13:20:45 +04:00
|
|
|
SKIP += 24_math_library.test # don't have round()
|
|
|
|
SKIP += 28_strings.test # don't have r/index() / strings.h
|
2012-06-27 21:04:27 +04:00
|
|
|
endif
|
|
|
|
|
2014-04-07 13:20:45 +04:00
|
|
|
# Some tests might need arguments
|
|
|
|
ARGS =
|
|
|
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
2014-04-12 22:04:10 +04:00
|
|
|
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
|
2014-04-07 13:20:45 +04:00
|
|
|
|
|
|
|
all test: $(filter-out $(SKIP),$(TESTS))
|
|
|
|
|
2012-12-14 20:18:03 +04:00
|
|
|
%.test: %.c %.expect
|
2012-06-18 21:27:32 +04:00
|
|
|
@echo Test: $*...
|
|
|
|
|
2014-04-07 13:20:45 +04:00
|
|
|
@$(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
|
2012-11-07 17:54:43 +04:00
|
|
|
|
|
|
|
clean:
|
2014-04-05 19:35:00 +04:00
|
|
|
rm -vf fred.txt *.output* *.exe
|