Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/tcc-0.9.27
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/tcc-0.9.27/tests/Makefile

    r279 r331  
    55TOP = ..
    66include $(TOP)/Makefile
    7 VPATH = $(top_srcdir)/tests
     7VPATH = $(TOPSRC)/tests $(TOPSRC) $(TOP)
     8CFLAGS := $(filter-out -W% -g% -O%,$(CFLAGS)) -I$(TOPSRC) $(LDFLAGS)
    89
    910# what tests to run
     
    1314 libtest \
    1415 test3 \
    15  moretests
     16 memtest \
     17 dlltest \
     18 abitest \
     19 asm-c-connect-test \
     20 vla_test-run \
     21 cross-test \
     22 tests2-dir \
     23 pp-dir
     24
     25BTESTS = test1b test3b btest
    1626
    1727# test4 -- problem with -static
    18 # asmtest -- minor differences with gcc
     28# asmtest / asmtest2 -- minor differences with gcc
    1929# btest -- works on i386 (including win32)
    20 # test3 -- win32 does not know how to printf long doubles
    2130
    2231# bounds-checking is supported only on i386
    2332ifneq ($(ARCH),i386)
    24  TESTS := $(filter-out btest,$(TESTS))
     33 TESTS := $(filter-out $(BTESTS),$(TESTS))
    2534endif
    2635ifdef CONFIG_WIN32
     36 TESTS := $(filter-out $(BTESTS),$(TESTS))
     37endif
     38ifdef CONFIG_OSX # -run only
     39 TESTS := hello-run libtest tests2-dir pp-dir
     40endif
     41ifeq (,$(filter arm64 i386 x86_64,$(ARCH)))
     42 TESTS := $(filter-out vla_test-run,$(TESTS))
     43endif
     44ifeq ($(CONFIG_arm_eabi),yes)
    2745 TESTS := $(filter-out test3,$(TESTS))
    2846endif
    29 ifeq ($(TARGETOS),Darwin)
    30  TESTS := $(filter-out hello-exe test3 btest,$(TESTS))
    31 endif
    32 
    33 ifdef DISABLE_STATIC
    34  export LD_LIBRARY_PATH:=$(CURDIR)/..
    35 endif
    36 
    37 ifeq ($(TARGETOS),Darwin)
    38  CFLAGS+=-Wl,-flat_namespace,-undefined,warning
    39  export MACOSX_DEPLOYMENT_TARGET:=10.2
    40  NATIVE_DEFINES+=-D_ANSI_SOURCE
    41 endif
    42 
    43 # run local version of tcc with local libraries and includes
    44 TCCFLAGS = -B$(TOP)
    45 ifdef CONFIG_WIN32
    46  TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
    47 endif
    48 
    49 TCC = $(TOP)/tcc $(TCCFLAGS)
    50 RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS)
    51 
     47ifeq (,$(filter i386 x86_64,$(ARCH)))
     48 TESTS := $(filter-out dlltest asm-c-connect-test,$(TESTS))
     49endif
     50ifndef CONFIG_cross
     51 TESTS := $(filter-out cross-%,$(TESTS))
     52endif
     53
     54ifeq ($(OS),Windows_NT) # for libtcc_test to find libtcc.dll
     55 PATH := $(CURDIR)/$(TOP)$(if $(findstring :\,$(PATH)),;,:)$(PATH)
     56endif
     57
     58RUN_TCC = $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS)
    5259DISAS = objdump -d
    53 
    54 # libtcc test
    55 ifdef LIBTCC1
    56  LIBTCC1:=$(TOP)/$(LIBTCC1)
    57 endif
    58 
    59 all test : $(TESTS)
     60DUMPTCC = (set -x; $(TOP)/tcc -vv; ldd $(TOP)/tcc; exit 1)
     61
     62all test : clean-s $(TESTS)
    6063
    6164hello-exe: ../examples/ex1.c
    6265        @echo ------------ $@ ------------
    63         $(TCC) $< -o hello$(EXESUF) || ($(TOP)/tcc -vv; exit 1) && ./hello$(EXESUF)
     66        $(TCC) $< -o hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC)
    6467
    6568hello-run: ../examples/ex1.c
    6669        @echo ------------ $@ ------------
    67         $(TCC) -run $<
    68 
    69 libtest: libtcc_test$(EXESUF) $(LIBTCC1)
    70         @echo ------------ $@ ------------
    71         ./libtcc_test$(EXESUF) lib_path=..
    72 
    73 libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
    74         $(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)
    75 
    76 moretests:
    77         @echo ------------ $@ ------------
    78         $(MAKE) -C tests2
    79 
    80 # test.ref - generate using gcc
    81 # copy only tcclib.h so GCC's stddef and stdarg will be used
     70        $(TCC) -run $< || $(DUMPTCC)
     71
     72libtest: libtcc_test$(EXESUF)
     73        @echo ------------ $@ ------------
     74        ./libtcc_test$(EXESUF) $(TCCFLAGS)
     75
     76libtcc_test$(EXESUF): libtcc_test.c $(LIBTCC)
     77        $(CC) -o $@ $^ $(CFLAGS) $(LIBS)
     78
     79%-dir:
     80        @echo ------------ $@ ------------
     81        $(MAKE) -k -C $*
     82
     83# test.ref - generate using cc
    8284test.ref: tcctest.c
    83         cp ../include/tcclib.h .
    84         gcc -o tcctest.gcc $< -I. $(CPPFLAGS) -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99 -O0 -fno-omit-frame-pointer $(LDFLAGS)
     85        $(CC) -o tcctest.gcc $< $(NATIVE_DEFINES) $(CFLAGS) -w -O0 -std=gnu99 -fno-omit-frame-pointer
    8586        ./tcctest.gcc > $@
    8687
    8788# auto test
    88 test1: test.ref
    89         @echo ------------ $@ ------------
    90         $(TCC) -run tcctest.c > test.out1
    91         @if diff -u test.ref test.out1 ; then echo "Auto Test OK"; fi
     89test1 test1b: tcctest.c test.ref
     90        @echo ------------ $@ ------------
     91        $(TCC) -run $< > test.out1
     92        @diff -u test.ref test.out1 && echo "Auto Test OK"
    9293
    9394# iterated test2 (compile tcc then compile tcctest.c !)
    94 test2: test.ref
    95         @echo ------------ $@ ------------
    96         $(TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out2
    97         @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
     95test2 test2b: tcctest.c test.ref
     96        @echo ------------ $@ ------------
     97        $(TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out2
     98        @diff -u test.ref test.out2 && echo "Auto Test2 OK"
    9899
    99100# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
    100 test3: test.ref
    101         @echo ------------ $@ ------------
    102         $(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run tcctest.c > test.out3
    103         @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
     101test3 test3b: tcctest.c test.ref
     102        @echo ------------ $@ ------------
     103        $(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -run $< > test.out3
     104        @diff -u test.ref test.out3 && echo "Auto Test3 OK"
     105
     106test%b : TCCFLAGS += -b
    104107
    105108# binary output test
    106 test4: test.ref
     109test4: tcctest.c test.ref
    107110        @echo ------------ $@ ------------
    108111# object + link output
    109         $(TCC) -c -o tcctest3.o tcctest.c
     112        $(TCC) -c -o tcctest3.o $<
    110113        $(TCC) -o tcctest3 tcctest3.o
    111114        ./tcctest3 > test3.out
    112115        @if diff -u test.ref test3.out ; then echo "Object Auto Test OK"; fi
    113116# dynamic output
    114         $(TCC) -o tcctest1 tcctest.c
     117        $(TCC) -o tcctest1 $<
    115118        ./tcctest1 > test1.out
    116119        @if diff -u test.ref test1.out ; then echo "Dynamic Auto Test OK"; fi
    117120# dynamic output + bound check
    118         $(TCC) -b -o tcctest4 tcctest.c
     121        $(TCC) -b -o tcctest4 $<
    119122        ./tcctest4 > test4.out
    120123        @if diff -u test.ref test4.out ; then echo "BCheck Auto Test OK"; fi
    121124# static output
    122         $(TCC) -static -o tcctest2 tcctest.c
     125        $(TCC) -static -o tcctest2 $<
    123126        ./tcctest2 > test2.out
    124127        @if diff -u test.ref test2.out ; then echo "Static Auto Test OK"; fi
     128
     129# use tcc to create libtcc.so/.dll and the tcc(.exe) frontend and run them
     130dlltest:
     131        @echo ------------ $@ ------------
     132        $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
     133        $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
     134        ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
     135ifndef CONFIG_WIN32
     136        @echo ------------ $@ with PIC ------------
     137        $(CC) $(CFLAGS) -fPIC $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c $(TOPSRC)/libtcc.c
     138        $(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF)
     139        $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
     140        ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
     141endif
     142        @rm tcc2$(EXESUF) libtcc2$(DLLSUF)
     143
     144memtest:
     145        @echo ------------ $@ ------------
     146        $(CC) $(CFLAGS) $(NATIVE_DEFINES) -DMEM_DEBUG=2 $(TOPSRC)/tcc.c $(LIBS) -o memtest-tcc$(EXESUF)
     147        ./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c $(LIBS)
     148        ./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS) $(TOPSRC)/tests/tcctest.c
     149
    125150
    126151# memory and bound check auto test
     
    132157        @for i in $(BOUNDS_OK); do \
    133158           echo ; echo --- boundtest $$i ---; \
    134            if $(TCC) -b -run boundtest.c $$i ; then \
    135                echo succeded as expected; \
     159           if $(TCC) -b -run $< $$i ; then \
     160               echo succeeded as expected; \
    136161           else\
    137162               echo Failed positive test $$i ; exit 1 ; \
     
    140165        for i in $(BOUNDS_FAIL); do \
    141166           echo ; echo --- boundtest $$i ---; \
    142            if $(TCC) -b -run boundtest.c $$i ; then \
     167           if $(TCC) -b -run $< $$i ; then \
    143168               echo Failed negative test $$i ; exit 1 ;\
    144169           else\
     
    152177        @echo ------------ $@ ------------
    153178        time ./ex2 1238 2 3 4 10 13 4
    154         time $(TCC) -run $(top_srcdir)/examples/ex2.c 1238 2 3 4 10 13 4
     179        time $(TCC) -run $(TOPSRC)/examples/ex2.c 1238 2 3 4 10 13 4
    155180        time ./ex3 35
    156         time $(TCC) -run $(top_srcdir)/examples/ex3.c 35
    157 
    158 weaktest: test.ref
    159         $(TCC) -c tcctest.c -o weaktest.tcc.o $(CPPFLAGS) $(CFLAGS)
    160          $(CC) -c tcctest.c -o weaktest.gcc.o -I. $(CPPFLAGS) -w $(CFLAGS)
     181        time $(TCC) -run $(TOPSRC)/examples/ex3.c 35
     182
     183weaktest: tcctest.c test.ref
     184        $(TCC) -c $< -o weaktest.tcc.o
     185        $(CC) -c $< -o weaktest.gcc.o $(NATIVE_DEFINES) $(CFLAGS) -w -O0 -std=gnu99 -fno-omit-frame-pointer
    161186        objdump -t weaktest.tcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.tcc.o.txt
    162187        objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt
    163188        diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK"
    164189
    165 ex%: $(top_srcdir)/examples/ex%.c
    166         $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
     190ex%: $(TOPSRC)/examples/ex%.c
     191        $(CC) -o $@ $< $(CFLAGS)
    167192
    168193# tiny assembler testing
     
    171196        objdump -D asmtest.ref.o > asmtest.ref
    172197
    173 asmtest: asmtest.ref
    174         @echo ------------ $@ ------------
    175         $(TCC) -c asmtest.S
     198asmtest asmtest2: asmtest.ref
     199        @echo ------------ $@ ------------
     200        $(TCC) $(MAYBE_RUN_TCC) -c asmtest.S
    176201        objdump -D asmtest.o > asmtest.out
    177202        @if diff -u --ignore-matching-lines="file format" asmtest.ref asmtest.out ; then echo "ASM Auto Test OK"; fi
     203
     204# test assembler with tcc compiled by itself
     205asmtest2: MAYBE_RUN_TCC = $(RUN_TCC)
     206
     207# Check that code generated by libtcc is binary compatible with
     208# that generated by CC
     209abitest-cc$(EXESUF): abitest.c $(LIBTCC)
     210        $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w
     211
     212abitest-tcc$(EXESUF): abitest.c libtcc.c
     213        $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)
     214
     215ABITESTS := abitest-cc$(EXESUF)
     216ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
     217 ABITESTS += abitest-tcc$(EXESUF)
     218endif
     219
     220abitest: $(ABITESTS)
     221        @echo ------------ $@ ------------
     222        ./abitest-cc$(EXESUF) $(TCCFLAGS)
     223ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
     224        ./abitest-tcc$(EXESUF) $(TCCFLAGS)
     225endif
     226
     227vla_test$(EXESUF): vla_test.c
     228        $(TCC) -o $@ $^
     229
     230vla_test-run: vla_test$(EXESUF)
     231        @echo ------------ $@ ------------
     232        ./vla_test$(EXESUF)
     233
     234asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c
     235        $(TCC) -o $@ $^
     236
     237asm-c-connect-%.o: asm-c-connect-%.c
     238        $(TCC) -c -o $@ $<
     239
     240asm-c-connect-sep$(EXESUF): asm-c-connect-1.o asm-c-connect-2.o
     241        $(TCC) -o $@ $^
     242
     243asm-c-connect-test: asm-c-connect$(EXESUF) asm-c-connect-sep$(EXESUF)
     244        @echo ------------ $@ ------------
     245        ./asm-c-connect$(EXESUF) > asm-c-connect.out1 && cat asm-c-connect.out1
     246        ./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
     247        @diff -u asm-c-connect.out1 asm-c-connect.out2 && echo "ok"
     248
     249cross-test :
     250        @echo ------------ $@ ------------
     251        $(TOP)/i386-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     252        $(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/examples/ex3.c && echo "ok"
     253        $(TOP)/x86_64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     254        $(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/examples/ex3.c && echo "ok"
     255        $(TOP)/arm-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     256        $(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     257        $(TOP)/arm64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     258        $(TOP)/c67-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
     259        $(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
     260        $(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
     261        $(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
    178262
    179263# targets for development
     
    194278# clean
    195279clean:
    196         $(MAKE) -C tests2 $@
    197         rm -vf *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.gcc *.exe \
    198            hello libtcc_test tcctest[1234] ex? tcc_g tcclib.h
    199 
     280        rm -f *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.cc *.gcc
     281        rm -f *-cc *-gcc *-tcc *.exe hello libtcc_test vla_test tcctest[1234]
     282        rm -f asm-c-connect$(EXESUF)
     283        rm -f ex? tcc_g weaktest.*.txt *.def
     284        @$(MAKE) -C tests2 $@
     285        @$(MAKE) -C pp $@
     286
     287# silent clean, used before running tests
     288clean-s:
     289        @$(MAKE) -s --no-print-directory clean
Note: See TracChangeset for help on using the changeset viewer.