forked from zeroc-ice/ice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMake.tests.rules
98 lines (82 loc) · 3.09 KB
/
Make.tests.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************
#
# $(call test,[$1])
#
# Returns the test project name (./test/Ice/operations -> test/Ice/operations)
#
test = $(patsubst $(lang_srcdir)/%,%,$(if $1,$1,$(currentdir)))
#
# $(call test-sources,$1=sources,$2=dir,$3=main-src extra-srcs)
#
# Returns sources if set, otherwise if main-src exists return main-src + extra-srcs, if it
# doesn't exist, returns an empty value.
#
test-sources = $(call unique,$(if $1,$(foreach f,$1,$(notdir $(wildcard $2/$f))),\
$(if $(wildcard $2/$(firstword $3)),$(foreach f,$3,$(notdir $(wildcard $2/$f))))))
#
# The test executables to try to build in each test directory
#
test-programs = client server serveramd collocated
#
# The default test sources for each test executable.
#
test-client-sources = Client.$1 *Test.ice AllTests.$1
test-server-sources = Server.$1 *Test.ice TestI.$1
test-serveramd-sources = ServerAMD.$1 *TestAMD.ice TestAMDI.$1
test-collocated-sources = Collocated.$1
#
# $(call create-test-project,test)
#
# Defines a project for the given test.
#
# The following variables can be defined to customize the build of the test:
#
# <name>_cleandirs
# <name>_clean
# <name>_bindir
# <name>_libdir
# <name>_sliceflags
# <name>_cppflags
# <name>_dependencies
# <name>_programs
# <name>_libraries
#
# The following variables allows to specify per-target (program or library) configuration
#
# <name>_<target>_sources
# <name>_<target>_sources
#
define create-test-project
$1_srcdir := $1
$1_programs := $$(or $$($1_programs),$(test-programs))
$1_noinstall := 1
$1_client_sources := $$(call test-sources,$$(call $1_client_sources,$$($1_srcext)),$$($1_srcdir),\
$$(call test-client-sources,$$($1_srcext)))
$1_server_sources := $$(call test-sources,$$(call $1_server_sources,$$($1_srcext)),$$($1_srcdir),\
$$(call test-server-sources,$$($1_srcext)))
$1_serveramd_sources := $$(call test-sources,$$(call $1_serveramd_sources,$$($1_srcext)),$$($1_srcdir),\
$$(call test-serveramd-sources,$$($1_srcext)))
$1_collocated_sources := $$(call test-sources,$$(call $1_collocated_sources,$$($1_srcext)),$$($1_srcdir),\
$$(call test-collocated-sources,$$($1_srcext)) \
$$(filter-out Server.$$($1_srcext) Client.$$($1_srcext),\
$$(notdir $$($1_client_sources) $$($1_server_sources))))
$1_programs := $$(foreach p,$$($1_programs),$$(if $$($1_$$(p)_sources),$1_$$(p)))
$$(foreach m,$$($1_programs) $$($1_libraries),$$(eval $$m_sources := $$(addprefix $$($1_srcdir)/,$$($$m_sources))))
projects += $(project)
endef
#
# Returns the tests which don't have a Makefile.mk fragment specified
#
tests-without-project-makefile = $(foreach d,$(patsubst %/run.py,%,$(shell find $(lang_srcdir)/test -name run.py)),\
$(if $(wildcard $d/Makefile.mk),,$(call test,$d)))
#
# The tests variable is used to load tests in Makefile.mk fragments
#
tests :=