History

added bound test

bellard committed 24 years ago

Commit 2bd31e41 parent 1f15c981 file · +46 −24Browse files

Unified · Split

Makefile+46−24
@@ -3,15 +3,15 @@ · 2 unmodified lines
3#3#
4prefix=/usr/local4prefix=/usr/local
5 5
6CFLAGS=-O2 -g -Wall -Wno-parentheses -Wno-missing-braces -I.6CFLAGS=-O2 -g -Wall
7LIBS=-ldl7LIBS=-ldl
8CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC8CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
9LIBS_P=9LIBS_P=
10 10
11CFLAGS+=-m386 -malign-functions=011CFLAGS+=-m386 -malign-functions=0
12DISAS=objdump -D -b binary -m i38612DISAS=objdump -d
13INSTALL=install13INSTALL=install
14VERSION=0.9.214VERSION=0.9.3
15 15
16all: tcc16all: tcc
17 17
@@ -20,28 +20,49 @@ all: tcc · 2 unmodified lines
20test: test.ref test.out20test: test.ref test.out
21 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi21 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
22 22
23prog.ref: prog.c 23tcctest.ref: tcctest.c
24 gcc3 $(CFLAGS) -o $@ $<24 gcc $(CFLAGS) -I. -o $@ $<
25 25
26test.ref: prog.ref26test.ref: tcctest.ref
27 ./prog.ref > $@27 ./tcctest.ref > $@
28 28
29test.out: tcc prog.c29test.out: tcc tcctest.c
30 ./tcc -I. prog.c > $@30 ./tcc -I. tcctest.c > $@
31 31
32run: tcc prog.c32run: tcc tcctest.c
33 ./tcc -I. prog.c33 ./tcc -I. tcctest.c
34 34
35# iterated test2 (compile tcc then compile prog.c !)35# iterated test2 (compile tcc then compile tcctest.c !)
36test2: tcc tcc.c prog.c test.ref36test2: tcc tcc.c tcctest.c test.ref
37 ./tcc -I. tcc.c -I. prog.c > test.out237 ./tcc -I. tcc.c -I. tcctest.c > test.out2
38 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi38 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
39 39
40# iterated test3 (compile tcc then compile tcc then compile prog.c !)40# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
41test3: tcc tcc.c prog.c test.ref41test3: tcc tcc.c tcctest.c test.ref
42 ./tcc -I. tcc.c -I. tcc.c -I. prog.c > test.out342 ./tcc -I. tcc.c -I. tcc.c -I. tcctest.c > test.out3
43 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi43 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
44 44
45# memory and bound check auto test
46BOUNDS_OK = 1 4 8 10
47BOUNDS_FAIL= 2 5 7 9 11 12
48
49btest: boundtest.c tcc
50 @for i in $(BOUNDS_OK); do \
51 if ./tcc -b boundtest.c $$i ; then \
52 /bin/true ; \
53 else\
54 echo Failed positive test $$i ; exit 1 ; \
55 fi ;\
56 done ;\
57 for i in $(BOUNDS_FAIL); do \
58 if ./tcc -b boundtest.c $$i ; then \
59 echo Failed negative test $$i ; exit 1 ;\
60 else\
61 /bin/true ; \
62 fi\
63 done ;\
64 echo Bound test OK
65
45# speed test66# speed test
46speed: tcc ex2 ex367speed: tcc ex2 ex3
47 time ./ex2 1238 2 3 4 10 13 468 time ./ex2 1238 2 3 4 10 13 4
@@ -57,7 +78,7 @@ ex3: ex3.c · 9 unmodified lines
57 78
58# Tiny C Compiler79# Tiny C Compiler
59 80
60tcc_g: tcc.c i386-gen.c Makefile81tcc_g: tcc.c i386-gen.c bcheck.c Makefile
61 gcc $(CFLAGS) -o $@ $< $(LIBS)82 gcc $(CFLAGS) -o $@ $< $(LIBS)
62 83
63tcc: tcc_g84tcc: tcc_g
@@ -66,20 +87,21 @@ tcc: tcc_g · 2 unmodified lines
66install: tcc 87install: tcc
67 $(INSTALL) -m755 tcc $(prefix)/bin88 $(INSTALL) -m755 tcc $(prefix)/bin
68 mkdir -p $(prefix)/lib/tcc89 mkdir -p $(prefix)/lib/tcc
69 $(INSTALL) -m644 stdarg.h stddef.h float.h tcclib.h $(prefix)/lib/tcc90 $(INSTALL) -m644 stdarg.h stddef.h float.h stdbool.h \
91 tcclib.h $(prefix)/lib/tcc
70 92
71clean:93clean:
72 rm -f *~ *.o tcc tcc1 tcct tcc_g prog.ref *.bin *.i ex2 \94 rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
73 core gmon.out test.out test.ref a.out tcc_p95 core gmon.out test.out test.ref a.out tcc_p
74 96
75# profiling version97# profiling version
76tcc_p: tcc.c Makefile98tcc_p: tcc.c Makefile
77 gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)99 gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)
78 100
79# target for development101# targets for development
80 102
81%.bin: %.c tcc103%.bin: %.c tcc
82 ./tcc -o $@ -I. $<104 ./tcc -g -o $@ -I. $<
83 $(DISAS) $@105 $(DISAS) $@
84 106
85instr: instr.o107instr: instr.o
@@ -96,8 +118,8 @@ tar: · 10 unmodified lines
96 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz \118 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz \
97 $(FILE)/Makefile $(FILE)/README $(FILE)/TODO $(FILE)/COPYING \119 $(FILE)/Makefile $(FILE)/README $(FILE)/TODO $(FILE)/COPYING \
98 $(FILE)/Changelog $(FILE)/tcc-doc.html \120 $(FILE)/Changelog $(FILE)/tcc-doc.html \
99 $(FILE)/tcc.c $(FILE)/i386-gen.c \121 $(FILE)/tcc.c $(FILE)/i386-gen.c $(FILE)/bcheck.c \
100 $(FILE)/stddef.h $(FILE)/stdarg.h $(FILE)/stdbool.h $(FILE)/float.h \122 $(FILE)/stddef.h $(FILE)/stdarg.h $(FILE)/stdbool.h $(FILE)/float.h \
101 $(FILE)/tcclib.h \123 $(FILE)/tcclib.h \
102 $(FILE)/ex*.c $(FILE)/prog.c )124 $(FILE)/ex*.c $(FILE)/tcctest.c $(FILE)/boundtest.c )
103 rm -rf /tmp/$(FILE)125 rm -rf /tmp/$(FILE)

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