source: tests/Makefile.am @ fd5d251

Last change on this file since fd5d251 was 6a6e205, checked in by Michael Brooks <mlbrooks@…>, 8 days ago

Clean some warnings from unused variables and pointer-to-int casts.

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