blob: 04825833dc3c86924410dbc950b002e3e2108fcf [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
jfarrell8fd8c632014-07-10 09:14:51 -040020AUTOMAKE_OPTIONS = serial-tests
Jake Farrellb95b0ff2012-03-22 21:49:10 +000021
22# Thrift compiler rules
23
24THRIFT = $(top_builddir)/compiler/cpp/thrift
25
26debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)
27
28$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift
29 $(THRIFT) --gen d -nowarn $<
30
31stress_test_gen = $(addprefix gen-d/thrift/test/stress/, Service.d \
32 StressTest_types.d)
33
34$(stress_test_gen): $(top_srcdir)/test/StressTest.thrift
35 $(THRIFT) --gen d $<
36
37thrift_test_gen = $(addprefix gen-d/thrift/test/, SecondService.d \
38 ThriftTest.d ThriftTest_constants.d ThriftTest_types.d)
39
40$(thrift_test_gen): $(top_srcdir)/test/ThriftTest.thrift
41 $(THRIFT) --gen d $<
42
43
44# The actual test targets.
45# There just must be some way to reassign a variable without warnings in
46# Automake...
47targets__ = async_test client_pool_test serialization_benchmark \
48 stress_test_server thrift_test_client thrift_test_server transport_test
49ran_tests__ = client_pool_test \
50 transport_test \
51 async_test_runner.sh \
52 thrift_test_runner.sh
53
54libevent_dependent_targets = async_test_client client_pool_test \
55 stress_test_server thrift_test_server
Roger Meier38391a72014-01-12 19:58:54 +010056libevent_dependent_ran_tests = client_pool_test async_test_runner.sh thrift_test_runner.sh
Jake Farrellb95b0ff2012-03-22 21:49:10 +000057
58openssl_dependent_targets = async_test thrift_test_client thrift_test_server
59openssl_dependent_ran_tests = async_test_runner.sh thrift_test_runner.sh
60
61d_test_flags =
62
63if WITH_D_EVENT_TESTS
64d_test_flags += $(DMD_LIBEVENT_FLAGS) ../$(D_EVENT_LIB_NAME)
65targets_ = $(targets__)
66ran_tests_ = $(ran_tests__)
67else
68targets_ = $(filter-out $(libevent_dependent_targets), $(targets__))
69ran_tests_ = $(filter-out $(libevent_dependent_ran_tests), $(ran_tests__))
70endif
71
72if WITH_D_SSL_TESTS
73d_test_flags += $(DMD_OPENSSL_FLAGS) ../$(D_SSL_LIB_NAME)
74targets = trusted-ca-certificate.pem server-certificate.pem $(targets_)
75ran_tests = $(ran_tests_)
76else
77targets = $(filter-out $(openssl_dependent_targets), $(targets_))
78ran_tests = $(filter-out $(openssl_dependent_ran_tests), $(ran_tests_))
79endif
80
81d_test_flags += -w -wi -O -release -inline -I$(top_srcdir)/lib/d/src -Igen-d \
82 $(top_builddir)/lib/d/$(D_LIB_NAME)
83
84
85async_test client_pool_test transport_test: %: %.d
86 $(DMD) $(d_test_flags) -of$@ $^
87
88serialization_benchmark: %: %.d $(debug_proto_gen)
89 $(DMD) $(d_test_flags) -of$@ $^
90
91stress_test_server: %: %.d test_utils.d $(stress_test_gen)
92 $(DMD) $(d_test_flags) -of$@ $^
93
94thrift_test_client: %: %.d thrift_test_common.d $(thrift_test_gen)
95 $(DMD) $(d_test_flags) -of$@ $^
96
97thrift_test_server: %: %.d thrift_test_common.d test_utils.d $(thrift_test_gen)
98 $(DMD) $(d_test_flags) -of$@ $^
99
100
101# Certificate generation targets (for the SSL tests).
102# Currently, we just assume that the "openssl" tool is on the path, could be
103# replaced by a more elaborate mechanism.
104
105server-certificate.pem: openssl.test.cnf
106 openssl req -new -x509 -nodes -config openssl.test.cnf \
107 -out server-certificate.pem
108
109trusted-ca-certificate.pem: server-certificate.pem
110 cat server-certificate.pem > $@
111
112check-local: $(targets)
113
114clean-local:
115 $(RM) -rf gen-d $(targets) $(addsuffix .o, $(targets))
116
117
118# Tests ran as part of make check.
119
120async_test_runner.sh: async_test trusted-ca-certificate.pem server-certificate.pem
121thrift_test_runner.sh: thrift_test_client thrift_test_server \
122 trusted-ca-certificate.pem server-certificate.pem
123
124TESTS = $(ran_tests)