Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    ra1b41e3 r386fb57  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Apr 10 23:24:02 2023
    14 ## Update Count     : 96
     13## Last Modified On : Mon May  1 17:25:24 2023
     14## Update Count     : 145
    1515###############################################################################
     16
     17# user targets:
     18#  Run the complete test suite.
     19#  $ make  / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
     20
     21#  Run the short (quick) test suite.
     22#  $ make quick [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
    1623
    1724AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
     
    2027include $(top_srcdir)/tools/build/cfa.make
    2128
    22 DEFAULT_INCLUDES = -I${abs_srcdir}
    23 
    24 debug=yes
    25 installed=no
     29DEFAULT_INCLUDES = -I$(abs_srcdir)
     30
     31debug ?= yes
     32installed ?= no
     33ARCH=$(if $(arch),"--arch=$(arch)")
    2634archiveerrors=
    2735
     
    3341timeouts=
    3442
    35 TEST_PY = python3 ${builddir}/test.py
     43TEST_PY = python3 $(builddir)/test.py
    3644
    3745# applies to both programs
    3846# since automake doesn't have support for CFA we have to
    3947AM_CFLAGS = $(if $(test), 2> $(test), ) \
    40         -fdebug-prefix-map=$(abspath ${abs_srcdir})= \
     48        -fdebug-prefix-map=$(abspath $(abs_srcdir))= \
    4149        -fdebug-prefix-map=/tmp= \
    4250        -fno-diagnostics-show-caret \
     
    5462
    5563# adjust CC to current flags
    56 CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
     64CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
    5765CFACC = $(CC)
    5866
     
    6169
    6270# adjusted CC but without the actual distcc call
    63 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    64 CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'))
    65 
    66 PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
     71CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
     72CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g'))
     73
     74PRETTY_PATH=mkdir -p $(dir $(abspath $(@))) && cd $(srcdir) &&
    6775
    6876.PHONY: list .validate .test_makeflags
     
    93101dist-hook:
    94102        echo "Gathering test files"
    95         for file in `${TEST_PY} --list-dist`; do \
    96                 if test -f ${srcdir}/$${file}; then \
    97                         $(MKDIR_P) $$(dirname ${distdir}/$${file}); \
    98                         cp -df ${srcdir}/$${file} ${distdir}/$${file}; \
     103        for file in `$(TEST_PY) --list-dist`; do \
     104                if test -f $(srcdir)/$${file}; then \
     105                        $(MKDIR_P) $$(dirname $(distdir)/$${file}); \
     106                        cp -df $(srcdir)/$${file} $(distdir)/$${file}; \
    99107                fi; \
    100108        done
     109
    101110
    102111avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
     
    107116
    108117#----------------------------------------------------------------------------------------------------------------
    109 all-local :
    110         @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    111 
    112 all-tests :
    113         @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     118
     119all-local : # This name is important to automake and implies the default build target.
     120        @+$(TEST_PY) --debug=$(debug) --install=$(installed) --invariant --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     121
     122install : all-local # PAB only
     123
     124tests : all-local
     125
     126quick :
     127        @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) $(quick_test)
    114128
    115129mostlyclean-local :
    116         find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
    117         find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
    118         find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
    119         rm -f ${EXTRA_PROGRAMS}
     130        find $(builddir) -not -path './__pycache__/*' -path '*.o' -delete
     131        find $(builddir) -not -path './__pycache__/*' -path '*/.err/*.log' -delete
     132        find $(builddir) -not -path './__pycache__/*' -path '*/.out/*.log' -delete
     133        rm -f $(EXTRA_PROGRAMS)
    120134        rm -rf __pycache__
    121135
    122136distclean-local :
    123         find ${builddir} -path '*.Po' -delete
     137        find $(builddir) -path '*.Po' -delete
    124138
    125139list :
    126         @+${TEST_PY} --list ${concurrent}
     140        @+$(TEST_PY) --list $(concurrent)
    127141
    128142.test_makeflags:
    129         @echo "${MAKEFLAGS}"
     143        @echo "$(MAKEFLAGS)"
    130144
    131145.validate: .validate.cfa
     
    133147
    134148.validate.cfa:
    135         @echo "int main() { return 0; }" > ${@}
     149        @echo "int main() { return 0; }" > $(@)
    136150
    137151# automake doesn't know we still need C rules so pretend like we have a C program
    138152.dummy_hack.c:
    139         @echo "int main() { return 0; }" > ${@}
     153        @echo "int main() { return 0; }" > $(@)
    140154
    141155.dummy_hackxx.cpp:
    142         @echo "int bar() { return 0; }" > ${@}
     156        @echo "int bar() { return 0; }" > $(@)
    143157
    144158concurrency :
    145         @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
     159        @+$(TEST_PY) --debug=$(debug)  --install=$(installed) -Iconcurrent
    146160
    147161#----------------------------------------------------------------------------------------------------------------
    148162
    149163# Use for all tests, make sure the path are correct and all flags are added
    150 CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
     164CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) $($(shell echo "$(@)_FLAGSCFA" | sed 's/-\|\//_/g'))
    151165
    152166#----------------------------------------------------------------------------------------------------------------
     
    156170# don't use distcc to do the linking because distcc doesn't do linking
    157171% : %.cfa $(CFACCBIN)
    158         $(CFACOMPILETEST) -c -o $(abspath ${@}).o -DIN_DIR="$(abspath $(dir ${<}))/.in/"
    159         $(CFACCLINK) ${@}.o -o $(abspath ${@})
    160         rm $(abspath ${@}).o
     172        $(CFACOMPILETEST) -c -o $(abspath $(@)).o -DIN_DIR="$(abspath $(dir $(<)))/.in/"
     173        $(CFACCLINK) $(@).o -o $(abspath $(@))
     174        rm $(abspath $(@)).o
    161175
    162176# implicit rule for c++ test
    163177# convient for testing the testsuite itself but not actuall used
    164178% : %.cpp
    165         $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     179        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) -o $(abspath $(@))
    166180
    167181#------------------------------------------------------------------------------
     
    175189GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
    176190$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
    177         $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
     191        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath $(@))
    178192
    179193#------------------------------------------------------------------------------
     
    181195#------------------------------------------------------------------------------
    182196# tests that just validate syntax and compiler output should be compared to stderr
    183 CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@})
     197CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath $(@))
    184198
    185199SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
     
    187201$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
    188202        $(CFACOMPILE_SYNTAX)
    189         $(if $(test), cp $(test) $(abspath ${@}), )
     203        $(if $(test), cp $(test) $(abspath $(@)), )
    190204
    191205# expected failures
     
    193207alloc-ERROR : alloc.cfa $(CFACCBIN)
    194208        $(CFACOMPILE_SYNTAX) -DERR1
    195         -cp $(test) $(abspath ${@})
     209        -cp $(test) $(abspath $(@))
    196210
    197211init1-ERROR : init1.cfa $(CFACCBIN)
    198212        $(CFACOMPILE_SYNTAX) -DERR1
    199         -cp $(test) $(abspath ${@})
     213        -cp $(test) $(abspath $(@))
    200214
    201215typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
    202216        $(CFACOMPILE_SYNTAX) -DERR1
    203         -cp $(test) $(abspath ${@})
     217        -cp $(test) $(abspath $(@))
    204218
    205219nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
    206220        $(CFACOMPILE_SYNTAX) -DERR1
    207         -cp $(test) $(abspath ${@})
     221        -cp $(test) $(abspath $(@))
    208222
    209223nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
    210224        $(CFACOMPILE_SYNTAX) -DERR2
    211         -cp $(test) $(abspath ${@})
     225        -cp $(test) $(abspath $(@))
    212226
    213227raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
    214228        $(CFACOMPILE_SYNTAX) -DERR1
    215         -cp $(test) $(abspath ${@})
     229        -cp $(test) $(abspath $(@))
    216230
    217231raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
    218232        $(CFACOMPILE_SYNTAX) -DERR1
    219         -cp $(test) $(abspath ${@})
     233        -cp $(test) $(abspath $(@))
    220234
    221235raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
    222236        $(CFACOMPILE_SYNTAX) -DERR1
    223         -cp $(test) $(abspath ${@})
     237        -cp $(test) $(abspath $(@))
    224238
    225239raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
    226240        $(CFACOMPILE_SYNTAX) -DERR2
    227         -cp $(test) $(abspath ${@})
     241        -cp $(test) $(abspath $(@))
    228242
    229243# Exception Tests
     
    231245
    232246exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
    233         $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
    234         $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
     247        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath $(@)).o
     248        $(CFACCLOCAL) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath $(@)).o -o $(abspath $(@))
    235249
    236250# Linking tests
    237251# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
    238252linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
    239         $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
    240         $(CFACCLINK)  -O0 ${@}.o -o $(abspath ${@})
    241         rm $(abspath ${@}).o
     253        $(CFACOMPILETEST) -O0 -c -o $(abspath $(@)).o
     254        $(CFACCLINK)  -O0 $(@).o -o $(abspath $(@))
     255        rm $(abspath $(@)).o
    242256
    243257#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.