source: tests/Makefile.am @ 34e1494

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since 34e1494 was 34e1494, checked in by Thierry Delisle <tdelisle@…>, 2 years ago

Clean up test make file and add autodetection of number of hosts by test.py

  • Property mode set to 100644
File size: 6.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)/src/cfa.make
21
22debug=yes
23installed=no
24archiveerrors=
25
26INSTALL_FLAGS=-in-tree
27DEBUG_FLAGS=-debug -O0
28
29quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
30
31concurrent=
32timeouts=
33
34TEST_PY = python3 ${builddir}/test.py
35
36# applies to both programs
37# since automake doesn't have support for CFA we have to
38AM_CFLAGS = $(if $(test), 2> $(test), ) \
39        -g \
40        -Wall \
41        -Wno-unused-function \
42        -quiet @CFA_FLAGS@ \
43        -DIN_DIR="${abs_srcdir}/.in/"
44
45# adjust CC to current flags
46CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
47CFACC = $(CC)
48
49# get local binary for depedencies
50CFACCBIN = @CFACC@
51
52# adjusted CC but without the actual distcc call
53CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
54
55PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
56
57.PHONY: list .validate
58.INTERMEDIATE: .validate .validate.cfa
59EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
60
61avl_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
62# automake doesn't know we still need C/CPP rules so pretend like we have a C program
63_dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
64
65#----------------------------------------------------------------------------------------------------------------
66all-local :
67        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
68
69all-tests :
70        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
71
72clean-local :
73        rm -f ${EXTRA_PROGRAMS}
74
75list :
76        @+${TEST_PY} --list ${concurrent}
77
78.validate: .validate.cfa
79        $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
80
81.validate.cfa:
82        @echo "int main() { return 0; }" > ${@}
83
84# automake doesn't know we still need C rules so pretend like we have a C program
85.dummy_hack.c:
86        @echo "int main() { return 0; }" > ${@}
87
88.dummy_hackxx.cpp:
89        @echo "int bar() { return 0; }" > ${@}
90
91concurrency :
92        @+${TEST_PY} --debug=${debug}  --install=${installed} -Iconcurrent
93
94#----------------------------------------------------------------------------------------------------------------
95
96# Use for all tests, make sure the path are correct and all flags are added
97CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g'))
98
99#----------------------------------------------------------------------------------------------------------------
100
101# implicit rule so not all test require a rule
102# split into two steps to support compiling remotely using distcc
103# don't use distcc to do the linking because distcc doesn't do linking
104% : %.cfa $(CFACCBIN)
105        $(CFACOMPILETEST) -c -o $(abspath ${@}).o
106        $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
107
108# implicit rule for c++ test
109# convient for testing the testsuite itself but not actuall used
110% : %.cpp
111        $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
112
113#------------------------------------------------------------------------------
114# TARGETS WITH CUSTOM FLAGS
115#------------------------------------------------------------------------------
116# custom libs
117gmp_FLAGSLD= -lgmp
118
119#------------------------------------------------------------------------------
120# Generated code
121GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
122$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
123        $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@})
124
125# Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr
126EXPECT_STDERR = builtins/sync warnings/self-assignment
127$(EXPECT_STDERR): % : %.cfa $(CFACCBIN)
128        $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@})
129
130#------------------------------------------------------------------------------
131# CUSTOM TARGET
132#------------------------------------------------------------------------------
133# expected failures
134# use custom target since they require a custom define and custom dependencies
135alloc-ERROR : alloc.cfa $(CFACCBIN)
136        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
137
138typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
139        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
140
141nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
142        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
143
144nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
145        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
146
147raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
148        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
149
150raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
151        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
152
153raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
154        $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@})
155
156raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
157        $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
158
159#------------------------------------------------------------------------------
160# Other targets
Note: See TracBrowser for help on using the repository browser.