source: tests/Makefile.am @ d3d54b3

Last change on this file since d3d54b3 was 92aeae1, checked in by Michael Brooks <mlbrooks@…>, 2 months ago

Correct spelling mistake in variables

  • Property mode set to 100644
File size: 13.1 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 Feb  1 08:20:27 2025
14## Update Count     : 201
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}"}
29GLOBAL_TIMEOUT = ${if ${global-timeout},"--global-timeout=${global-timeout}"}
30ARCHIVE_ERRORS = ${if ${archive-errors},"--archive-errors=${archive-errors}"}
31
32DEBUG_FLAGS = -debug -g -O0
33
34quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
35
36TEST_PY = python3 ${builddir}/test.py
37
38WFLAGS_STRICT = \
39        -Wall \
40        -Wextra \
41        -Werror
42
43WFLAGS_LAX = \
44        -Wall \
45        -Werror=return-type \
46        -Wno-unused-function \
47        -Wno-psabi
48
49# These tests opt for lax wflags.  (By default, new tests get strict wflags.)
50# Indented list entries are finer-grained targets under the test.
51# Making this association implicit would be ideal, but requires learning more automake than is affordable.
52WFLAGS_OPT_LAX = \
53        ${WFLAGS_OPT_LAX_EXPECT_WARN} \
54        ${WFLAGS_OPT_LAX_TO_INVESTIGATE}
55
56# Tests checking that cfa-cc raises a certain warning, so -Werror is permanently inappropriate
57WFLAGS_OPT_LAX_EXPECT_WARN = \
58        attr-priority \
59        ctrl-flow/loop_else-WRN1 \
60        warnings/self-assignment
61
62# Tests that need investigation from the CFA team about why they require lax wflags.  Goal is to eliminate this list.
63WFLAGS_OPT_LAX_TO_INVESTIGATE = \
64        collections/vector-demo \
65        concurrency/actors/dynamic \
66        concurrency/actors/executor \
67        concurrency/actors/inherit \
68        concurrency/actors/inline \
69        concurrency/actors/matrixMultiply \
70        concurrency/actors/pingpong \
71        concurrency/actors/poison \
72        concurrency/actors/static \
73        concurrency/actors/types \
74        concurrency/channels/churn \
75        concurrency/channels/contend \
76        concurrency/channels/daisy_chain \
77        concurrency/channels/hot_potato \
78        concurrency/channels/pub_sub \
79        concurrency/futures/multi \
80        concurrency/futures/select_future \
81        concurrency/futures/typed \
82        concurrency/lockfree_stack \
83        concurrency/pthread/bounded_buffer \
84        concurrency/pthread/pthread_attr_test \
85        concurrency/pthread/pthread_demo_create_join \
86        concurrency/pthread/pthread_demo_lock \
87        concurrency/pthread/pthread_key_test \
88        concurrency/waituntil/all_types \
89        concurrency/waituntil/basic_else \
90        concurrency/waituntil/channel_close \
91        concurrency/waituntil/channels \
92        concurrency/waituntil/futures \
93        concurrency/waituntil/locks \
94        concurrency/waituntil/repeat_close \
95        concurrency/waituntil/timeout \
96        exceptions/cardgame \
97        exceptions/defaults \
98        exceptions/defaults-threads \
99        exceptions/try-leave-catch \
100        forall \
101        include/includes \
102        include/stdincludes \
103        include/vector-collections \
104        include/vector-fstream \
105        include/vector-sequence \
106        io/away_fair \
107        io/comp_basic \
108        io/comp_fair \
109        io/manipulatorsInput \
110        io/manipulatorsInput-uchunk \
111        io/many_read \
112        raii/ctor-autogen \
113        raii/dtor-early-exit \
114        raii/init_once \
115        references \
116        tuple/tupleCast \
117        tuple/tupleMember
118
119WFLAGS=${if ${filter ${WFLAGS_OPT_LAX},${@}},${WFLAGS_LAX},${WFLAGS_STRICT}}
120
121# applies to both programs
122# since automake doesn't have support for CFA we have to
123AM_CFLAGS = ${if ${test}, 2> ${test}, } \
124        -fdebug-prefix-map=${abspath ${abs_srcdir}}= \
125        -fdebug-prefix-map=/tmp= \
126        -fno-diagnostics-show-caret \
127        -g \
128        $(WFLAGS) \
129        -quiet @CFA_FLAGS@
130
131AM_CFAFLAGS = -XCFA --deterministic-out
132
133# get the desired cfa to test
134TARGET_CFA = ${if ${filter ${installed},yes}, @CFACC_INSTALL@, @CFACC@}
135
136# adjust CC to current flags
137CC = LC_ALL=C ${if ${DISTCC_CFA_PATH},distcc ${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
138CFACC = ${CC}
139
140# get local binary for depedencies
141CFACCBIN = @CFACC@
142
143# adjusted CC but without the actual distcc call
144CFACCLOCAL = ${if ${DISTCC_CFA_PATH},${DISTCC_CFA_PATH} ${ARCH_FLAGS} ,${TARGET_CFA} ${DEBUG_FLAGS} ${ARCH_FLAGS}}
145CFACCLINK = ${CFACCLOCAL} -quiet ${if ${test}, 2> ${test}, } ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}}
146
147PRETTY_PATH = mkdir -p ${dir ${abspath ${@}}} && cd ${srcdir} &&
148
149.PHONY : concurrency list .validate .test_makeflags
150.INTERMEDIATE : .validate .validate.cfa .test_makeflags
151EXTRA_PROGRAMS = array-collections/boxed avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install
152EXTRA_DIST = test.py \
153        pybin/__init__.py \
154        pybin/print-core.gdb \
155        pybin/settings.py \
156        pybin/test_run.py \
157        pybin/tools.py \
158        long_tests.hfa \
159        array-collections/boxed.hfa \
160        array-collections/boxed.cases.hfa \
161        avltree/avl-private.h \
162        avltree/avl.h \
163        exceptions/except-io.hfa \
164        exceptions/with-threads.hfa \
165        meta/fork+exec.hfa \
166        concurrency/clib_tls.c \
167        concurrency/clib.c \
168        concurrency/unified_locking/mutex_test.hfa \
169        concurrency/channels/parallel_harness.hfa \
170        array-collections/dimexpr-match.hfa \
171        array-collections/dimexpr-match-detail.sh \
172        array-collections/array-raii.hfa
173
174dist-hook:
175        echo "Gathering test files"
176        for file in `${TEST_PY} --list-dist`; do \
177                if ls ${srcdir}/$${file} > /dev/null 2>&1; then \
178                        ${MKDIR_P} $$(dirname ${distdir}/$${file}); \
179                        cp -df ${srcdir}/$${file} $$(dirname ${distdir}/$${file}); \
180                fi; \
181        done
182
183array_collections_boxed_SOURCES = array-collections/boxed.main.cfa array-collections/boxed.bookend.cfa
184avl_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
185linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
186linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
187# automake doesn't know we still need C/CPP rules so pretend like we have a C program
188nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
189
190#----------------------------------------------------------------------------------------------------------------
191
192# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
193all-local : # This name is important to automake and implies the default build target.
194        @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} --all
195
196tests : all-local # synonym
197
198install : all-local  # synonym, PAB only
199
200quick :
201        @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${ARCH} ${quick_test}
202
203concurrency :
204        @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} -Iconcurrency
205
206list :
207        @+${TEST_PY} --list
208
209help :
210        @echo "user targets:"
211        @echo "    Run the complete test suite."
212        @echo "    $$ make (null) / tests [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]"
213        @echo ""
214        @echo "    Run the short (quick) test suite."
215        @echo "    $$ make quick [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [arch=${arch_support}]"
216        @echo ""
217        @echo "    Run the concurrency test suite."
218        @echo "    $$ make concurrency [debug=yes/no] [installed=yes/no] [archive-errors=dump-dir] [timeout=seconds] [global-timeout=seconds] [arch=${arch_support}]"
219        @echo ""
220        @echo "    List all tests in the test suite."
221        @echo "    $$ make list"
222
223mostlyclean-local :
224        find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
225        find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
226        find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
227        rm -f ${EXTRA_PROGRAMS}
228        rm -rf __pycache__
229
230distclean-local :
231        find ${builddir} -path '*.Po' -delete
232
233.test_makeflags:
234        @echo "${MAKEFLAGS}"
235
236.validate: .validate.cfa
237        ${CFACOMPILE} .validate.cfa -fsyntax-only -Wall -Wextra -Werror
238
239.validate.cfa:
240        @echo "int main() { return 0; }" > ${@}
241
242# automake doesn't know we still need C rules so pretend like we have a C program
243.dummy_hack.c:
244        @echo "int main() { return 0; }" > ${@}
245
246.dummy_hackxx.cpp:
247        @echo "int bar() { return 0; }" > ${@}
248
249#----------------------------------------------------------------------------------------------------------------
250
251# Use for all tests, make sure the path are correct and all flags are added
252CFACOMPILETEST=${PRETTY_PATH} ${CFACOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} ${${shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'}}
253
254#----------------------------------------------------------------------------------------------------------------
255
256# implicit rule so not all test require a rule
257# split into two steps to support compiling remotely using distcc
258# don't use distcc to do the linking because distcc doesn't do linking
259% : %.cfa ${CFACCBIN}
260        ${CFACOMPILETEST} -c -o ${abspath ${@}}.o -DIN_DIR="${abspath ${dir ${<}}}/.in/"
261        ${CFACCLINK} ${@}.o -o ${abspath ${@}}
262        rm ${abspath ${@}}.o
263
264# implicit rule for c++ test
265# convient for testing the testsuite itself but not actuall used
266% : %.cpp
267        ${PRETTY_PATH} ${CXXCOMPILE} ${shell realpath --relative-to=${srcdir} ${<}} -o ${abspath ${@}}
268
269#------------------------------------------------------------------------------
270# TARGETS WITH CUSTOM FLAGS
271#------------------------------------------------------------------------------
272# custom libs
273gmp_FLAGSLD= -lgmp
274
275#------------------------------------------------------------------------------
276# Generated code
277GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
278${GENERATED_CODE} : % : %.cfa ${CFACCBIN}
279        ${CFACOMPILETEST} -CFA -XCFA -p -c -fsyntax-only -o ${abspath ${@}}
280
281#------------------------------------------------------------------------------
282# CUSTOM TARGET
283#------------------------------------------------------------------------------
284# tests that just validate syntax and compiler output should be compared to stderr
285CFACOMPILE_SYNTAX = ${CFACOMPILETEST} -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o ${abspath ${@}}
286
287SYNTAX_ONLY_CODE = attr-priority warnings/self-assignment
288
289${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
290        ${CFACOMPILE_SYNTAX}
291        ${if ${test}, cp ${test} ${abspath ${@}}, }
292
293# expected failures
294# use custom target since they require a custom define *and* have a name that doesn't match the file
295
296array-ERR1 : array.cfa ${CFACCBIN}
297        ${CFACOMPILE_SYNTAX} -DERR1
298        -cp ${test} ${abspath ${@}}
299
300array-ERR2 : array.cfa ${CFACCBIN}
301        ${CFACOMPILE_SYNTAX} -DERR2
302        -cp ${test} ${abspath ${@}}
303
304array-ERR3 : array.cfa ${CFACCBIN}
305        ${CFACOMPILE_SYNTAX} -DERR3
306        -cp ${test} ${abspath ${@}}
307
308array-collections/dimexpr-match-c-ERRS : array-collections/dimexpr-match-c.cfa
309        ${CFACOMPILE_SYNTAX} -DERRS
310        -cp ${test} ${abspath ${@}}
311
312array-collections/dimexpr-match-cfa-ERRS : array-collections/dimexpr-match-cfa.cfa
313        ${CFACOMPILE_SYNTAX} -DERRS
314        -cp ${test} ${abspath ${@}}
315
316alloc-ERROR : alloc.cfa ${CFACCBIN}
317        ${CFACOMPILE_SYNTAX} -DERR1
318        -cp ${test} ${abspath ${@}}
319
320init1-ERROR : init1.cfa ${CFACCBIN}
321        ${CFACOMPILE_SYNTAX} -DERR1
322        -cp ${test} ${abspath ${@}}
323
324typedefRedef-ERR1 : typedefRedef.cfa ${CFACCBIN}
325        ${CFACOMPILE_SYNTAX} -DERR1
326        -cp ${test} ${abspath ${@}}
327
328nested-types-ERR1 : nested-types.cfa ${CFACCBIN}
329        ${CFACOMPILE_SYNTAX} -DERR1
330        -cp ${test} ${abspath ${@}}
331
332nested-types-ERR2 : nested-types.cfa ${CFACCBIN}
333        ${CFACOMPILE_SYNTAX} -DERR2
334        -cp ${test} ${abspath ${@}}
335
336raii/memberCtors-ERR1 : raii/memberCtors.cfa ${CFACCBIN}
337        ${CFACOMPILE_SYNTAX} -DERR1
338        -cp ${test} ${abspath ${@}}
339
340raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa ${CFACCBIN}
341        ${CFACOMPILE_SYNTAX} -DERR1
342        -cp ${test} ${abspath ${@}}
343
344raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa ${CFACCBIN}
345        ${CFACOMPILE_SYNTAX} -DERR1
346        -cp ${test} ${abspath ${@}}
347
348raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa ${CFACCBIN}
349        ${CFACOMPILE_SYNTAX} -DERR2
350        -cp ${test} ${abspath ${@}}
351
352raii/partial-ERR1 : raii/partial.cfa ${CFACCBIN}
353        ${CFACOMPILE_SYNTAX} -DERR1
354        -cp ${test} ${abspath ${@}}
355
356zero_one-ERR1 : zero_one.cfa ${CFACCBIN}
357        ${CFACOMPILE_SYNTAX} -DERR1
358        -cp ${test} ${abspath ${@}}
359
360ctrl-flow/loop_else : ctrl-flow/loop_else.cfa ${CFACCBIN}
361        ${CC} ${AM_CFLAGS} -Wno-superfluous-else $< -o $@
362
363ctrl-flow/loop_else-WRN1 : ctrl-flow/loop_else.cfa ${CFACCBIN}
364        ${CFACOMPILE_SYNTAX} -DERR1
365        -cp ${test} ${abspath ${@}}
366
367# Exception Tests
368# Test with libcfathread; it changes how storage works.
369
370exceptions/%-threads : exceptions/%.cfa ${CFACCBIN}
371        ${CFACOMPILETEST} -include exceptions/with-threads.hfa -c -o ${abspath ${@}}.o
372        ${CFACCLOCAL} ${${shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'}} ${abspath ${@}}.o -o ${abspath ${@}}
373
374# Linking tests
375# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
376linking/linkerror : linking/linkerror.cfa ${CFACCBIN}
377        ${CFACOMPILETEST} -O0 -c -o ${abspath ${@}}.o
378        ${CFACCLINK}  -O0 ${@}.o -o ${abspath ${@}}
379        rm ${abspath ${@}}.o
380
381#------------------------------------------------------------------------------
382# Other targets
Note: See TracBrowser for help on using the repository browser.