source: tests/Makefile.am @ b44959f

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

Test with multiple threads reading the same file at once.

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