source: tests/Makefile.am @ a951171

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

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

  • Property mode set to 100644
File size: 7.0 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 Nov 20 11:18:51 2018
14## Update Count     : 68
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        -g \
43        -Wall \
44        -Wno-unused-function \
45        -quiet @CFA_FLAGS@ \
46        -DIN_DIR="${abs_srcdir}/.in/"
47
48AM_CFAFLAGS = -XCFA --deterministic-out
49
50# get the desired cfa to test
51TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
52
53# adjust CC to current flags
54CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
55CFACC = $(CC)
56
57# get local binary for depedencies
58CFACCBIN = @CFACC@
59
60# adjusted CC but without the actual distcc call
61CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ${ARCH_FLAGS},$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
62CFACCLINK = $(CFACCLOCAL) $(if $(test), 2> $(test), ) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g'))
63
64PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
65
66.PHONY: list .validate
67.INTERMEDIATE: .validate .validate.cfa
68EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
69
70avl_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
71# automake doesn't know we still need C/CPP rules so pretend like we have a C program
72nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
73
74#----------------------------------------------------------------------------------------------------------------
75all-local :
76        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
77
78all-tests :
79        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
80
81clean-local :
82        rm -f ${EXTRA_PROGRAMS}
83
84list :
85        @+${TEST_PY} --list ${concurrent}
86
87.validate: .validate.cfa
88        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
89
90.validate.cfa:
91        @echo "int main() { return 0; }" > ${@}
92
93# automake doesn't know we still need C rules so pretend like we have a C program
94.dummy_hack.c:
95        @echo "int main() { return 0; }" > ${@}
96
97.dummy_hackxx.cpp:
98        @echo "int bar() { return 0; }" > ${@}
99
100concurrency :
101        @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
102
103#----------------------------------------------------------------------------------------------------------------
104
105# Use for all tests, make sure the path are correct and all flags are added
106CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
107
108#----------------------------------------------------------------------------------------------------------------
109
110# implicit rule so not all test require a rule
111# split into two steps to support compiling remotely using distcc
112# don't use distcc to do the linking because distcc doesn't do linking
113% : %.cfa $(CFACCBIN)
114        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
115        $(CFACCLINK) ${@}.o -o $(abspath ${@})
116        rm $(abspath ${@}).o
117
118# implicit rule for c++ test
119# convient for testing the testsuite itself but not actuall used
120% : %.cpp
121        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
122
123#------------------------------------------------------------------------------
124# TARGETS WITH CUSTOM FLAGS
125#------------------------------------------------------------------------------
126# custom libs
127gmp_FLAGSLD= -lgmp
128
129#------------------------------------------------------------------------------
130# Generated code
131GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
132$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
133        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
134
135# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
136EXPECT_STDERR = builtins/sync warnings/self-assignment
137$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
138        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
139
140#------------------------------------------------------------------------------
141# CUSTOM TARGET
142#------------------------------------------------------------------------------
143# tests that just validate syntax
144expression : expression.cfa $(CFACCBIN)
145        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
146
147# expected failures
148# use custom target since they require a custom define and custom dependencies
149alloc-ERROR : alloc.cfa $(CFACCBIN)
150        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
151
152typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
153        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
154
155nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
156        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
157
158nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
159        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
160
161raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
162        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
163
164raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
165        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
166
167raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
168        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
169
170raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
171        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
172
173# Exception Tests
174# Test with libcfathread; it changes how storage works.
175
176exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
177        $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
178        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
179
180# Linking tests
181# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
182linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
183        $(CFACOMPILETEST) -O0 -c -o $(abspath ${@}).o
184        $(CFACCLINK)  -O0 ${@}.o -o $(abspath ${@})
185        rm $(abspath ${@}).o
186
187#------------------------------------------------------------------------------
188# Other targets
Note: See TracBrowser for help on using the repository browser.