source: tests/Makefile.am@ 7c2c37a

ADT ast-experimental
Last change on this file since 7c2c37a was 0922716, checked in by caparsons <caparson@…>, 2 years ago

changed dist-hook rule to use curly braces to access shell vars where it should use them instead of parens

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