source: tests/Makefile.am @ 08ce416

arm-ehjacob/cs343-translationnew-ast-unique-expr
Last change on this file since 08ce416 was 08ce416, checked in by Thierry Delisle <tdelisle@…>, 10 months ago

Changed configure to use new-ast by default.
Ast options no longer pushed to libcfa (that didn't make sense).
Long Run tests and benchmark no longer distributed.
Added missing source to distribution.
Added pybin to distribution.

  • Property mode set to 100644
File size: 7.4 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 Oct  9 23:13:07 2020
14## Update Count     : 86
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 -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        -quiet @CFA_FLAGS@ \
47        -DIN_DIR="${abs_srcdir}/.in/"
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 .dummy_hack # build but do not install
70EXTRA_DIST = pybin
71
72avl_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
73# automake doesn't know we still need C/CPP rules so pretend like we have a C program
74nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
75
76#----------------------------------------------------------------------------------------------------------------
77all-local :
78        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
79
80all-tests :
81        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
82
83clean-local :
84        rm -f ${EXTRA_PROGRAMS}
85
86list :
87        @+${TEST_PY} --list ${concurrent}
88
89.validate: .validate.cfa
90        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
91
92.validate.cfa:
93        @echo "int main() { return 0; }" > ${@}
94
95# automake doesn't know we still need C rules so pretend like we have a C program
96.dummy_hack.c:
97        @echo "int main() { return 0; }" > ${@}
98
99.dummy_hackxx.cpp:
100        @echo "int bar() { return 0; }" > ${@}
101
102concurrency :
103        @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
104
105#----------------------------------------------------------------------------------------------------------------
106
107# Use for all tests, make sure the path are correct and all flags are added
108CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
109
110#----------------------------------------------------------------------------------------------------------------
111
112# implicit rule so not all test require a rule
113# split into two steps to support compiling remotely using distcc
114# don't use distcc to do the linking because distcc doesn't do linking
115% : %.cfa $(CFACCBIN)
116        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
117        $(CFACCLINK) ${@}.o -o $(abspath ${@})
118        rm $(abspath ${@}).o
119
120# implicit rule for c++ test
121# convient for testing the testsuite itself but not actuall used
122% : %.cpp
123        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
124
125#------------------------------------------------------------------------------
126# TARGETS WITH CUSTOM FLAGS
127#------------------------------------------------------------------------------
128# custom libs
129gmp_FLAGSLD= -lgmp
130
131#------------------------------------------------------------------------------
132# Generated code
133GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
134$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
135        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
136
137#------------------------------------------------------------------------------
138# CUSTOM TARGET
139#------------------------------------------------------------------------------
140# tests that just validate syntax and compiler output should be compared to stderr
141CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@})
142
143SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \
144        init1 limits nested-types stdincludes cast labelledExit array builtins/sync warnings/self-assignment
145$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
146        $(CFACOMPILE_SYNTAX)
147        $(if $(test), cp $(test) $(abspath ${@}), )
148
149# expected failures
150# use custom target since they require a custom define *and* have a name that doesn't match the file
151alloc-ERROR : alloc.cfa $(CFACCBIN)
152        $(CFACOMPILE_SYNTAX) -DERR1
153        -cp $(test) $(abspath ${@})
154
155init1-ERROR : init1.cfa $(CFACCBIN)
156        $(CFACOMPILE_SYNTAX) -DERR1
157        -cp $(test) $(abspath ${@})
158
159typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
160        $(CFACOMPILE_SYNTAX) -DERR1
161        -cp $(test) $(abspath ${@})
162
163nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
164        $(CFACOMPILE_SYNTAX) -DERR1
165        -cp $(test) $(abspath ${@})
166
167nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
168        $(CFACOMPILE_SYNTAX) -DERR2
169        -cp $(test) $(abspath ${@})
170
171raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
172        $(CFACOMPILE_SYNTAX) -DERR1
173        -cp $(test) $(abspath ${@})
174
175raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
176        $(CFACOMPILE_SYNTAX) -DERR1
177        -cp $(test) $(abspath ${@})
178
179raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
180        $(CFACOMPILE_SYNTAX) -DERR1
181        -cp $(test) $(abspath ${@})
182
183raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
184        $(CFACOMPILE_SYNTAX) -DERR2
185        -cp $(test) $(abspath ${@})
186
187# Exception Tests
188# Test with libcfathread; it changes how storage works.
189
190exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
191        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
192        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
193
194# Linking tests
195# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
196linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
197        $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
198        $(CFACCLINK)  -O0 ${@}.o -o $(abspath ${@})
199        rm $(abspath ${@}).o
200
201#------------------------------------------------------------------------------
202# Other targets
Note: See TracBrowser for help on using the repository browser.