source: tests/Makefile.am @ 8514bcf8

Last change on this file since 8514bcf8 was 0b8c951d, checked in by Peter A. Buhr <pabuhr@…>, 9 months ago

more rename directories containers to collections

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