source: tests/Makefile.am@ 7c2c37a

ADT ast-experimental
Last change on this file since 7c2c37a was 0922716, checked in by caparsons <caparson@…>, 2 years ago

changed dist-hook rule to use curly braces to access shell vars where it should use them instead of parens

  • 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"
[0922716]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
[0922716]110
[107b01a]111avl_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]112linkonce_SOURCES = link-once/main.cfa link-once/partner.cfa
[258aaab8]113linking_mangling_anon_SOURCES = linking/mangling/header.hfa linking/mangling/lib.cfa linking/mangling/main.cfa
[2b10f95]114# automake doesn't know we still need C/CPP rules so pretend like we have a C program
[b7fe2e6]115nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
[a0dcd2e]116
[73abe95]117#----------------------------------------------------------------------------------------------------------------
[4daf79f]118
[c083c3d]119all-local : # This name is important to automake and implies the default build target.
[4daf79f]120 @+$(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
121
122install : all-local # PAB only
123
124tests : all-local
[df42128]125
[4daf79f]126quick :
127 @+$(TEST_PY) --debug=$(debug) --install=$(installed) --archive-errors=$(archiveerrors) $(concurrent) $(timeouts) $(ARCH) $(quick_test)
[927e9ce]128
[2a59655]129mostlyclean-local :
[4daf79f]130 find $(builddir) -not -path './__pycache__/*' -path '*.o' -delete
131 find $(builddir) -not -path './__pycache__/*' -path '*/.err/*.log' -delete
132 find $(builddir) -not -path './__pycache__/*' -path '*/.out/*.log' -delete
133 rm -f $(EXTRA_PROGRAMS)
[2a59655]134 rm -rf __pycache__
135
136distclean-local :
[4daf79f]137 find $(builddir) -path '*.Po' -delete
[927e9ce]138
139list :
[4daf79f]140 @+$(TEST_PY) --list $(concurrent)
[927e9ce]141
[fc01219]142.test_makeflags:
[4daf79f]143 @echo "$(MAKEFLAGS)"
[fc01219]144
[1e995d6]145.validate: .validate.cfa
146 $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror
147
148.validate.cfa:
[4daf79f]149 @echo "int main() { return 0; }" > $(@)
[28582b2]150
[107b01a]151# automake doesn't know we still need C rules so pretend like we have a C program
152.dummy_hack.c:
[4daf79f]153 @echo "int main() { return 0; }" > $(@)
[28582b2]154
[2b10f95]155.dummy_hackxx.cpp:
[4daf79f]156 @echo "int bar() { return 0; }" > $(@)
[2b10f95]157
[026a0f5]158concurrency :
[4daf79f]159 @+$(TEST_PY) --debug=$(debug) --install=$(installed) -Iconcurrent
[026a0f5]160
[73abe95]161#----------------------------------------------------------------------------------------------------------------
[dc8511c]162
[e16797c]163# Use for all tests, make sure the path are correct and all flags are added
[4daf79f]164CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) $($(shell echo "$(@)_FLAGSCFA" | sed 's/-\|\//_/g'))
[d9b499c]165
[e16797c]166#----------------------------------------------------------------------------------------------------------------
[a843067]167
[e16797c]168# implicit rule so not all test require a rule
[15f9c8e]169# split into two steps to support compiling remotely using distcc
[34e1494]170# don't use distcc to do the linking because distcc doesn't do linking
[d65f92c]171% : %.cfa $(CFACCBIN)
[4daf79f]172 $(CFACOMPILETEST) -c -o $(abspath $(@)).o -DIN_DIR="$(abspath $(dir $(<)))/.in/"
173 $(CFACCLINK) $(@).o -o $(abspath $(@))
174 rm $(abspath $(@)).o
[f7d3215]175
[34e1494]176# implicit rule for c++ test
177# convient for testing the testsuite itself but not actuall used
[e16797c]178% : %.cpp
[4daf79f]179 $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=$(srcdir) $(<)) -o $(abspath $(@))
[4c8f86b3]180
[f7d3215]181#------------------------------------------------------------------------------
[34e1494]182# TARGETS WITH CUSTOM FLAGS
[e16797c]183#------------------------------------------------------------------------------
[34e1494]184# custom libs
185gmp_FLAGSLD= -lgmp
[dc8511c]186
[e16797c]187#------------------------------------------------------------------------------
[34e1494]188# Generated code
189GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions
190$(GENERATED_CODE): % : %.cfa $(CFACCBIN)
[4daf79f]191 $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath $(@))
[34e1494]192
[e16797c]193#------------------------------------------------------------------------------
194# CUSTOM TARGET
195#------------------------------------------------------------------------------
[66812dd]196# tests that just validate syntax and compiler output should be compared to stderr
[4daf79f]197CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath $(@))
[40c81e5]198
[35d1de5]199SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
[a1b41e3]200 init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
[66812dd]201$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
[e6cfb4e2]202 $(CFACOMPILE_SYNTAX)
[4daf79f]203 $(if $(test), cp $(test) $(abspath $(@)), )
[87fc1b4]204
[34e1494]205# expected failures
[e6cfb4e2]206# use custom target since they require a custom define *and* have a name that doesn't match the file
[34e1494]207alloc-ERROR : alloc.cfa $(CFACCBIN)
[e6cfb4e2]208 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]209 -cp $(test) $(abspath $(@))
[b93a3de]210
[ee858bf]211init1-ERROR : init1.cfa $(CFACCBIN)
212 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]213 -cp $(test) $(abspath $(@))
[ee858bf]214
[34e1494]215typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN)
[e6cfb4e2]216 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]217 -cp $(test) $(abspath $(@))
[e2c70ab]218
[34e1494]219nested-types-ERR1 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]220 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]221 -cp $(test) $(abspath $(@))
[49e1275]222
[34e1494]223nested-types-ERR2 : nested-types.cfa $(CFACCBIN)
[e6cfb4e2]224 $(CFACOMPILE_SYNTAX) -DERR2
[4daf79f]225 -cp $(test) $(abspath $(@))
[49e1275]226
[34e1494]227raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN)
[e6cfb4e2]228 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]229 -cp $(test) $(abspath $(@))
[cdbfab0]230
[34e1494]231raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN)
[e6cfb4e2]232 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]233 -cp $(test) $(abspath $(@))
[80e8582]234
[34e1494]235raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]236 $(CFACOMPILE_SYNTAX) -DERR1
[4daf79f]237 -cp $(test) $(abspath $(@))
[80e8582]238
[34e1494]239raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN)
[e6cfb4e2]240 $(CFACOMPILE_SYNTAX) -DERR2
[4daf79f]241 -cp $(test) $(abspath $(@))
[e16797c]242
[5715d43]243# Exception Tests
244# Test with libcfathread; it changes how storage works.
245
246exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
[4daf79f]247 $(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath $(@)).o
248 $(CFACCLOCAL) $($(shell echo "$(@)_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath $(@)).o -o $(abspath $(@))
[5715d43]249
[673eb7a]250# Linking tests
251# Meta tests to make sure we see linking errors (can't compile with -O2 since it may multiply number of calls)
252linking/linkerror : linking/linkerror.cfa $(CFACCBIN)
[4daf79f]253 $(CFACOMPILETEST) -O0 -c -o $(abspath $(@)).o
254 $(CFACCLINK) -O0 $(@).o -o $(abspath $(@))
255 rm $(abspath $(@)).o
[673eb7a]256
[34e1494]257#------------------------------------------------------------------------------
258# Other targets
Note: See TracBrowser for help on using the repository browser.