source: tests/Makefile.am@ fece3d9

ADT ast-experimental
Last change on this file since fece3d9 was c083c3d, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

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

  • Property mode set to 100644
File size: 9.2 KB
RevLine 
[ef7d253]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
[c083c3d]13## Last Modified On : Mon May 1 17:25:24 2023
14## Update Count : 145
[ef7d253]15###############################################################################
16
[4daf79f]17# user targets:
18# Run the complete test suite.
19# $ make / tests [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
20#
21# Run the short (quick) test suite.
22# $ make quick [debug=yes/no] [installed=yes/no] [arch=x86/x64/arm]
23
[0c1b566]24AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
[107b01a]25ACLOCAL_AMFLAGS = -I automake
[f85bc15]26
[bcadb26]27include $(top_srcdir)/tools/build/cfa.make
[dc8511c]28
[4daf79f]29DEFAULT_INCLUDES = -I$(abs_srcdir)
[74cfe054]30
[4daf79f]31debug ?= yes
32installed ?= no
33ARCH=$(if $(arch),"--arch=$(arch)")
[dcfedca]34archiveerrors=
[cc640aad]35
[36fbaeca]36DEBUG_FLAGS=-debug -g -O0
[e3a5a73]37
[ff7b2de]38quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes meta/dumpable
[be65cca]39
[0ad0c55]40concurrent=
[b90aace]41timeouts=
[be65cca]42
[4daf79f]43TEST_PY = python3 $(builddir)/test.py
[f85bc15]44
[ef7d253]45# applies to both programs
[d65f92c]46# since automake doesn't have support for CFA we have to
[b8f6002]47AM_CFLAGS = $(if $(test), 2> $(test), ) \
[4daf79f]48 -fdebug-prefix-map=$(abspath $(abs_srcdir))= \
[87fc1b4]49 -fdebug-prefix-map=/tmp= \
[0a19c51]50 -fno-diagnostics-show-caret \
[b8f6002]51 -g \
52 -Wall \
[850aff1]53 -Werror=return-type \
[b8f6002]54 -Wno-unused-function \
[36fbaeca]55 -Wno-psabi \
[b44959f]56 -quiet @CFA_FLAGS@
[7c03d6d]57
[7215000]58AM_CFAFLAGS = -XCFA --deterministic-out
59
[158b026]60# get the desired cfa to test
61TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
62
[34e1494]63# adjust CC to current flags
[4daf79f]64CC = LC_ALL=C $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
[d65f92c]65CFACC = $(CC)
[ef7d253]66
[34e1494]67# get local binary for depedencies
68CFACCBIN = @CFACC@
69
70# adjusted CC but without the actual distcc call
[4daf79f]71CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) $(ARCH_FLAGS) ,$(TARGET_CFA) $(DEBUG_FLAGS) $(ARCH_FLAGS))
72CFACCLINK = $(CFACCLOCAL) -quiet $(if $(test), 2> $(test), ) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g'))
[34e1494]73
[4daf79f]74PRETTY_PATH=mkdir -p $(dir $(abspath $(@))) && cd $(srcdir) &&
[f7d3215]75
[fc01219]76.PHONY: list .validate .test_makeflags
77.INTERMEDIATE: .validate .validate.cfa .test_makeflags
[258aaab8]78EXTRA_PROGRAMS = avl_test linkonce linking/mangling/anon .dummy_hack # build but do not install
[a468e1e9]79EXTRA_DIST = test.py \
80 pybin/__init__.py \
81 pybin/print-core.gdb \
82 pybin/settings.py \
83 pybin/test_run.py \
84 pybin/tools.py \
85 long_tests.hfa \
[d0fa494]86 avltree/avl-private.h \
87 avltree/avl.h \
88 concurrent/clib_tls.c \
89 concurrent/clib.c \
[d0a00a5a]90 configs/.in/parseconfig-all.txt \
91 configs/.in/parseconfig-errors.txt \
92 configs/.in/parseconfig-missing.txt \
[d0fa494]93 exceptions/except-io.hfa \
94 exceptions/with-threads.hfa \
[b44959f]95 io/.in/io.data \
[3bd5ca7]96 io/.in/many_read.data \
[d0fa494]97 meta/fork+exec.hfa \
[dbd47d6]98 concurrent/unified_locking/mutex_test.hfa \
[35d1de5]99 concurrent/channels/parallel_harness.hfa
[a468e1e9]100
101dist-hook:
102 echo "Gathering test files"
[4daf79f]103 for file in `$(TEST_PY) --list-dist`; do \
104 if test -f $(srcdir)/$$(file); then \
105 $(MKDIR_P) $$(dirname $(distdir)/$$(file)); \
106 cp -df $(srcdir)/$$(file) $(distdir)/$$(file); \
[a468e1e9]107 fi; \
108 done
[44f44617]109
[107b01a]110avl_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
[aff7e86]111linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
[258aaab8]112linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
[2b10f95]113# automake doesn't know we still need C/CPP rules so pretend like we have a C program
[b7fe2e6]114nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
[a0dcd2e]115
[73abe95]116#----------------------------------------------------------------------------------------------------------------
[4daf79f]117
[c083c3d]118all-local : # This name is important to automake and implies the default build target.
[4daf79f]119 @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
120
121install : all-local # PAB only
122
123tests : all-local
[df42128]124
[4daf79f]125quick :
126 @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) $(quick_test)
[927e9ce]127
[2a59655]128mostlyclean-local :
[4daf79f]129 find $(builddir) -not -path './__pycache__/*' -path '*.o' -delete
130 find $(builddir) -not -path './__pycache__/*' -path '*/.err/*.log' -delete
131 find $(builddir) -not -path './__pycache__/*' -path '*/.out/*.log' -delete
132 rm -f $(EXTRA_PROGRAMS)
[2a59655]133 rm -rf __pycache__
134
135distclean-local :
[4daf79f]136 find $(builddir) -path '*.Po' -delete
[927e9ce]137
138list :
[4daf79f]139 @+$(TEST_PY) --list $(concurrent)
[927e9ce]140
[fc01219]141.test_makeflags:
[4daf79f]142 @echo "$(MAKEFLAGS)"
[fc01219]143
[1e995d6]144.validate: .validate.cfa
145 $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
146
147.validate.cfa:
[4daf79f]148 @echo "int main() { return 0; }" > $(@)
[28582b2]149
[107b01a]150# automake doesn't know we still need C rules so pretend like we have a C program
151.dummy_hack.c:
[4daf79f]152 @echo "int main() { return 0; }" > $(@)
[28582b2]153
[2b10f95]154.dummy_hackxx.cpp:
[4daf79f]155 @echo "int bar() { return 0; }" > $(@)
[2b10f95]156
[026a0f5]157concurrency :
[4daf79f]158 @+$(TEST_PY) --debug=$(debug) --install=$(installed) -Iconcurrent
[026a0f5]159
[73abe95]160#----------------------------------------------------------------------------------------------------------------
[dc8511c]161
[e16797c]162# Use for all tests, make sure the path are correct and all flags are added
[4daf79f]163CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) $($(shell echo "$(@)_FLAGSCFA" | sed 's/-\|\//_/g'))
[d9b499c]164
[e16797c]165#----------------------------------------------------------------------------------------------------------------
[a843067]166
[e16797c]167# implicit rule so not all test require a rule
[15f9c8e]168# split into two steps to support compiling remotely using distcc
[34e1494]169# don't use distcc to do the linking because distcc doesn't do linking
[d65f92c]170% : %.cfa $(CFACCBIN)
[4daf79f]171 $(CFACOMPILETEST) -c -o $(abspath $(@)).o -DIN_DIR="$(abspath $(dir $(<)))/.in/"
172 $(CFACCLINK) $(@).o -o $(abspath $(@))
173 rm $(abspath $(@)).o
[f7d3215]174
[34e1494]175# implicit rule for c++ test
176# convient for testing the testsuite itself but not actuall used
[e16797c]177% : %.cpp
[4daf79f]178 $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) -o $(abspath $(@))
[4c8f86b3]179
[f7d3215]180#------------------------------------------------------------------------------
[34e1494]181# TARGETS WITH CUSTOM FLAGS
[e16797c]182#------------------------------------------------------------------------------
[34e1494]183# custom libs
184gmp_FLAGSLD= -lgmp
[dc8511c]185
[e16797c]186#------------------------------------------------------------------------------
[34e1494]187# Generated code
188GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
189$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
[4daf79f]190 $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath $(@))
[34e1494]191
[e16797c]192#------------------------------------------------------------------------------
193# CUSTOM TARGET
194#------------------------------------------------------------------------------
[66812dd]195# tests that just validate syntax and compiler output should be compared to stderr
[4daf79f]196CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath $(@))
[40c81e5]197
[35d1de5]198SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
[a1b41e3]199 init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
[66812dd]200$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
[e6cfb4e2]201 $(CFACOMPILE_SYNTAX)
[4daf79f]202 $(if $(test), cp $(test) $(abspath $(@)), )
[87fc1b4]203
[34e1494]204# expected failures
[e6cfb4e2]205# use custom target since they require a custom define *and* have a name that doesn't match the file
[34e1494]206alloc-ERROR : alloc.cfa $(CFACCBIN)
[e6cfb4e2]207 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]208 -cp $(test) $(abspath $(@))
[b93a3de]209
[ee858bf]210init1-ERROR : init1.cfa $(CFACCBIN)
211 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]212 -cp $(test) $(abspath $(@))
[ee858bf]213
[34e1494]214typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
[e6cfb4e2]215 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]216 -cp $(test) $(abspath $(@))
[e2c70ab]217
[34e1494]218nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]219 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]220 -cp $(test) $(abspath $(@))
[49e1275]221
[34e1494]222nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]223 $(CFACOMPILE_SYNTAX) -DERR2
[4daf79f]224 -cp $(test) $(abspath $(@))
[49e1275]225
[34e1494]226raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
[e6cfb4e2]227 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]228 -cp $(test) $(abspath $(@))
[cdbfab0]229
[34e1494]230raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
[e6cfb4e2]231 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]232 -cp $(test) $(abspath $(@))
[80e8582]233
[34e1494]234raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]235 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]236 -cp $(test) $(abspath $(@))
[80e8582]237
[34e1494]238raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]239 $(CFACOMPILE_SYNTAX) -DERR2
[4daf79f]240 -cp $(test) $(abspath $(@))
[e16797c]241
[5715d43]242# Exception Tests
243# Test with libcfathread; it changes how storage works.
244
245exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
[4daf79f]246 $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath $(@)).o
247 $(CFACCLOCAL) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath $(@)).o -o $(abspath $(@))
[5715d43]248
[673eb7a]249# Linking tests
250# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
251linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
[4daf79f]252 $(CFACOMPILETEST) -O0 -c -o $(abspath $(@)).o
253 $(CFACCLINK) -O0 $(@).o -o $(abspath $(@))
254 rm $(abspath $(@)).o
[673eb7a]255
[34e1494]256#------------------------------------------------------------------------------
257# Other targets
Note: See TracBrowser for help on using the repository browser.