Changeset 34e1494


Ignore:
Timestamp:
Sep 13, 2019, 2:04:11 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
158b026, 2cb8577, 970141d, b2a37b0
Parents:
15f9c8e
Message:

Clean up test make file and add autodetection of number of hosts by test.py

Location:
tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    r15f9c8e r34e1494  
    4343        -DIN_DIR="${abs_srcdir}/.in/"
    4444
     45# adjust CC to current flags
    4546CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     47CFACC = $(CC)
     48
     49# get local binary for depedencies
    4650CFACCBIN = @CFACC@
    47 CFACC = $(CC)
     51
     52# adjusted CC but without the actual distcc call
     53CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
    4854
    4955PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
     
    8995
    9096# Use for all tests, make sure the path are correct and all flags are added
    91 CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    92 
    93 # Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
    94 CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@})
    95 
    96 # Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
    97 CFATEST_STDERR=$(CFACOMPILETEST) 2> $(abspath ${@})
     97CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
    9898
    9999#----------------------------------------------------------------------------------------------------------------
     
    101101# implicit rule so not all test require a rule
    102102# split into two steps to support compiling remotely using distcc
     103# don't use distcc to do the linking because distcc doesn't do linking
    103104% : %.cfa $(CFACCBIN)
    104105        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
    105         $(CFACC) $(abspath ${@}).o -o $(abspath ${@})
     106        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
    106107
    107 # second implicit rule for programs that don't produce an executable
    108 # still in two steps for distcc
    109 declarationSpecifier gccExtensions extension attributes functions KRfunctions : % : %.cfa $(CFACCBIN)
    110         $(CFACOMPILETEST) -CFA -XCFA -p -o $(abspath ${@}).o
    111         mv $(abspath ${@}).o $(abspath ${@})
    112 
     108# implicit rule for c++ test
     109# convient for testing the testsuite itself but not actuall used
    113110% : %.cpp
    114111        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
    115112
    116113#------------------------------------------------------------------------------
    117 # TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     114# TARGETS WITH CUSTOM FLAGS
    118115#------------------------------------------------------------------------------
    119 # Expected failures
    120 declarationSpecifier_FLAGS= -CFA -XCFA -p
    121 gccExtensions_FLAGS= -CFA -XCFA -p
    122 extension_FLAGS= -CFA -XCFA -p
    123 attributes_FLAGS= -CFA -XCFA -p
    124 functions_FLAGS= -CFA -XCFA -p
    125 KRfunctions_FLAGS= -CFA -XCFA -p
    126 gmp_FLAGS= -lgmp
     116# custom libs
     117gmp_FLAGSLD= -lgmp
    127118
    128119#------------------------------------------------------------------------------
    129 # Expected failures
    130 completeTypeError_FLAGS= -DERR1
     120# Generated code
     121GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
     122$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
     123        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
     124
     125# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
     126EXPECT_STDERR = builtins/sync warnings/self-assignment
     127$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
     128        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
    131129
    132130#------------------------------------------------------------------------------
    133131# CUSTOM TARGET
    134132#------------------------------------------------------------------------------
    135 typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
    136         $(CFATEST_STDOUT) -DERR1
     133# expected failures
     134# use custom target since they require a custom define and custom dependencies
     135alloc-ERROR : alloc.cfa $(CFACCBIN)
     136        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    137137
    138 alloc-ERROR: alloc.cfa $(CFACCBIN)
    139         $(CFATEST_STDOUT) -DERR1
     138typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
     139        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    140140
    141 nested-types-ERR1: nested-types.cfa $(CFACCBIN)
    142         $(CFATEST_STDOUT) -DERR1
     141nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
     142        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    143143
    144 nested-types-ERR2: nested-types.cfa $(CFACCBIN)
    145         $(CFATEST_STDOUT) -DERR2
     144nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
     145        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
    146146
    147 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
    148         $(CFATEST_STDOUT) -DERR1
     147raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
     148        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    149149
    150 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
    151         $(CFATEST_STDOUT) -DERR2
     150raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
     151        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    152152
    153 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
    154         $(CFATEST_STDOUT) -DERR1
     153raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
     154        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
    155155
    156 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
    157         $(CFATEST_STDOUT) -DERR1
     156raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
     157        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
    158158
    159 #builtins
    160 builtins/sync: builtins/sync.cfa $(CFACCBIN)
    161         $(CFATEST_STDERR) -fsyntax-only
    162 
    163 # Warnings
    164 warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
    165         $(CFATEST_STDERR) -fsyntax-only
     159#------------------------------------------------------------------------------
     160# Other targets
  • tests/Makefile.in

    r15f9c8e r34e1494  
    212212AWK = @AWK@
    213213BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
     214
     215# adjust CC to current flags
    214216CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
    215217CCAS = @CCAS@
     
    395397        -DIN_DIR="${abs_srcdir}/.in/"
    396398
     399
     400# get local binary for depedencies
    397401CFACCBIN = @CFACC@
     402
     403# adjusted CC but without the actual distcc call
     404CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
    398405PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    399406avl_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
     
    404411
    405412# Use for all tests, make sure the path are correct and all flags are added
    406 CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    407 
    408 # Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
    409 CFATEST_STDOUT = $(CFACOMPILETEST) -o $(abspath ${@})
    410 
    411 # Use for tests where the make command is expecte to succeed but the expected.txt should be compared to stderr
    412 CFATEST_STDERR = $(CFACOMPILETEST) 2> $(abspath ${@})
     413CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
    413414
    414415#------------------------------------------------------------------------------
    415 # TARGET WITH STANDARD RULE BUT CUSTOM FLAGS
     416# TARGETS WITH CUSTOM FLAGS
    416417#------------------------------------------------------------------------------
    417 # Expected failures
    418 declarationSpecifier_FLAGS = -CFA -XCFA -p
    419 gccExtensions_FLAGS = -CFA -XCFA -p
    420 extension_FLAGS = -CFA -XCFA -p
    421 attributes_FLAGS = -CFA -XCFA -p
    422 functions_FLAGS = -CFA -XCFA -p
    423 KRfunctions_FLAGS = -CFA -XCFA -p
    424 gmp_FLAGS = -lgmp
     418# custom libs
     419gmp_FLAGSLD = -lgmp
    425420
    426421#------------------------------------------------------------------------------
    427 # Expected failures
    428 completeTypeError_FLAGS = -DERR1
     422# Generated code
     423GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
     424
     425# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
     426EXPECT_STDERR = builtins/sync warnings/self-assignment
    429427all: all-am
    430428
     
    809807# implicit rule so not all test require a rule
    810808# split into two steps to support compiling remotely using distcc
     809# don't use distcc to do the linking because distcc doesn't do linking
    811810% : %.cfa $(CFACCBIN)
    812811        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
    813         $(CFACC) $(abspath ${@}).o -o $(abspath ${@})
    814 
    815 # second implicit rule for programs that don't produce an executable
    816 # still in two steps for distcc
    817 declarationSpecifier gccExtensions extension attributes functions KRfunctions : % : %.cfa $(CFACCBIN)
    818         $(CFACOMPILETEST) -CFA -XCFA -p -o $(abspath ${@}).o
    819         mv $(abspath ${@}).o $(abspath ${@})
    820 
     812        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
     813
     814# implicit rule for c++ test
     815# convient for testing the testsuite itself but not actuall used
    821816% : %.cpp
    822817        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
     818$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
     819        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
     820$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
     821        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
    823822
    824823#------------------------------------------------------------------------------
    825824# CUSTOM TARGET
    826825#------------------------------------------------------------------------------
    827 typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
    828         $(CFATEST_STDOUT) -DERR1
    829 
    830 alloc-ERROR: alloc.cfa $(CFACCBIN)
    831         $(CFATEST_STDOUT) -DERR1
    832 
    833 nested-types-ERR1: nested-types.cfa $(CFACCBIN)
    834         $(CFATEST_STDOUT) -DERR1
    835 
    836 nested-types-ERR2: nested-types.cfa $(CFACCBIN)
    837         $(CFATEST_STDOUT) -DERR2
    838 
    839 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
    840         $(CFATEST_STDOUT) -DERR1
    841 
    842 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
    843         $(CFATEST_STDOUT) -DERR2
    844 
    845 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
    846         $(CFATEST_STDOUT) -DERR1
    847 
    848 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
    849         $(CFATEST_STDOUT) -DERR1
    850 
    851 #builtins
    852 builtins/sync: builtins/sync.cfa $(CFACCBIN)
    853         $(CFATEST_STDERR) -fsyntax-only
    854 
    855 # Warnings
    856 warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
    857         $(CFATEST_STDERR) -fsyntax-only
     826# expected failures
     827# use custom target since they require a custom define and custom dependencies
     828alloc-ERROR : alloc.cfa $(CFACCBIN)
     829        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     830
     831typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
     832        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     833
     834nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
     835        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     836
     837nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
     838        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
     839
     840raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
     841        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     842
     843raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
     844        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     845
     846raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
     847        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
     848
     849raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
     850        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
     851
     852#------------------------------------------------------------------------------
     853# Other targets
    858854
    859855# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • tests/pybin/tools.py

    r15f9c8e r34e1494  
    261261                        os.write(int(make_jobs_fds.group(3)), tokens)
    262262                else :
    263                         options.jobs = multiprocessing.cpu_count()
     263                        if settings.distribute:
     264                                ret, jstr = sh("distcc", "-j", output_file=subprocess.PIPE, ignore_dry_run=True)
     265                                if ret == 0:
     266                                        options.jobs = int(jstr.strip())
     267                                else :
     268                                        options.jobs = multiprocessing.cpu_count()
     269                        else:
     270                                options.jobs = multiprocessing.cpu_count()
    264271        else :
    265272                force = True
Note: See TracChangeset for help on using the changeset viewer.