blob: 44f2d66ac1b22349993dfefdba60debc4fe05ab0 [file] [log] [blame]
Jake Farrellb95b0ff2012-03-22 21:49:10 +00001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20
21# Thrift compiler rules
22
23THRIFT = $(top_builddir)/compiler/cpp/thrift
24
25debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)
26
27$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift
28 $(THRIFT) --gen d -nowarn $<
29
30stress_test_gen = $(addprefix gen-d/thrift/test/stress/, Service.d \
31 StressTest_types.d)
32
33$(stress_test_gen): $(top_srcdir)/test/StressTest.thrift
34 $(THRIFT) --gen d $<
35
36thrift_test_gen = $(addprefix gen-d/thrift/test/, SecondService.d \
37 ThriftTest.d ThriftTest_constants.d ThriftTest_types.d)
38
39$(thrift_test_gen): $(top_srcdir)/test/ThriftTest.thrift
40 $(THRIFT) --gen d $<
41
42
43# The actual test targets.
44# There just must be some way to reassign a variable without warnings in
45# Automake...
46targets__ = async_test client_pool_test serialization_benchmark \
47 stress_test_server thrift_test_client thrift_test_server transport_test
48ran_tests__ = client_pool_test \
49 transport_test \
50 async_test_runner.sh \
51 thrift_test_runner.sh
52
53libevent_dependent_targets = async_test_client client_pool_test \
54 stress_test_server thrift_test_server
Roger Meier38391a72014-01-12 19:58:54 +010055libevent_dependent_ran_tests = client_pool_test async_test_runner.sh thrift_test_runner.sh
Jake Farrellb95b0ff2012-03-22 21:49:10 +000056
57openssl_dependent_targets = async_test thrift_test_client thrift_test_server
58openssl_dependent_ran_tests = async_test_runner.sh thrift_test_runner.sh
59
60d_test_flags =
61
62if WITH_D_EVENT_TESTS
63d_test_flags += $(DMD_LIBEVENT_FLAGS) ../$(D_EVENT_LIB_NAME)
64targets_ = $(targets__)
65ran_tests_ = $(ran_tests__)
66else
67targets_ = $(filter-out $(libevent_dependent_targets), $(targets__))
68ran_tests_ = $(filter-out $(libevent_dependent_ran_tests), $(ran_tests__))
69endif
70
71if WITH_D_SSL_TESTS
72d_test_flags += $(DMD_OPENSSL_FLAGS) ../$(D_SSL_LIB_NAME)
73targets = trusted-ca-certificate.pem server-certificate.pem $(targets_)
74ran_tests = $(ran_tests_)
75else
76targets = $(filter-out $(openssl_dependent_targets), $(targets_))
77ran_tests = $(filter-out $(openssl_dependent_ran_tests), $(ran_tests_))
78endif
79
80d_test_flags += -w -wi -O -release -inline -I$(top_srcdir)/lib/d/src -Igen-d \
81 $(top_builddir)/lib/d/$(D_LIB_NAME)
82
83
84async_test client_pool_test transport_test: %: %.d
85 $(DMD) $(d_test_flags) -of$@ $^
86
87serialization_benchmark: %: %.d $(debug_proto_gen)
88 $(DMD) $(d_test_flags) -of$@ $^
89
90stress_test_server: %: %.d test_utils.d $(stress_test_gen)
91 $(DMD) $(d_test_flags) -of$@ $^
92
93thrift_test_client: %: %.d thrift_test_common.d $(thrift_test_gen)
94 $(DMD) $(d_test_flags) -of$@ $^
95
96thrift_test_server: %: %.d thrift_test_common.d test_utils.d $(thrift_test_gen)
97 $(DMD) $(d_test_flags) -of$@ $^
98
99
100# Certificate generation targets (for the SSL tests).
101# Currently, we just assume that the "openssl" tool is on the path, could be
102# replaced by a more elaborate mechanism.
103
104server-certificate.pem: openssl.test.cnf
105 openssl req -new -x509 -nodes -config openssl.test.cnf \
106 -out server-certificate.pem
107
108trusted-ca-certificate.pem: server-certificate.pem
109 cat server-certificate.pem > $@
110
111check-local: $(targets)
112
113clean-local:
114 $(RM) -rf gen-d $(targets) $(addsuffix .o, $(targets))
115
116
117# Tests ran as part of make check.
118
119async_test_runner.sh: async_test trusted-ca-certificate.pem server-certificate.pem
120thrift_test_runner.sh: thrift_test_client thrift_test_server \
121 trusted-ca-certificate.pem server-certificate.pem
122
123TESTS = $(ran_tests)