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
33 #
44 prefix=/usr/local
55
6−CFLAGS=-O2 -g -Wall -Wno-parentheses -Wno-missing-braces -I.
6+CFLAGS=-O2 -g -Wall
77 LIBS=-ldl
88 CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
99 LIBS_P=
1010
1111 CFLAGS+=-m386 -malign-functions=0
12−DISAS=objdump -D -b binary -m i386
12+DISAS=objdump -d
1313 INSTALL=install
14−VERSION=0.9.2
14+VERSION=0.9.3
1515
1616 all: tcc
1717
@@ -20,28 +20,49 @@ all: tcc · 2 unmodified lines
2020 test: test.ref test.out
2121 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
2222
23−prog.ref: prog.c
24− gcc3 $(CFLAGS) -o $@ $<
23+tcctest.ref: tcctest.c
24+ gcc $(CFLAGS) -I. -o $@ $<
2525
26−test.ref: prog.ref
27− ./prog.ref > $@
26+test.ref: tcctest.ref
27+ ./tcctest.ref > $@
2828
29−test.out: tcc prog.c
30− ./tcc -I. prog.c > $@
29+test.out: tcc tcctest.c
30+ ./tcc -I. tcctest.c > $@
3131
32−run: tcc prog.c
33− ./tcc -I. prog.c
32+run: tcc tcctest.c
33+ ./tcc -I. tcctest.c
3434
35−# iterated test2 (compile tcc then compile prog.c !)
36−test2: tcc tcc.c prog.c test.ref
37− ./tcc -I. tcc.c -I. prog.c > test.out2
35+# iterated test2 (compile tcc then compile tcctest.c !)
36+test2: tcc tcc.c tcctest.c test.ref
37+ ./tcc -I. tcc.c -I. tcctest.c > test.out2
3838 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
3939
40−# iterated test3 (compile tcc then compile tcc then compile prog.c !)
41−test3: tcc tcc.c prog.c test.ref
42− ./tcc -I. tcc.c -I. tcc.c -I. prog.c > test.out3
40+# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
41+test3: tcc tcc.c tcctest.c test.ref
42+ ./tcc -I. tcc.c -I. tcc.c -I. tcctest.c > test.out3
4343 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
4444
45+# memory and bound check auto test
46+BOUNDS_OK = 1 4 8 10
47+BOUNDS_FAIL= 2 5 7 9 11 12
48+
49+btest: 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+
4566 # speed test
4667 speed: tcc ex2 ex3
4768 time ./ex2 1238 2 3 4 10 13 4
@@ -57,7 +78,7 @@ ex3: ex3.c · 9 unmodified lines
5778
5879 # Tiny C Compiler
5980
60−tcc_g: tcc.c i386-gen.c Makefile
81+tcc_g: tcc.c i386-gen.c bcheck.c Makefile
6182 gcc $(CFLAGS) -o $@ $< $(LIBS)
6283
6384 tcc: tcc_g
@@ -66,20 +87,21 @@ tcc: tcc_g · 2 unmodified lines
6687 install: tcc
6788 $(INSTALL) -m755 tcc $(prefix)/bin
6889 mkdir -p $(prefix)/lib/tcc
69− $(INSTALL) -m644 stdarg.h stddef.h float.h tcclib.h $(prefix)/lib/tcc
90+ $(INSTALL) -m644 stdarg.h stddef.h float.h stdbool.h \
91+ tcclib.h $(prefix)/lib/tcc
7092
7193 clean:
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 \
7395 core gmon.out test.out test.ref a.out tcc_p
7496
7597 # profiling version
7698 tcc_p: tcc.c Makefile
7799 gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)
78100
79−# target for development
101+# targets for development
80102
81103 %.bin: %.c tcc
82− ./tcc -o $@ -I. $<
104+ ./tcc -g -o $@ -I. $<
83105 $(DISAS) $@
84106
85107 instr: instr.o
@@ -96,8 +118,8 @@ tar: · 10 unmodified lines
96118 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz \
97119 $(FILE)/Makefile $(FILE)/README $(FILE)/TODO $(FILE)/COPYING \
98120 $(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 \
100122 $(FILE)/stddef.h $(FILE)/stdarg.h $(FILE)/stdbool.h $(FILE)/float.h \
101123 $(FILE)/tcclib.h \
102− $(FILE)/ex*.c $(FILE)/prog.c )
124+ $(FILE)/ex*.c $(FILE)/tcctest.c $(FILE)/boundtest.c )
103125 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