mirror of
https://github.com/mirror/tinycc.git
synced 2025-04-01 12:30:08 +08:00
tests: add .so/.dll creation test
Also remove bitfield test from tcctest.c because gcc versions don't agree among each other.
This commit is contained in:
parent
ca92bfc3c6
commit
2b7ee000cd
3
configure
vendored
3
configure
vendored
@ -38,6 +38,7 @@ bigendian="no"
|
|||||||
mingw32="no"
|
mingw32="no"
|
||||||
LIBSUF=".a"
|
LIBSUF=".a"
|
||||||
EXESUF=""
|
EXESUF=""
|
||||||
|
DLLSUF=".so"
|
||||||
tcc_sysincludepaths=""
|
tcc_sysincludepaths=""
|
||||||
tcc_libpaths=""
|
tcc_libpaths=""
|
||||||
tcc_crtprefix=""
|
tcc_crtprefix=""
|
||||||
@ -222,6 +223,7 @@ if test "$mingw32" = "yes" ; then
|
|||||||
infodir="${sharedir}/info"
|
infodir="${sharedir}/info"
|
||||||
LIBSUF=".lib"
|
LIBSUF=".lib"
|
||||||
EXESUF=".exe"
|
EXESUF=".exe"
|
||||||
|
DLLSUF=".dll"
|
||||||
else
|
else
|
||||||
if test -z "$prefix" ; then
|
if test -z "$prefix" ; then
|
||||||
prefix="/usr/local"
|
prefix="/usr/local"
|
||||||
@ -416,6 +418,7 @@ CFLAGS=$CFLAGS
|
|||||||
LDFLAGS=$LDFLAGS
|
LDFLAGS=$LDFLAGS
|
||||||
LIBSUF=$LIBSUF
|
LIBSUF=$LIBSUF
|
||||||
EXESUF=$EXESUF
|
EXESUF=$EXESUF
|
||||||
|
DLLSUF=$DLLSUF
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
print_inc() {
|
print_inc() {
|
||||||
|
@ -13,6 +13,7 @@ TESTS = \
|
|||||||
hello-run \
|
hello-run \
|
||||||
libtest \
|
libtest \
|
||||||
test3 \
|
test3 \
|
||||||
|
dlltest \
|
||||||
abitest \
|
abitest \
|
||||||
vla_test-run \
|
vla_test-run \
|
||||||
tests2-dir \
|
tests2-dir \
|
||||||
@ -40,6 +41,9 @@ endif
|
|||||||
ifeq ($(CONFIG_arm_eabi),yes)
|
ifeq ($(CONFIG_arm_eabi),yes)
|
||||||
TESTS := $(filter-out test3,$(TESTS))
|
TESTS := $(filter-out test3,$(TESTS))
|
||||||
endif
|
endif
|
||||||
|
ifeq (,$(filter i386 x86-64,$(ARCH)))
|
||||||
|
TESTS := $(filter-out dlltest,$(TESTS))
|
||||||
|
endif
|
||||||
|
|
||||||
# run local version of tcc with local libraries and includes
|
# run local version of tcc with local libraries and includes
|
||||||
TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
||||||
@ -126,6 +130,22 @@ test4: tcctest.c test.ref
|
|||||||
./tcctest2 > test2.out
|
./tcctest2 > test2.out
|
||||||
@if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi
|
@if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi
|
||||||
|
|
||||||
|
# use tcc to create libtcc.so/.dll and the tcc(.exe) frontend and run them
|
||||||
|
dlltest:
|
||||||
|
@echo ------------ $@ ------------
|
||||||
|
$(TCC) -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL ../libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
|
||||||
|
$(TCC) $(NATIVE_DEFINES) ../tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
|
||||||
|
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run ../examples/ex1.c
|
||||||
|
ifndef CONFIG_WIN32
|
||||||
|
@echo ------------ $@ with PIC ------------
|
||||||
|
$(CC) $(CFLAGS) -fPIC -DONE_SOURCE $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c ../libtcc.c
|
||||||
|
$(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF)
|
||||||
|
$(TCC) $(NATIVE_DEFINES) ../tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
|
||||||
|
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run ../examples/ex1.c
|
||||||
|
endif
|
||||||
|
@rm tcc2$(EXESUF) libtcc2$(DLLSUF)
|
||||||
|
|
||||||
|
|
||||||
# memory and bound check auto test
|
# memory and bound check auto test
|
||||||
BOUNDS_OK = 1 4 8 10 14
|
BOUNDS_OK = 1 4 8 10 14
|
||||||
BOUNDS_FAIL= 2 5 7 9 11 12 13 15
|
BOUNDS_FAIL= 2 5 7 9 11 12 13 15
|
||||||
|
@ -1634,15 +1634,6 @@ void bitfield_test(void)
|
|||||||
st2.f3 = a;
|
st2.f3 = a;
|
||||||
st2.f2++;
|
st2.f2++;
|
||||||
printf("%lld %lld %lld\n", st2.f1, st2.f2, st2.f3);
|
printf("%lld %lld %lld\n", st2.f1, st2.f2, st2.f3);
|
||||||
struct sbf3 {
|
|
||||||
int f1 : 7;
|
|
||||||
int f2 : 1;
|
|
||||||
char f3;
|
|
||||||
int f4 : 8;
|
|
||||||
int f5 : 1;
|
|
||||||
int f6 : 16;
|
|
||||||
} st3;
|
|
||||||
printf("sizeof(st3) = %d\n", sizeof(st3));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
Loading…
Reference in New Issue
Block a user