mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
tcctest: add back testXb (self compile with -b)
- Thanks to Kirill "tcc -b itself" should work now (was removed ind5f4df09ff
) Also: - tests/Makefile: - fix spurious --I from767410b875
- lookup boundtest.c via VPATH (for out-of-tree build) - test[123]b?: fail on diff error - Windows: test3 now works (frome31579b076
) - abitest: a libtcc.a made by gcc is not usable for tcc on WIndows - using source instead (libtcc.c) - tccpe: - avoid gcc warning (x86_64)
This commit is contained in:
parent
48ad93983f
commit
32a4962593
4
Makefile
4
Makefile
@ -346,8 +346,8 @@ tcc-doc.info: tcc-doc.texi
|
|||||||
# in tests subdir
|
# in tests subdir
|
||||||
export LIBTCC1
|
export LIBTCC1
|
||||||
|
|
||||||
%est:
|
test test% %test :
|
||||||
$(MAKE) -C tests $@ "PROGS_CROSS=$(PROGS_CROSS)"
|
$(MAKE) -C tests $@ 'PROGS_CROSS=$(PROGS_CROSS)'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)
|
rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.exe libtcc_test$(EXESUF)
|
||||||
|
2
tccpe.c
2
tccpe.c
@ -1803,7 +1803,7 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe)
|
|||||||
s1->runtime_main = start_symbol;
|
s1->runtime_main = start_symbol;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
pe->start_addr = (DWORD)tcc_get_symbol_err(s1, start_symbol);
|
pe->start_addr = (DWORD)(uintptr_t)tcc_get_symbol_err(s1, start_symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
pe->type = pe_type;
|
pe->type = pe_type;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
TOP = ..
|
TOP = ..
|
||||||
include $(TOP)/Makefile
|
include $(TOP)/Makefile
|
||||||
SRCDIR = $(top_srcdir)/tests
|
SRCDIR = $(top_srcdir)/tests
|
||||||
VPATH = $(SRCDIR)
|
VPATH = $(SRCDIR) $(top_srcdir)
|
||||||
|
|
||||||
# what tests to run
|
# what tests to run
|
||||||
TESTS = \
|
TESTS = \
|
||||||
@ -13,27 +13,30 @@ TESTS = \
|
|||||||
hello-run \
|
hello-run \
|
||||||
libtest \
|
libtest \
|
||||||
test3 \
|
test3 \
|
||||||
|
$(BTESTS) \
|
||||||
abitest \
|
abitest \
|
||||||
vla_test-run \
|
vla_test-run \
|
||||||
moretests
|
moretests
|
||||||
|
|
||||||
|
BTESTS = test1b test3b btest
|
||||||
|
|
||||||
ifdef CONFIG_CROSS
|
ifdef CONFIG_CROSS
|
||||||
TESTS += hello-cross
|
TESTS += hello-cross
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# test4 -- problem with -static
|
# test4 -- problem with -static
|
||||||
# asmtest -- minor differences with gcc
|
# asmtest -- minor differences with gcc
|
||||||
# btest -- works on i386 (including win32)
|
# btest -- works on i386 (including win32)
|
||||||
# test3 -- win32 does not know how to printf long doubles
|
|
||||||
|
|
||||||
# bounds-checking is supported only on i386
|
# bounds-checking is supported only on i386
|
||||||
ifneq ($(ARCH),i386)
|
ifneq ($(ARCH),i386)
|
||||||
TESTS := $(filter-out btest,$(TESTS))
|
TESTS := $(filter-out $(BTESTS),$(TESTS))
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_WIN32
|
ifdef CONFIG_WIN32
|
||||||
TESTS := w32-prep $(filter-out test3,$(TESTS))
|
TESTS := w32-prep $(filter-out $(BTESTS),$(TESTS))
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGETOS),Darwin)
|
ifeq ($(TARGETOS),Darwin)
|
||||||
TESTS := $(filter-out hello-exe test3 btest,$(TESTS))
|
TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS))
|
||||||
endif
|
endif
|
||||||
ifeq ($(ARCH),i386)
|
ifeq ($(ARCH),i386)
|
||||||
else ifneq ($(ARCH),x86-64)
|
else ifneq ($(ARCH),x86-64)
|
||||||
@ -53,7 +56,7 @@ 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$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
|
TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
|
||||||
ifdef CONFIG_WIN32
|
ifdef CONFIG_WIN32
|
||||||
TCCFLAGS = -B$(top_srcdir)/win32 --I$(top_srcdir) -I$(top_srcdir)/include -I$(TOP) -L$(TOP)
|
TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) -I$(top_srcdir)/include -I$(TOP) -L$(TOP)
|
||||||
endif
|
endif
|
||||||
XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
|
XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
|
||||||
|
|
||||||
@ -101,28 +104,29 @@ w32-prep:
|
|||||||
cp ../libtcc1.a ../lib
|
cp ../libtcc1.a ../lib
|
||||||
|
|
||||||
# test.ref - generate using gcc
|
# test.ref - generate using gcc
|
||||||
# copy only tcclib.h so GCC's stddef and stdarg will be used
|
|
||||||
test.ref: tcctest.c
|
test.ref: tcctest.c
|
||||||
gcc -o tcctest.gcc $< -I$(top_srcdir) $(CPPFLAGS) -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99 -O0 -fno-omit-frame-pointer $(LDFLAGS)
|
gcc -o tcctest.gcc $< -I$(top_srcdir) $(CPPFLAGS) -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99 -O0 -fno-omit-frame-pointer $(LDFLAGS)
|
||||||
./tcctest.gcc > $@
|
./tcctest.gcc > $@
|
||||||
|
|
||||||
# auto test
|
# auto test
|
||||||
test1: tcctest.c test.ref
|
test1 test1b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) -run $< > test.out1
|
$(TCC) -run $< > test.out1
|
||||||
@if diff -u test.ref test.out1 ; then echo "Auto Test OK"; fi
|
@diff -u test.ref test.out1 && echo "Auto Test OK"
|
||||||
|
|
||||||
# iterated test2 (compile tcc then compile tcctest.c !)
|
# iterated test2 (compile tcc then compile tcctest.c !)
|
||||||
test2: tcctest.c test.ref
|
test2 test2b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out2
|
$(TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out2
|
||||||
@if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
|
@diff -u test.ref test.out2 && echo "Auto Test2 OK"
|
||||||
|
|
||||||
# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
|
# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
|
||||||
test3: tcctest.c test.ref
|
test3 test3b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out3
|
$(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out3
|
||||||
@if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
|
@diff -u test.ref test.out3 && echo "Auto Test3 OK"
|
||||||
|
|
||||||
|
test%b : TCCFLAGS += -b
|
||||||
|
|
||||||
# binary output test
|
# binary output test
|
||||||
test4: tcctest.c test.ref
|
test4: tcctest.c test.ref
|
||||||
@ -153,7 +157,7 @@ btest: boundtest.c
|
|||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
@for i in $(BOUNDS_OK); do \
|
@for i in $(BOUNDS_OK); do \
|
||||||
echo ; echo --- boundtest $$i ---; \
|
echo ; echo --- boundtest $$i ---; \
|
||||||
if $(TCC) -b -run boundtest.c $$i ; then \
|
if $(TCC) -b -run $< $$i ; then \
|
||||||
echo succeded as expected; \
|
echo succeded as expected; \
|
||||||
else\
|
else\
|
||||||
echo Failed positive test $$i ; exit 1 ; \
|
echo Failed positive test $$i ; exit 1 ; \
|
||||||
@ -161,7 +165,7 @@ btest: boundtest.c
|
|||||||
done ;\
|
done ;\
|
||||||
for i in $(BOUNDS_FAIL); do \
|
for i in $(BOUNDS_FAIL); do \
|
||||||
echo ; echo --- boundtest $$i ---; \
|
echo ; echo --- boundtest $$i ---; \
|
||||||
if $(TCC) -b -run boundtest.c $$i ; then \
|
if $(TCC) -b -run $< $$i ; then \
|
||||||
echo Failed negative test $$i ; exit 1 ;\
|
echo Failed negative test $$i ; exit 1 ;\
|
||||||
else\
|
else\
|
||||||
echo failed as expected; \
|
echo failed as expected; \
|
||||||
@ -203,8 +207,8 @@ asmtest: asmtest.ref
|
|||||||
abitest-cc$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
abitest-cc$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
||||||
$(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
$(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
||||||
|
|
||||||
abitest-tcc$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
abitest-tcc$(EXESUF): abitest.c libtcc.c
|
||||||
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE $(LIBS) $(LDFLAGS) -I$(top_srcdir)
|
||||||
|
|
||||||
abitest: abitest-cc$(EXESUF) abitest-tcc$(EXESUF)
|
abitest: abitest-cc$(EXESUF) abitest-tcc$(EXESUF)
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
|
Loading…
Reference in New Issue
Block a user