source: tests/Makefile.am @ df2e00f

Last change on this file since df2e00f was afb15cf, checked in by Andrew Beach <ajbeach@…>, 3 months ago

Added a check to make sure that optional parameters to not appear on function types not attached to function declarations.

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