source: tests/Makefile.am @ bd30231

ADTast-experimental
Last change on this file since bd30231 was bd30231, checked in by Peter A. Buhr <pabuhr@…>, 21 months ago

add Makefile variable arch with default x64 and pass it to test.py

  • Property mode set to 100644
File size: 8.6 KB
RevLine 
[ef7d253]1######################## -*- Mode: Makefile-Automake -*- ######################
2##
3## Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
4##
5## The contents of this file are covered under the licence agreement in the
6## file "LICENCE" distributed with Cforall.
7##
8## Makefile.am --
9##
10## Author           : Peter A. Buhr
11## Created On       : Sun May 31 09:08:15 2015
12## Last Modified By : Peter A. Buhr
[bd30231]13## Last Modified On : Mon Oct 17 20:55:17 2022
14## Update Count     : 94
[ef7d253]15###############################################################################
16
[0c1b566]17AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
[107b01a]18ACLOCAL_AMFLAGS  = -I automake
[f85bc15]19
[bcadb26]20include $(top_srcdir)/tools/build/cfa.make
[dc8511c]21
[74cfe054]22DEFAULT_INCLUDES = -I${abs_srcdir}
23
[cc640aad]24debug=yes
[ff593a3]25installed=no
[bd30231]26arch=x64
[dcfedca]27archiveerrors=
[cc640aad]28
[36fbaeca]29DEBUG_FLAGS=-debug -g -O0
[e3a5a73]30
[ff7b2de]31quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
[be65cca]32
[0ad0c55]33concurrent=
[b90aace]34timeouts=
[be65cca]35
[5b993e0]36TEST_PY = python3 ${builddir}/test.py
[f85bc15]37
[ef7d253]38# applies to both programs
[d65f92c]39# since automake doesn't have support for CFA we have to
[b8f6002]40AM_CFLAGS = $(if $(test), 2> $(test), ) \
[87fc1b4]41        -fdebug-prefix-map=$(abspath ${abs_srcdir})= \
42        -fdebug-prefix-map=/tmp= \
[0a19c51]43        -fno-diagnostics-show-caret \
[b8f6002]44        -g \
45        -Wall \
[850aff1]46        -Werror=return-type \
[b8f6002]47        -Wno-unused-function \
[36fbaeca]48        -Wno-psabi \
[b44959f]49        -quiet @CFA_FLAGS@
[7c03d6d]50
[7215000]51AM_CFAFLAGS = -XCFA --deterministic-out
52
[158b026]53# get the desired cfa to test
54TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
55
[34e1494]56# adjust CC to current flags
[e2e31c6]57CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
[d65f92c]58CFACC = $(CC)
[ef7d253]59
[34e1494]60# get local binary for depedencies
61CFACCBIN = @CFACC@
62
63# adjusted CC but without the actual distcc call
[e173d3c]64CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS} ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
[fe94e708]65CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'))
[34e1494]66
[e16797c]67PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
[f7d3215]68
[fc01219]69.PHONY: list .validate .test_makeflags
70.INTERMEDIATE: .validate .validate.cfa .test_makeflags
[aff7e86]71EXTRA_PROGRAMS = avl_test linkonce .dummy_hack # build but do not install
[a468e1e9]72EXTRA_DIST = test.py \
73        pybin/__init__.py \
74        pybin/print-core.gdb \
75        pybin/settings.py \
76        pybin/test_run.py \
77        pybin/tools.py \
78        long_tests.hfa \
[d0fa494]79        avltree/avl-private.h \
80        avltree/avl.h \
81        concurrent/clib_tls.c \
82        concurrent/clib.c \
[d0a00a5a]83        configs/.in/parseconfig-all.txt \
84        configs/.in/parseconfig-errors.txt \
85        configs/.in/parseconfig-missing.txt \
[d0fa494]86        exceptions/except-io.hfa \
87        exceptions/with-threads.hfa \
[b44959f]88        io/.in/io.data \
[3bd5ca7]89        io/.in/many_read.data \
[d0fa494]90        meta/fork+exec.hfa \
[3ad9097]91        unified_locking/mutex_test.hfa
[a468e1e9]92
93dist-hook:
94        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}; \
99                fi; \
100        done
[44f44617]101
[107b01a]102avl_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
[aff7e86]103linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
[2b10f95]104# automake doesn't know we still need C/CPP rules so pretend like we have a C program
[b7fe2e6]105nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
[a0dcd2e]106
[73abe95]107#----------------------------------------------------------------------------------------------------------------
[927e9ce]108all-local :
[bd30231]109        @+${TEST_PY} --debug=${debug} --arch=${arch} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
[df42128]110
111all-tests :
[bd30231]112        @+${TEST_PY} --debug=${debug} --arch=${arch} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
[927e9ce]113
[2a59655]114mostlyclean-local :
[0783909]115        find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
116        find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
117        find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
[a6dd5b0]118        rm -f ${EXTRA_PROGRAMS}
[2a59655]119        rm -rf __pycache__
120
121distclean-local :
122        find ${builddir} -path '*.Po' -delete
[927e9ce]123
124list :
[f85bc15]125        @+${TEST_PY} --list ${concurrent}
[927e9ce]126
[fc01219]127.test_makeflags:
128        @echo "${MAKEFLAGS}"
129
[1e995d6]130.validate: .validate.cfa
131        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
132
133.validate.cfa:
134        @echo "int main() { return 0; }" > ${@}
[28582b2]135
[107b01a]136# automake doesn't know we still need C rules so pretend like we have a C program
137.dummy_hack.c:
[28582b2]138        @echo "int main() { return 0; }" > ${@}
139
[2b10f95]140.dummy_hackxx.cpp:
141        @echo "int bar() { return 0; }" > ${@}
142
[026a0f5]143concurrency :
[a5121bf]144        @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
[026a0f5]145
[73abe95]146#----------------------------------------------------------------------------------------------------------------
[dc8511c]147
[e16797c]148# Use for all tests, make sure the path are correct and all flags are added
[34e1494]149CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
[d9b499c]150
[e16797c]151#----------------------------------------------------------------------------------------------------------------
[a843067]152
[e16797c]153# implicit rule so not all test require a rule
[15f9c8e]154# split into two steps to support compiling remotely using distcc
[34e1494]155# don't use distcc to do the linking because distcc doesn't do linking
[d65f92c]156% : %.cfa $(CFACCBIN)
[b44959f]157        $(CFACOMPILETEST) -c -o $(abspath ${@}).o -DIN_DIR="$(abspath $(dir ${<}))/.in/"
[673eb7a]158        $(CFACCLINK) ${@}.o -o $(abspath ${@})
[468c5aa]159        rm $(abspath ${@}).o
[f7d3215]160
[34e1494]161# implicit rule for c++ test
162# convient for testing the testsuite itself but not actuall used
[e16797c]163% : %.cpp
164        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
[4c8f86b3]165
[f7d3215]166#------------------------------------------------------------------------------
[34e1494]167# TARGETS WITH CUSTOM FLAGS
[e16797c]168#------------------------------------------------------------------------------
[34e1494]169# custom libs
170gmp_FLAGSLD= -lgmp
[dc8511c]171
[e16797c]172#------------------------------------------------------------------------------
[34e1494]173# Generated code
174GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
175$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
176        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
177
[e16797c]178#------------------------------------------------------------------------------
179# CUSTOM TARGET
180#------------------------------------------------------------------------------
[66812dd]181# tests that just validate syntax and compiler output should be compared to stderr
[e6cfb4e2]182CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@})
[40c81e5]183
184SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \
[53692b3]185        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment
[66812dd]186$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
[e6cfb4e2]187        $(CFACOMPILE_SYNTAX)
188        $(if $(test), cp $(test) $(abspath ${@}), )
[87fc1b4]189
[34e1494]190# expected failures
[e6cfb4e2]191# use custom target since they require a custom define *and* have a name that doesn't match the file
[34e1494]192alloc-ERROR : alloc.cfa $(CFACCBIN)
[e6cfb4e2]193        $(CFACOMPILE_SYNTAX) -DERR1
194        -cp $(test) $(abspath ${@})
[b93a3de]195
[ee858bf]196init1-ERROR : init1.cfa $(CFACCBIN)
197        $(CFACOMPILE_SYNTAX) -DERR1
198        -cp $(test) $(abspath ${@})
199
[34e1494]200typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
[e6cfb4e2]201        $(CFACOMPILE_SYNTAX) -DERR1
202        -cp $(test) $(abspath ${@})
[e2c70ab]203
[34e1494]204nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]205        $(CFACOMPILE_SYNTAX) -DERR1
206        -cp $(test) $(abspath ${@})
[49e1275]207
[34e1494]208nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]209        $(CFACOMPILE_SYNTAX) -DERR2
210        -cp $(test) $(abspath ${@})
[49e1275]211
[34e1494]212raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
[e6cfb4e2]213        $(CFACOMPILE_SYNTAX) -DERR1
214        -cp $(test) $(abspath ${@})
[cdbfab0]215
[34e1494]216raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
[e6cfb4e2]217        $(CFACOMPILE_SYNTAX) -DERR1
218        -cp $(test) $(abspath ${@})
[80e8582]219
[34e1494]220raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]221        $(CFACOMPILE_SYNTAX) -DERR1
222        -cp $(test) $(abspath ${@})
[80e8582]223
[34e1494]224raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]225        $(CFACOMPILE_SYNTAX) -DERR2
226        -cp $(test) $(abspath ${@})
[e16797c]227
[5715d43]228# Exception Tests
229# Test with libcfathread; it changes how storage works.
230
231exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
232        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
233        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
234
[673eb7a]235# Linking tests
236# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
237linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
238        $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
239        $(CFACCLINK)  -O0 ${@}.o -o $(abspath ${@})
[a951171]240        rm $(abspath ${@}).o
[673eb7a]241
[34e1494]242#------------------------------------------------------------------------------
243# Other targets
Note: See TracBrowser for help on using the repository browser.