source: tests/Makefile.am @ a32a887

ADTast-experimental
Last change on this file since a32a887 was c083c3d, checked in by Peter A. Buhr <pabuhr@…>, 18 months ago

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

  • 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
110avl_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
111linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
112linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
113# automake doesn't know we still need C/CPP rules so pretend like we have a C program
114nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
115
116#----------------------------------------------------------------------------------------------------------------
117
118all-local : # This name is important to automake and implies the default build target.
119        @+$(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
120
121install : all-local # PAB only
122
123tests : all-local
124
125quick :
126        @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) $(quick_test)
127
128mostlyclean-local :
129        find $(builddir) -not -path './__pycache__/*' -path '*.o' -delete
130        find $(builddir) -not -path './__pycache__/*' -path '*/.err/*.log' -delete
131        find $(builddir) -not -path './__pycache__/*' -path '*/.out/*.log' -delete
132        rm -f $(EXTRA_PROGRAMS)
133        rm -rf __pycache__
134
135distclean-local :
136        find $(builddir) -path '*.Po' -delete
137
138list :
139        @+$(TEST_PY) --list $(concurrent)
140
141.test_makeflags:
142        @echo "$(MAKEFLAGS)"
143
144.validate: .validate.cfa
145        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
146
147.validate.cfa:
148        @echo "int main() { return 0; }" > $(@)
149
150# automake doesn't know we still need C rules so pretend like we have a C program
151.dummy_hack.c:
152        @echo "int main() { return 0; }" > $(@)
153
154.dummy_hackxx.cpp:
155        @echo "int bar() { return 0; }" > $(@)
156
157concurrency :
158        @+$(TEST_PY) --debug=$(debug)  --install=$(installed) -Iconcurrent
159
160#----------------------------------------------------------------------------------------------------------------
161
162# Use for all tests, make sure the path are correct and all flags are added
163CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) $($(shell echo "$(@)_FLAGSCFA" | sed 's/-\|\//_/g'))
164
165#----------------------------------------------------------------------------------------------------------------
166
167# implicit rule so not all test require a rule
168# split into two steps to support compiling remotely using distcc
169# don't use distcc to do the linking because distcc doesn't do linking
170% : %.cfa $(CFACCBIN)
171        $(CFACOMPILETEST) -c -o $(abspath $(@)).o -DIN_DIR="$(abspath $(dir $(<)))/.in/"
172        $(CFACCLINK) $(@).o -o $(abspath $(@))
173        rm $(abspath $(@)).o
174
175# implicit rule for c++ test
176# convient for testing the testsuite itself but not actuall used
177% : %.cpp
178        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) -o $(abspath $(@))
179
180#------------------------------------------------------------------------------
181# TARGETS WITH CUSTOM FLAGS
182#------------------------------------------------------------------------------
183# custom libs
184gmp_FLAGSLD= -lgmp
185
186#------------------------------------------------------------------------------
187# Generated code
188GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
189$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
190        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath $(@))
191
192#------------------------------------------------------------------------------
193# CUSTOM TARGET
194#------------------------------------------------------------------------------
195# tests that just validate syntax and compiler output should be compared to stderr
196CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath $(@))
197
198SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
199        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
200$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
201        $(CFACOMPILE_SYNTAX)
202        $(if $(test), cp $(test) $(abspath $(@)), )
203
204# expected failures
205# use custom target since they require a custom define *and* have a name that doesn't match the file
206alloc-ERROR : alloc.cfa $(CFACCBIN)
207        $(CFACOMPILE_SYNTAX) -DERR1
208        -cp $(test) $(abspath $(@))
209
210init1-ERROR : init1.cfa $(CFACCBIN)
211        $(CFACOMPILE_SYNTAX) -DERR1
212        -cp $(test) $(abspath $(@))
213
214typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
215        $(CFACOMPILE_SYNTAX) -DERR1
216        -cp $(test) $(abspath $(@))
217
218nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
219        $(CFACOMPILE_SYNTAX) -DERR1
220        -cp $(test) $(abspath $(@))
221
222nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
223        $(CFACOMPILE_SYNTAX) -DERR2
224        -cp $(test) $(abspath $(@))
225
226raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
227        $(CFACOMPILE_SYNTAX) -DERR1
228        -cp $(test) $(abspath $(@))
229
230raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
231        $(CFACOMPILE_SYNTAX) -DERR1
232        -cp $(test) $(abspath $(@))
233
234raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
235        $(CFACOMPILE_SYNTAX) -DERR1
236        -cp $(test) $(abspath $(@))
237
238raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
239        $(CFACOMPILE_SYNTAX) -DERR2
240        -cp $(test) $(abspath $(@))
241
242# Exception Tests
243# Test with libcfathread; it changes how storage works.
244
245exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
246        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath $(@)).o
247        $(CFACCLOCAL) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath $(@)).o -o $(abspath $(@))
248
249# Linking tests
250# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
251linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
252        $(CFACOMPILETEST) -O0 -c -o $(abspath $(@)).o
253        $(CFACCLINK)  -O0 $(@).o -o $(abspath $(@))
254        rm $(abspath $(@)).o
255
256#------------------------------------------------------------------------------
257# Other targets
Note: See TracBrowser for help on using the repository browser.