History

tests: add .so/.dll creation test

Also remove bitfield test from tcctest.c because gcc versions don't agree among each other.

grischka committed 9 years ago

Commit 2b7ee001 parent ca92bfc3 files · +23 −9Browse files

Unified · Split

3 files
  1. configure +3 −0
  2. tests/Makefile +20 −0
  3. tests/tcctest.c +0 −9
configure+3−0
@@ -38,6 +38,7 @@ bigendian="no" · 37 unmodified lines
38mingw32="no"38mingw32="no"
39LIBSUF=".a"39LIBSUF=".a"
40EXESUF=""40EXESUF=""
41DLLSUF=".so"
41tcc_sysincludepaths=""42tcc_sysincludepaths=""
42tcc_libpaths=""43tcc_libpaths=""
43tcc_crtprefix=""44tcc_crtprefix=""
@@ -222,6 +223,7 @@ if test "$mingw32" = "yes" ; then · 178 unmodified lines
222 infodir="${sharedir}/info"223 infodir="${sharedir}/info"
223 LIBSUF=".lib"224 LIBSUF=".lib"
224 EXESUF=".exe"225 EXESUF=".exe"
226 DLLSUF=".dll"
225else227else
226 if test -z "$prefix" ; then228 if test -z "$prefix" ; then
227 prefix="/usr/local"229 prefix="/usr/local"
@@ -416,6 +418,7 @@ CFLAGS=$CFLAGS · 188 unmodified lines
416LDFLAGS=$LDFLAGS418LDFLAGS=$LDFLAGS
417LIBSUF=$LIBSUF419LIBSUF=$LIBSUF
418EXESUF=$EXESUF420EXESUF=$EXESUF
421DLLSUF=$DLLSUF
419EOF422EOF
420 423
421print_inc() {424print_inc() {
tests/Makefile+20−0
@@ -13,6 +13,7 @@ TESTS = \ · 12 unmodified lines
13 hello-run \13 hello-run \
14 libtest \14 libtest \
15 test3 \15 test3 \
16 dlltest \
16 abitest \17 abitest \
17 vla_test-run \18 vla_test-run \
18 tests2-dir \19 tests2-dir \
@@ -40,6 +41,9 @@ endif · 21 unmodified lines
40ifeq ($(CONFIG_arm_eabi),yes)41ifeq ($(CONFIG_arm_eabi),yes)
41 TESTS := $(filter-out test3,$(TESTS))42 TESTS := $(filter-out test3,$(TESTS))
42endif43endif
44ifeq (,$(filter i386 x86-64,$(ARCH)))
45 TESTS := $(filter-out dlltest,$(TESTS))
46endif
43 47
44# run local version of tcc with local libraries and includes48# run local version of tcc with local libraries and includes
45TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)49TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
@@ -126,6 +130,22 @@ test4: tcctest.c test.ref · 80 unmodified lines
126 ./tcctest2 > test2.out130 ./tcctest2 > test2.out
127 @if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi131 @if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi
128 132
133# use tcc to create libtcc.so/.dll and the tcc(.exe) frontend and run them
134dlltest:
135 @echo ------------ $@ ------------
136 $(TCC) -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL ../libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
137 $(TCC) $(NATIVE_DEFINES) ../tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
138 ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run ../examples/ex1.c
139ifndef CONFIG_WIN32
140 @echo ------------ $@ with PIC ------------
141 $(CC) $(CFLAGS) -fPIC -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c ../libtcc.c
142 $(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF)
143 $(TCC) $(NATIVE_DEFINES) ../tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
144 ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run ../examples/ex1.c
145endif
146 @rm tcc2$(EXESUF) libtcc2$(DLLSUF)
147
148
129# memory and bound check auto test149# memory and bound check auto test
130BOUNDS_OK = 1 4 8 10 14150BOUNDS_OK = 1 4 8 10 14
131BOUNDS_FAIL= 2 5 7 9 11 12 13 15151BOUNDS_FAIL= 2 5 7 9 11 12 13 15
tests/tcctest.c+0−9
@@ -1634,15 +1634,6 @@ void bitfield_test(void) · 1633 unmodified lines
1634 st2.f3 = a;1634 st2.f3 = a;
1635 st2.f2++;1635 st2.f2++;
1636 printf("%lld %lld %lld\n", st2.f1, st2.f2, st2.f3);1636 printf("%lld %lld %lld\n", st2.f1, st2.f2, st2.f3);
1637 struct sbf3 {
1638 int f1 : 7;
1639 int f2 : 1;
1640 char f3;
1641 int f4 : 8;
1642 int f5 : 1;
1643 int f6 : 16;
1644 } st3;
1645 printf("sizeof(st3) = %d\n", sizeof(st3));
1646}1637}
1647 1638
1648#ifdef __x86_64__1639#ifdef __x86_64__