source: tests/Makefile.am @ bdbf536

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

remove/specialize test/Makfile.am variables concurrent/timeout, respectively

  • Property mode set to 100644
File size: 9.8 KB
Line 
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
13## Last Modified On : Sat May 27 18:27:08 2023
14## Update Count     : 190
15###############################################################################
16
17AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
18ACLOCAL_AMFLAGS  = -I automake
19
20include $(top_srcdir)/tools/build/cfa.make
21
22DEFAULT_INCLUDES = -I${abs_srcdir}
23
24debug ?= yes
25installed ?= no
26ARCH = ${if ${arch},"--arch=${arch}"}
27arch_support = "x86/x64/arm"
28TIMEOUT = ${if ${timeout},"--timeout=${timeout}"}
29DEBUG_FLAGS = -debug -g -O0
30
31quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
32
33archiveerrors=
34
35TEST_PY = python3 ${builddir}/test.py
36
37# applies to both programs
38# since automake doesn't have support for CFA we have to
39AM_CFLAGS = ${if ${test}, 2> ${test}, } \
40        -fdebug-prefix-map=${abspath ${abs_srcdir}}= \
41        -fdebug-prefix-map=/tmp= \
42        -fno-diagnostics-show-caret \
43        -g \
44        -Wall \
45        -Werror=return-type \
46        -Wno-unused-function \
47        -Wno-psabi \
48        -quiet @CFA_FLAGS@
49
50AM_CFAFLAGS = -XCFA --deterministic-out
51
52# get the desired cfa to test
53TARGET_CFA = ${if ${filter ${installed},yes}, @CFACC_INSTALL@, @CFACC@}
54
55# adjust CC to current flags
56CC = LC_ALL=C ${if ${DISTCC_CFA_PATH},distcc ${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
57CFACC = ${CC}
58
59# get local binary for depedencies
60CFACCBIN = @CFACC@
61
62# adjusted CC but without the actual distcc call
63CFACCLOCAL = ${if ${DISTCC_CFA_PATH},${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
64CFACCLINK = ${CFACCLOCAL} -quiet ${if ${test}, 2> ${test}, } ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}}
65
66PRETTY_PATH = mkdir -p ${dir ${abspath ${@}}} && cd ${srcdir} &&
67
68.PHONY : concurrency list .validate .test_makeflags
69.INTERMEDIATE : .validate .validate.cfa .test_makeflags
70EXTRA_PROGRAMS = avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install
71EXTRA_DIST = test.py \
72        pybin/__init__.py \
73        pybin/print-core.gdb \
74        pybin/settings.py \
75        pybin/test_run.py \
76        pybin/tools.py \
77        long_tests.hfa \
78        avltree/avl-private.h \
79        avltree/avl.h \
80        configs/.in/parseconfig-all.txt \
81        configs/.in/parseconfig-errors.txt \
82        configs/.in/parseconfig-missing.txt \
83        exceptions/except-io.hfa \
84        exceptions/with-threads.hfa \
85        io/.in/io.data \
86        io/.in/many_read.data \
87        meta/fork+exec.hfa \
88        concurrency/clib_tls.c \
89        concurrency/clib.c \
90        concurrency/unified_locking/mutex_test.hfa \
91        concurrency/channels/parallel_harness.hfa
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
101
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
103linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
104linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
105# automake doesn't know we still need C/CPP rules so pretend like we have a C program
106nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
107
108#----------------------------------------------------------------------------------------------------------------
109
110all-local : # This name is important to automake and implies the default build target.
111        @+${TEST_PY} --debug=${debug} --install=${installed} --invariant --archive-errors=${archiveerrors} ${TIMEOUT} ${ARCH} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
112
113install : all-local # PAB only
114
115tests : all-local
116
117quick :
118        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${ARCH} ${quick_test}
119
120concurrency :
121        @+${TEST_PY} --debug=${debug} --install=${installed} ${TIMEOUT} ${ARCH} -Iconcurrency
122
123list :
124        @+${TEST_PY} --list
125
126help :
127        @echo "user targets:"
128        @echo "    Run the complete test suite."
129        @echo "    $$ make (null) / tests [debug=yes/no] [installed=yes/no] [timeout=integer-seconds] [arch=${arch_support}]"
130        @echo ""
131        @echo "    Run the short (quick) test suite."
132        @echo "    $$ make quick [debug=yes/no] [installed=yes/no] [arch=${arch_support}]"
133        @echo ""
134        @echo "    Run the concurrency test suite."
135        @echo "    $$ make concurrency [debug=yes/no] [installed=yes/no] [timeout=integer-seconds] [arch=${arch_support}]"
136        @echo ""
137        @echo "    List all tests in the test suite."
138        @echo "    $$ make list"
139
140mostlyclean-local :
141        find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
142        find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
143        find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
144        rm -f ${EXTRA_PROGRAMS}
145        rm -rf __pycache__
146
147distclean-local :
148        find ${builddir} -path '*.Po' -delete
149
150.test_makeflags:
151        @echo "${MAKEFLAGS}"
152
153.validate: .validate.cfa
154        ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror
155
156.validate.cfa:
157        @echo "int main() { return 0; }" > ${@}
158
159# automake doesn't know we still need C rules so pretend like we have a C program
160.dummy_hack.c:
161        @echo "int main() { return 0; }" > ${@}
162
163.dummy_hackxx.cpp:
164        @echo "int bar() { return 0; }" > ${@}
165
166#----------------------------------------------------------------------------------------------------------------
167
168# Use for all tests, make sure the path are correct and all flags are added
169CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}}
170
171#----------------------------------------------------------------------------------------------------------------
172
173# implicit rule so not all test require a rule
174# split into two steps to support compiling remotely using distcc
175# don't use distcc to do the linking because distcc doesn't do linking
176% : %.cfa ${CFACCBIN}
177        ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/"
178        ${CFACCLINK} ${@}.o -o ${abspath ${@}}
179        rm ${abspath ${@}}.o
180
181# implicit rule for c++ test
182# convient for testing the testsuite itself but not actuall used
183% : %.cpp
184        ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}}
185
186#------------------------------------------------------------------------------
187# TARGETS WITH CUSTOM FLAGS
188#------------------------------------------------------------------------------
189# custom libs
190gmp_FLAGSLD= -lgmp
191
192#------------------------------------------------------------------------------
193# Generated code
194GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
195${GENERATED_CODE} : % : %.cfa ${CFACCBIN}
196        ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}}
197
198#------------------------------------------------------------------------------
199# CUSTOM TARGET
200#------------------------------------------------------------------------------
201# tests that just validate syntax and compiler output should be compared to stderr
202CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}}
203
204SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
205        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrency/waitfor/parse
206${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
207        ${CFACOMPILE_SYNTAX}
208        ${if ${test}, cp ${test} ${abspath ${@}}, }
209
210# expected failures
211# use custom target since they require a custom define *and* have a name that doesn't match the file
212
213array-ERR1 : array.cfa ${CFACCBIN}
214        ${CFACOMPILE_SYNTAX} -DERR1
215        -cp ${test} ${abspath ${@}}
216
217array-ERR2 : array.cfa ${CFACCBIN}
218        ${CFACOMPILE_SYNTAX} -DERR2
219        -cp ${test} ${abspath ${@}}
220
221array-ERR3 : array.cfa ${CFACCBIN}
222        ${CFACOMPILE_SYNTAX} -DERR3
223        -cp ${test} ${abspath ${@}}
224
225alloc-ERROR : alloc.cfa ${CFACCBIN}
226        ${CFACOMPILE_SYNTAX} -DERR1
227        -cp ${test} ${abspath ${@}}
228
229init1-ERROR : init1.cfa ${CFACCBIN}
230        ${CFACOMPILE_SYNTAX} -DERR1
231        -cp ${test} ${abspath ${@}}
232
233typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN}
234        ${CFACOMPILE_SYNTAX} -DERR1
235        -cp ${test} ${abspath ${@}}
236
237nested-types-ERR1 : nested-types.cfa ${CFACCBIN}
238        ${CFACOMPILE_SYNTAX} -DERR1
239        -cp ${test} ${abspath ${@}}
240
241nested-types-ERR2 : nested-types.cfa ${CFACCBIN}
242        ${CFACOMPILE_SYNTAX} -DERR2
243        -cp ${test} ${abspath ${@}}
244
245raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN}
246        ${CFACOMPILE_SYNTAX} -DERR1
247        -cp ${test} ${abspath ${@}}
248
249raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN}
250        ${CFACOMPILE_SYNTAX} -DERR1
251        -cp ${test} ${abspath ${@}}
252
253raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN}
254        ${CFACOMPILE_SYNTAX} -DERR1
255        -cp ${test} ${abspath ${@}}
256
257raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN}
258        ${CFACOMPILE_SYNTAX} -DERR2
259        -cp ${test} ${abspath ${@}}
260
261# Exception Tests
262# Test with libcfathread; it changes how storage works.
263
264exceptions/%-threads : exceptions/%.cfa ${CFACCBIN}
265        ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o
266        ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}}
267
268# Linking tests
269# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
270linking/linkerror : linking/linkerror.cfa ${CFACCBIN}
271        ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o
272        ${CFACCLINK}  -O0 ${@}.o -o ${abspath ${@}}
273        rm ${abspath ${@}}.o
274
275#------------------------------------------------------------------------------
276# Other targets
Note: See TracBrowser for help on using the repository browser.