source: tests/Makefile.am @ aff7e86

arm-ehenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since aff7e86 was aff7e86, checked in by Andrew Beach <ajbeach@…>, 19 months ago

Added a new attribute 'cfa_linkonce'.

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