History

tests: cleanup

tests: - add "hello" to test first basic compilation to file/memory - add "more" test (tests2 suite) - remove some tests tests2: - move into tests dir - Convert some files from DOS to unix LF - remove 2>&1 redirection win32: - tccrun.c: modify exception filter to exit correctly (needed for btest) - tcctest.c: exclude weak_test() (feature does not exist on win32)

grischka committed 13 years ago

Commit d5f4df01 parent 60cf64614 files · +273 −300Browse files

Unified · Split

14 files
  1. Makefile +0 −2
  2. configure +1 −1
  3. tccrun.c +1 −2
  4. tests/Makefile +47 −69
  5. tests/tcctest.c +4 −1
  6. tests/tests2/16_nesting.expect +18 −18
  7. tests/tests2/17_enum.expect +3 −3
  8. tests/tests2/18_include.expect +3 −3
  9. tests/tests2/18_include.h +1 −1
  10. tests/tests2/44_scoped_declarations.c +17 −17
  11. tests/tests2/45_empty_for.c +18 −18
  12. tests/tests2/50_logical_second_arg.c +29 −29
  13. tests/tests2/54_goto.c +56 −56
  14. tests/tests2/Makefile +75 −80
Makefile+0−2
@@ -350,12 +350,10 @@ tcc-doc.info: tcc-doc.texi · 349 unmodified lines
350export LIBTCC1350export LIBTCC1
351 351
352%est:352%est:
353 $(MAKE) -C tests2 $@
354 $(MAKE) -C tests $@353 $(MAKE) -C tests $@
355 354
356clean:355clean:
357 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)356 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)
358 $(MAKE) -C tests2 $@
359 $(MAKE) -C tests $@357 $(MAKE) -C tests $@
360ifneq ($(LIBTCC1),)358ifneq ($(LIBTCC1),)
361 $(MAKE) -C lib $@359 $(MAKE) -C lib $@
configure+1−1
@@ -500,7 +500,7 @@ echo "SRC_PATH=$source_path" >>config.mak · 499 unmodified lines
500 500
501# build tree in object directory if source path is different from current one501# build tree in object directory if source path is different from current one
502if test "$source_path_used" = "yes" ; then502if test "$source_path_used" = "yes" ; then
503 FILES="Makefile lib/Makefile tests/Makefile tests2/Makefile"503 FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile"
504 for f in $FILES ; do504 for f in $FILES ; do
505 dir=`fn_dirname "$f"`505 dir=`fn_dirname "$f"`
506 test -d "$dir" || mkdir -p "$dir"506 test -d "$dir" || mkdir -p "$dir"
tccrun.c+1−2
@@ -615,8 +615,7 @@ static long __stdcall cpu_exception_handler(EXCEPTION_POINTERS *ex_info) · 614 unmodified lines
615 rt_error(uc, "exception caught");615 rt_error(uc, "exception caught");
616 break;616 break;
617 }617 }
618 exit(-1);618 return EXCEPTION_EXECUTE_HANDLER;
619 return EXCEPTION_CONTINUE_SEARCH;
620}619}
621 620
622/* Generate a stack backtrace when a CPU exception occurs. */621/* Generate a stack backtrace when a CPU exception occurs. */
tests/Makefile+47−69
@@ -7,73 +7,61 @@ include $(TOP)/Makefile · 6 unmodified lines
7VPATH = $(top_srcdir)/tests7VPATH = $(top_srcdir)/tests
8 8
9# what tests to run9# what tests to run
10TESTS = libtest \10TESTS = \
11 test1 \11 hello \
12 test2 \12 libtest \
13 test3 \13 test3 \
14 speedtest \14 moretests
15 btest \15
16 test1b\16# test4 -- problem with -static
17 test2b\17# asmtest -- minor differences with gcc
18 test3b\18# btest -- works on i386 (including win32)
19 weaktest19# test3 -- win32 does not know how to printf long doubles
20
21 # test4 # this test does not seem to work on any platform
22 # asmtest # this test does not seem to work on any platform
23 20
24# bounds-checking is supported only on i38621# bounds-checking is supported only on i386
25ifneq ($(ARCH),i386)22ifneq ($(ARCH),i386)
26 TESTS := $(filter-out btest,$(TESTS))23 TESTS := $(filter-out btest,$(TESTS))
27 TESTS := $(filter-out test1b,$(TESTS))
28 TESTS := $(filter-out test2b,$(TESTS))
29 TESTS := $(filter-out test3b,$(TESTS))
30endif24endif
31 25ifdef CONFIG_WIN32
32# these should work too26 TESTS := $(filter-out test3,$(TESTS))
33# TESTS += test1 test2 speedtest btest weaktest
34
35# some tests do not pass on all platforms, remove them for now
36ifeq ($(TARGETOS),Linux)
37 TESTS := $(filter-out weaktest,$(TESTS))
38endif27endif
39ifeq ($(TARGETOS),Darwin)28ifeq ($(TARGETOS),Darwin)
40 TESTS := $(filter-out test1,$(TESTS))29 TESTS := $(filter-out test3 btest,$(TESTS))
41 TESTS := $(filter-out test2,$(TESTS))
42 TESTS := $(filter-out test3,$(TESTS))
43 TESTS := $(filter-out btest,$(TESTS))
44 TESTS := $(filter-out weaktest,$(TESTS))
45endif30endif
46 31
47ifdef DISABLE_STATIC32ifdef DISABLE_STATIC
48export LD_LIBRARY_PATH:=$(CURDIR)/..33 export LD_LIBRARY_PATH:=$(CURDIR)/..
49endif34endif
50 35
51ifeq ($(TARGETOS),Darwin)36ifeq ($(TARGETOS),Darwin)
52CFLAGS+=-Wl,-flat_namespace,-undefined,warning37 CFLAGS+=-Wl,-flat_namespace,-undefined,warning
53export MACOSX_DEPLOYMENT_TARGET:=10.238 export MACOSX_DEPLOYMENT_TARGET:=10.2
54NATIVE_DEFINES+=-D_ANSI_SOURCE39 NATIVE_DEFINES+=-D_ANSI_SOURCE
55endif40endif
56 41
57# run local version of tcc with local libraries and includes42# run local version of tcc with local libraries and includes
58TCC = ../tcc -B.. $(NATIVE_DEFINES)43TCCFLAGS = -B$(TOP)
59ifdef CONFIG_WIN3244ifdef CONFIG_WIN32
60 TCC := $(TCC) -I $(top_srcdir)/win32/include -L$(top_build)45 TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
61endif46endif
62RUN_TCC = $(NATIVE_DEFINES) -run -DONE_SOURCE ../tcc.c -B..
63DISAS=objdump -d
64 47
65all test : $(TESTS)48TCC = $(TOP)/tcc $(TCCFLAGS)
49RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS)
66 50
67# make sure that tcc exists51DISAS = objdump -d
68test1 test2 test3 test4 btest speedtest asmtest weaktest : ../tcc
69../%:
70 $(MAKE) -C .. $*
71 52
72# libtcc test53# libtcc test
73ifdef LIBTCC154ifdef LIBTCC1
74LIBTCC1:=$(TOP)/$(LIBTCC1)55 LIBTCC1:=$(TOP)/$(LIBTCC1)
75endif56endif
76 57
58all test : $(TESTS)
59
60hello: ../examples/ex1.c
61 @echo ------------ $@ ------------
62 $(TCC) $< -o $@$(EXESUF) && ./$@$(EXESUF)
63 $(TCC) -run $<
64
77libtest: libtcc_test$(EXESUF) $(LIBTCC1)65libtest: libtcc_test$(EXESUF) $(LIBTCC1)
78 @echo ------------ $@ ------------66 @echo ------------ $@ ------------
79 ./libtcc_test$(EXESUF) lib_path=..67 ./libtcc_test$(EXESUF) lib_path=..
@@ -81,6 +69,10 @@ libtest: libtcc_test$(EXESUF) $(LIBTCC1) · 1 unmodified line
81libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)69libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
82 $(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)70 $(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)
83 71
72moretests:
73 @echo ------------ $@ ------------
74 $(MAKE) -C tests2
75
84# test.ref - generate using gcc76# test.ref - generate using gcc
85# copy only tcclib.h so GCC's stddef and stdarg will be used77# copy only tcclib.h so GCC's stddef and stdarg will be used
86test.ref: tcctest.c78test.ref: tcctest.c
@@ -94,59 +86,44 @@ test1: test.ref · 7 unmodified lines
94 $(TCC) -run tcctest.c > test.out186 $(TCC) -run tcctest.c > test.out1
95 @if diff -u test.ref test.out1 ; then echo "Auto Test OK"; fi87 @if diff -u test.ref test.out1 ; then echo "Auto Test OK"; fi
96 88
97test1b: test.ref
98 @echo ------------ $@ ------------
99 $(TCC) -b -run tcctest.c > test.out1b
100 @if diff -u test.ref test.out1b ; then echo "Auto Test OK"; fi
101
102# iterated test2 (compile tcc then compile tcctest.c !)89# iterated test2 (compile tcc then compile tcctest.c !)
103test2: test.ref90test2: test.ref
104 @echo ------------ $@ ------------91 @echo ------------ $@ ------------
105 $(TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out292 $(TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out2
106 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi93 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
107 94
108test2b: test.ref ../bcheck.o
109 @echo ------------ $@ ------------
110 $(TCC) -b $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out2b
111 @if diff -u test.ref test.out2b ; then echo "Auto Test2b OK"; fi
112
113# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)95# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
114test3: test.ref96test3: test.ref
115 @echo ------------ $@ ------------97 @echo ------------ $@ ------------
116 $(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out398 $(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out3
117 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi99 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
118 100
119test3b: test.ref
120 @echo ------------ $@ ------------
121 $(TCC) -b $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out3b
122 @if diff -u test.ref test.out3b ; then echo "Auto Test3 OK"; fi
123
124# binary output test101# binary output test
125test4: test.ref102test4: test.ref
126 @echo ------------ $@ ------------103 @echo ------------ $@ ------------
127# dynamic output
128 $(TCC) -o tcctest1 tcctest.c
129 ./tcctest1 > test1.out
130 @if diff -u test.ref test1.out ; then echo "Dynamic Auto Test OK"; fi
131# object + link output104# object + link output
132 $(TCC) -c -o tcctest3.o tcctest.c105 $(TCC) -c -o tcctest3.o tcctest.c
133 $(TCC) -o tcctest3 tcctest3.o106 $(TCC) -o tcctest3 tcctest3.o
134 ./tcctest3 > test3.out107 ./tcctest3 > test3.out
135 @if diff -u test.ref test3.out ; then echo "Object Auto Test OK"; fi108 @if diff -u test.ref test3.out ; then echo "Object Auto Test OK"; fi
136# static output109# dynamic output
137 $(TCC) -static -o tcctest2 tcctest.c110 $(TCC) -o tcctest1 tcctest.c
138 ./tcctest2 > test2.out111 ./tcctest1 > test1.out
139 @if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi112 @if diff -u test.ref test1.out ; then echo "Dynamic Auto Test OK"; fi
140# dynamic output + bound check113# dynamic output + bound check
141 $(TCC) -b -o tcctest4 tcctest.c114 $(TCC) -b -o tcctest4 tcctest.c
142 ./tcctest4 > test4.out115 ./tcctest4 > test4.out
143 @if diff -u test.ref test4.out ; then echo "BCheck Auto Test OK"; fi116 @if diff -u test.ref test4.out ; then echo "BCheck Auto Test OK"; fi
117# static output
118 $(TCC) -static -o tcctest2 tcctest.c
119 ./tcctest2 > test2.out
120 @if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi
144 121
145# memory and bound check auto test122# memory and bound check auto test
146BOUNDS_OK = 1 4 8 10 14123BOUNDS_OK = 1 4 8 10 14
147BOUNDS_FAIL= 2 5 7 9 11 12 13 15124BOUNDS_FAIL= 2 5 7 9 11 12 13 15
148 125
149btest: boundtest.c ../bcheck.o126btest: boundtest.c
150 @echo ------------ $@ ------------127 @echo ------------ $@ ------------
151 @for i in $(BOUNDS_OK); do \128 @for i in $(BOUNDS_OK); do \
152 echo ; echo --- boundtest $$i ---; \129 echo ; echo --- boundtest $$i ---; \
@@ -212,5 +189,6 @@ cache: tcc_g · 59 unmodified lines
212 189
213# clean190# clean
214clean:191clean:
215 rm -vf *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.gcc \192 $(MAKE) -C tests2 $@
216 tcctest[1234] ex? libtcc_test$(EXESUF) tcc_g tcclib.h193 rm -vf *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.gcc *.exe \
194 hello libtcc_test tcctest[1234] ex? tcc_g tcclib.h
tests/tcctest.c+4−1
@@ -594,7 +594,9 @@ int main(int argc, char **argv) · 593 unmodified lines
594 local_label_test();594 local_label_test();
595 asm_test();595 asm_test();
596 builtin_test();596 builtin_test();
597#ifndef _WIN32
597 weak_test();598 weak_test();
599#endif
598 global_data_test();600 global_data_test();
599 cmp_comparison_test();601 cmp_comparison_test();
600 math_cmp_test();602 math_cmp_test();
@@ -2464,7 +2466,7 @@ void builtin_test(void) · 1863 unmodified lines
2464 printf("res = %d\n", __builtin_constant_p(constant_p_var));2466 printf("res = %d\n", __builtin_constant_p(constant_p_var));
2465}2467}
2466 2468
2467 2469#ifndef _WIN32
2468extern int __attribute__((weak)) weak_f1(void);2470extern int __attribute__((weak)) weak_f1(void);
2469extern int __attribute__((weak)) weak_f2(void);2471extern int __attribute__((weak)) weak_f2(void);
2470extern int weak_f3(void);2472extern int weak_f3(void);
@@ -2520,6 +2522,7 @@ int __attribute__((weak)) weak_f2() { return 222; } · 49 unmodified lines
2520int __attribute__((weak)) weak_f3() { return 333; }2522int __attribute__((weak)) weak_f3() { return 333; }
2521int __attribute__((weak)) weak_v2 = 222;2523int __attribute__((weak)) weak_v2 = 222;
2522int __attribute__((weak)) weak_v3 = 333;2524int __attribute__((weak)) weak_v3 = 333;
2525#endif
2523 2526
2524void const_func(const int a)2527void const_func(const int a)
2525{2528{
tests/tests2/16_nesting.expect+18−18
@@ -1,18 +1,18 @@
10 0 010 0 0
20 0 120 0 1
30 0 230 0 2
40 1 040 1 0
50 1 150 1 1
60 1 260 1 2
70 2 070 2 0
80 2 180 2 1
90 2 290 2 2
101 0 0101 0 0
111 0 1111 0 1
121 0 2121 0 2
131 1 0131 1 0
141 1 1141 1 1
151 1 2151 1 2
161 2 0161 2 0
171 2 1171 2 1
181 2 2181 2 2
tests/tests2/17_enum.expect+3−3
@@ -1,3 +1,3 @@
10 1 2 3 54 73 74 7510 1 2 3 54 73 74 75
212212
354354
tests/tests2/18_include.expect+3−3
@@ -1,3 +1,3 @@
1including1including
2included2included
3done3done
tests/tests2/18_include.h+1−1
@@ -1 +1 @@
1printf("included\n");1printf("included\n");
tests/tests2/44_scoped_declarations.c+17−17
@@ -1,17 +1,17 @@
1#include <stdio.h>1#include <stdio.h>
2 2
3int main()3int main()
4{4{
5 int a;5 int a;
6 6
7 for (a = 0; a < 2; a++)7 for (a = 0; a < 2; a++)
8 {8 {
9 int b = a;9 int b = a;
10 }10 }
11 11
12 printf("it's all good\n");12 printf("it's all good\n");
13 13
14 return 0;14 return 0;
15}15}
16 16
17/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/17/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
tests/tests2/45_empty_for.c+18−18
@@ -1,18 +1,18 @@
1#include <stdio.h>1#include <stdio.h>
2 2
3int main()3int main()
4{4{
5 int Count = 0;5 int Count = 0;
6 6
7 for (;;)7 for (;;)
8 {8 {
9 Count++;9 Count++;
10 printf("%d\n", Count);10 printf("%d\n", Count);
11 if (Count >= 10)11 if (Count >= 10)
12 break;12 break;
13 }13 }
14 14
15 return 0;15 return 0;
16}16}
17 17
18/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/18/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
tests/tests2/50_logical_second_arg.c+29−29
@@ -1,29 +1,29 @@
1#include <stdio.h>1#include <stdio.h>
2 2
3int fred()3int fred()
4{4{
5 printf("fred\n");5 printf("fred\n");
6 return 0;6 return 0;
7}7}
8 8
9int joe()9int joe()
10{10{
11 printf("joe\n");11 printf("joe\n");
12 return 1;12 return 1;
13}13}
14 14
15int main()15int main()
16{16{
17 printf("%d\n", fred() && joe());17 printf("%d\n", fred() && joe());
18 printf("%d\n", fred() || joe());18 printf("%d\n", fred() || joe());
19 printf("%d\n", joe() && fred());19 printf("%d\n", joe() && fred());
20 printf("%d\n", joe() || fred());20 printf("%d\n", joe() || fred());
21 printf("%d\n", fred() && (1 + joe()));21 printf("%d\n", fred() && (1 + joe()));
22 printf("%d\n", fred() || (0 + joe()));22 printf("%d\n", fred() || (0 + joe()));
23 printf("%d\n", joe() && (0 + fred()));23 printf("%d\n", joe() && (0 + fred()));
24 printf("%d\n", joe() || (1 + fred()));24 printf("%d\n", joe() || (1 + fred()));
25 25
26 return 0;26 return 0;
27}27}
28 28
29/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/29/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
tests/tests2/54_goto.c+56−56
@@ -1,56 +1,56 @@
1#include <stdio.h>1#include <stdio.h>
2 2
3void fred()3void fred()
4{4{
5 printf("In fred()\n");5 printf("In fred()\n");
6 goto done;6 goto done;
7 printf("In middle\n");7 printf("In middle\n");
8done:8done:
9 printf("At end\n");9 printf("At end\n");
10}10}
11 11
12void joe()12void joe()
13{13{
14 int b = 5678;14 int b = 5678;
15 15
16 printf("In joe()\n");16 printf("In joe()\n");
17 17
18 {18 {
19 int c = 1234;19 int c = 1234;
20 printf("c = %d\n", c);20 printf("c = %d\n", c);
21 goto outer;21 goto outer;
22 printf("uh-oh\n");22 printf("uh-oh\n");
23 }23 }
24 24
25outer: 25outer:
26 26
27 printf("done\n");27 printf("done\n");
28}28}
29 29
30void henry()30void henry()
31{31{
32 int a;32 int a;
33 33
34 printf("In henry()\n");34 printf("In henry()\n");
35 goto inner;35 goto inner;
36 36
37 {37 {
38 int b;38 int b;
39inner: 39inner:
40 b = 1234;40 b = 1234;
41 printf("b = %d\n", b);41 printf("b = %d\n", b);
42 }42 }
43 43
44 printf("done\n");44 printf("done\n");
45}45}
46 46
47int main()47int main()
48{48{
49 fred();49 fred();
50 joe();50 joe();
51 henry();51 henry();
52 52
53 return 0;53 return 0;
54}54}
55 55
56/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/56/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
tests/tests2/Makefile+75−80
@@ -1,103 +1,98 @@
1TOP = ..1TOP = ../..
2include $(TOP)/Makefile2include $(TOP)/Makefile
3VPATH = $(top_srcdir)/tests23VPATH = $(top_srcdir)/tests/tests2
4 4
5ifeq ($(TARGETOS),Darwin)5TCCFLAGS = -B$(TOP)
6 CFLAGS+=-Wl,-flat_namespace,-undefined,warning6ifdef CONFIG_WIN32
7 TCCFLAGS=-D_ANSI_SOURCE7 TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
8 export MACOSX_DEPLOYMENT_TARGET:=10.2
9endif8endif
10 9
11ifdef CONFIG_WIN3210ifeq ($(TARGETOS),Darwin)
12 TCCFLAGS=-I $(TOP)/win32/include -L$(TOP)11 CFLAGS += -Wl,-flat_namespace,-undefined,warning
12 TCCFLAGS += -D_ANSI_SOURCE
13 export MACOSX_DEPLOYMENT_TARGET:=10.2
13endif14endif
14 15
15TESTS= 00_assignment.test \16TCC_RUN = $(TOP)/tcc $(TCCFLAGS) -run
16 01_comment.test \
17 02_printf.test \
18 03_struct.test \
19 04_for.test \
20 05_array.test \
21 06_case.test \
22 07_function.test \
23 08_while.test \
24 09_do_while.test \
25 10_pointer.test \
26 11_precedence.test \
27 12_hashdefine.test \
28 13_integer_literals.test \
29 14_if.test \
30 15_recursion.test \
31 16_nesting.test \
32 17_enum.test \
33 18_include.test \
34 19_pointer_arithmetic.test \
35 20_pointer_comparison.test \
36 21_char_array.test \
37 22_floating_point.test \
38 23_type_coercion.test \
39 24_math_library.test \
40 25_quicksort.test \
41 26_character_constants.test \
42 27_sizeof.test \
43 28_strings.test \
44 29_array_address.test \
45 31_args.test \
46 32_led.test \
47 33_ternary_op.test \
48 35_sizeof.test \
49 36_array_initialisers.test \
50 37_sprintf.test \
51 38_multiple_array_index.test \
52 39_typedef.test \
53 40_stdio.test \
54 41_hashif.test \
55 42_function_pointer.test \
56 43_void_param.test \
57 44_scoped_declarations.test \
58 45_empty_for.test \
59 47_switch_return.test \
60 48_nested_break.test \
61 49_bracket_evaluation.test \
62 50_logical_second_arg.test \
63 51_static.test \
64 52_unnamed_enum.test \
65 54_goto.test \
66 55_lshift_type.test
67 17
68 # 30_hanoi.test \ # seg fault in the code, gcc as well18TESTS = \
69 # 34_array_assignment.test \ # array assignment is not in C standard19 00_assignment.test \
70 # 46_grep.test \ # does not compile even with gcc20 01_comment.test \
21 02_printf.test \
22 03_struct.test \
23 04_for.test \
24 05_array.test \
25 06_case.test \
26 07_function.test \
27 08_while.test \
28 09_do_while.test \
29 10_pointer.test \
30 11_precedence.test \
31 12_hashdefine.test \
32 13_integer_literals.test \
33 14_if.test \
34 15_recursion.test \
35 16_nesting.test \
36 17_enum.test \
37 18_include.test \
38 19_pointer_arithmetic.test \
39 20_pointer_comparison.test \
40 21_char_array.test \
41 22_floating_point.test \
42 23_type_coercion.test \
43 24_math_library.test \
44 25_quicksort.test \
45 26_character_constants.test \
46 27_sizeof.test \
47 28_strings.test \
48 29_array_address.test \
49 31_args.test \
50 32_led.test \
51 33_ternary_op.test \
52 35_sizeof.test \
53 36_array_initialisers.test \
54 37_sprintf.test \
55 38_multiple_array_index.test \
56 39_typedef.test \
57 40_stdio.test \
58 41_hashif.test \
59 42_function_pointer.test \
60 43_void_param.test \
61 44_scoped_declarations.test \
62 45_empty_for.test \
63 47_switch_return.test \
64 48_nested_break.test \
65 49_bracket_evaluation.test \
66 50_logical_second_arg.test \
67 51_static.test \
68 52_unnamed_enum.test \
69 54_goto.test \
70 55_lshift_type.test
71
72# 30_hanoi.test -- seg fault in the code, gcc as well
73# 34_array_assignment.test -- array assignment is not in C standard
74# 46_grep.test -- does not compile even with gcc
71 75
72# some tests do not pass on all platforms, remove them for now76# some tests do not pass on all platforms, remove them for now
73ifeq ($(TARGETOS),Darwin)77ifeq ($(TARGETOS),Darwin)
74 TESTS := $(filter-out 40_stdio.test,$(TESTS))78 TESTS := $(filter-out 40_stdio.test,$(TESTS))
75endif79endif
76ifdef CONFIG_WIN3280ifdef CONFIG_WIN32
77 TESTS := $(filter-out 24_math_library.test,$(TESTS))81 TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS))
78 TESTS := $(filter-out 28_strings.test,$(TESTS))
79endif82endif
80 83
81%.test: %.c %.expect84%.test: %.c %.expect
82 @echo Test: $*...85 @echo Test: $*...
83 @if [ "x`echo $* | grep args`" != "x" ]; \86 @if [ "x`echo $* | grep args`" != "x" ]; \
84 then \87 then $(TCC_RUN) $< - arg1 arg2 arg3 arg4 >$*.output; \
85 ../tcc -B.. $(TCCFLAGS) -run $< - arg1 arg2 arg3 arg4 2>&1 >$*.output; \88 else $(TCC_RUN) $< >$*.output; \
86 else \
87 ../tcc -B.. $(TCCFLAGS) -run $< 2>&1 >$*.output; \
88 fi89 fi
89 @if diff -bu $(<:.c=.expect) $*.output ; \90 @if diff -bu $(<:.c=.expect) $*.output ; \
90 then \91 then rm -f $*.output; \
91 rm -f $*.output \92 else exit 1; \
92 else \
93 echo "ERROR: test $*"; \
94 fi93 fi
95 94
96all: test95all test: $(TESTS)
97
98test: $(TESTS)
99
100# vim: set expandtab ts=4 sw=4 sts=4 tw=80 :
101 96
102clean:97clean:
103 rm -vf fred.txt98 rm -vf fred.txt *.output

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t