source: tests/Makefile.am @ 75d874a

ADTast-experimental
Last change on this file since 75d874a was 35d1de5, checked in by Peter A. Buhr <pabuhr@…>, 21 months ago

change test forall.cfa from compilation only to execution

  • Property mode set to 100644
File size: 8.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 : Fri Feb  3 23:06:44 2023
14## Update Count     : 94
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
26archiveerrors=
27
28DEBUG_FLAGS=-debug -g -O0
29
30quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
31
32concurrent=
33timeouts=
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: 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        concurrent/clib_tls.c \
81        concurrent/clib.c \
82        configs/.in/parseconfig-all.txt \
83        configs/.in/parseconfig-errors.txt \
84        configs/.in/parseconfig-missing.txt \
85        exceptions/except-io.hfa \
86        exceptions/with-threads.hfa \
87        io/.in/io.data \
88        io/.in/many_read.data \
89        meta/fork+exec.hfa \
90        concurrent/unified_locking/mutex_test.hfa \
91        concurrent/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#----------------------------------------------------------------------------------------------------------------
109all-local :
110        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
111
112all-tests :
113        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
114
115mostlyclean-local :
116        find ${builddir} -not -path './__pycache__/*' -path '*.o' -delete
117        find ${builddir} -not -path './__pycache__/*' -path '*/.err/*.log' -delete
118        find ${builddir} -not -path './__pycache__/*' -path '*/.out/*.log' -delete
119        rm -f ${EXTRA_PROGRAMS}
120        rm -rf __pycache__
121
122distclean-local :
123        find ${builddir} -path '*.Po' -delete
124
125list :
126        @+${TEST_PY} --list ${concurrent}
127
128.test_makeflags:
129        @echo "${MAKEFLAGS}"
130
131.validate: .validate.cfa
132        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
133
134.validate.cfa:
135        @echo "int main() { return 0; }" > ${@}
136
137# automake doesn't know we still need C rules so pretend like we have a C program
138.dummy_hack.c:
139        @echo "int main() { return 0; }" > ${@}
140
141.dummy_hackxx.cpp:
142        @echo "int bar() { return 0; }" > ${@}
143
144concurrency :
145        @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
146
147#----------------------------------------------------------------------------------------------------------------
148
149# Use for all tests, make sure the path are correct and all flags are added
150CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
151
152#----------------------------------------------------------------------------------------------------------------
153
154# implicit rule so not all test require a rule
155# split into two steps to support compiling remotely using distcc
156# don't use distcc to do the linking because distcc doesn't do linking
157% : %.cfa $(CFACCBIN)
158        $(CFACOMPILETEST) -c -o $(abspath ${@}).o -DIN_DIR="$(abspath $(dir ${<}))/.in/"
159        $(CFACCLINK) ${@}.o -o $(abspath ${@})
160        rm $(abspath ${@}).o
161
162# implicit rule for c++ test
163# convient for testing the testsuite itself but not actuall used
164% : %.cpp
165        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
166
167#------------------------------------------------------------------------------
168# TARGETS WITH CUSTOM FLAGS
169#------------------------------------------------------------------------------
170# custom libs
171gmp_FLAGSLD= -lgmp
172
173#------------------------------------------------------------------------------
174# Generated code
175GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
176$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
177        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
178
179#------------------------------------------------------------------------------
180# CUSTOM TARGET
181#------------------------------------------------------------------------------
182# tests that just validate syntax and compiler output should be compared to stderr
183CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@})
184
185SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
186        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment
187$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
188        $(CFACOMPILE_SYNTAX)
189        $(if $(test), cp $(test) $(abspath ${@}), )
190
191# expected failures
192# use custom target since they require a custom define *and* have a name that doesn't match the file
193alloc-ERROR : alloc.cfa $(CFACCBIN)
194        $(CFACOMPILE_SYNTAX) -DERR1
195        -cp $(test) $(abspath ${@})
196
197init1-ERROR : init1.cfa $(CFACCBIN)
198        $(CFACOMPILE_SYNTAX) -DERR1
199        -cp $(test) $(abspath ${@})
200
201typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
202        $(CFACOMPILE_SYNTAX) -DERR1
203        -cp $(test) $(abspath ${@})
204
205nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
206        $(CFACOMPILE_SYNTAX) -DERR1
207        -cp $(test) $(abspath ${@})
208
209nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
210        $(CFACOMPILE_SYNTAX) -DERR2
211        -cp $(test) $(abspath ${@})
212
213raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
214        $(CFACOMPILE_SYNTAX) -DERR1
215        -cp $(test) $(abspath ${@})
216
217raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
218        $(CFACOMPILE_SYNTAX) -DERR1
219        -cp $(test) $(abspath ${@})
220
221raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
222        $(CFACOMPILE_SYNTAX) -DERR1
223        -cp $(test) $(abspath ${@})
224
225raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
226        $(CFACOMPILE_SYNTAX) -DERR2
227        -cp $(test) $(abspath ${@})
228
229# Exception Tests
230# Test with libcfathread; it changes how storage works.
231
232exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
233        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
234        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
235
236# Linking tests
237# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
238linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
239        $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
240        $(CFACCLINK)  -O0 ${@}.o -o $(abspath ${@})
241        rm $(abspath ${@}).o
242
243#------------------------------------------------------------------------------
244# Other targets
Note: See TracBrowser for help on using the repository browser.