source: tests/Makefile.am @ 74cfe054

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

Change default include for tests to no longer have the top build_dir

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