blob: edb04447312f8bf60ae066aeeb0ffbb4ae3bb3ec [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
Nobuaki Sukegawa4d28b602016-02-28 13:25:54 +090022BUILT_SOURCES = trusted-ca-certificate.pem server-certificate.pem
23
24
Jake Farrellb95b0ff2012-03-22 21:49:10 +000025# Thrift compiler rules
26
27THRIFT = $(top_builddir)/compiler/cpp/thrift
28
29debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)
30
31$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020032 $(THRIFT) --gen d -nowarn $<
Jake Farrellb95b0ff2012-03-22 21:49:10 +000033
34stress_test_gen = $(addprefix gen-d/thrift/test/stress/, Service.d \
Jens Geyer79f988c2014-10-03 20:42:54 +020035 StressTest_types.d)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000036
37$(stress_test_gen): $(top_srcdir)/test/StressTest.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020038 $(THRIFT) --gen d $<
Jake Farrellb95b0ff2012-03-22 21:49:10 +000039
40thrift_test_gen = $(addprefix gen-d/thrift/test/, SecondService.d \
Jens Geyer79f988c2014-10-03 20:42:54 +020041 ThriftTest.d ThriftTest_constants.d ThriftTest_types.d)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000042
43$(thrift_test_gen): $(top_srcdir)/test/ThriftTest.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020044 $(THRIFT) --gen d $<
Jake Farrellb95b0ff2012-03-22 21:49:10 +000045
46
47# The actual test targets.
48# There just must be some way to reassign a variable without warnings in
49# Automake...
50targets__ = async_test client_pool_test serialization_benchmark \
Jens Geyer79f988c2014-10-03 20:42:54 +020051 stress_test_server thrift_test_client thrift_test_server transport_test
Jake Farrellb95b0ff2012-03-22 21:49:10 +000052ran_tests__ = client_pool_test \
Jens Geyer79f988c2014-10-03 20:42:54 +020053 transport_test \
54 async_test_runner.sh \
55 thrift_test_runner.sh
Jake Farrellb95b0ff2012-03-22 21:49:10 +000056
57libevent_dependent_targets = async_test_client client_pool_test \
Jens Geyer79f988c2014-10-03 20:42:54 +020058 stress_test_server thrift_test_server
Roger Meier38391a72014-01-12 19:58:54 +010059libevent_dependent_ran_tests = client_pool_test async_test_runner.sh thrift_test_runner.sh
Jake Farrellb95b0ff2012-03-22 21:49:10 +000060
61openssl_dependent_targets = async_test thrift_test_client thrift_test_server
62openssl_dependent_ran_tests = async_test_runner.sh thrift_test_runner.sh
63
64d_test_flags =
65
66if WITH_D_EVENT_TESTS
67d_test_flags += $(DMD_LIBEVENT_FLAGS) ../$(D_EVENT_LIB_NAME)
68targets_ = $(targets__)
69ran_tests_ = $(ran_tests__)
70else
71targets_ = $(filter-out $(libevent_dependent_targets), $(targets__))
72ran_tests_ = $(filter-out $(libevent_dependent_ran_tests), $(ran_tests__))
73endif
74
75if WITH_D_SSL_TESTS
76d_test_flags += $(DMD_OPENSSL_FLAGS) ../$(D_SSL_LIB_NAME)
77targets = trusted-ca-certificate.pem server-certificate.pem $(targets_)
78ran_tests = $(ran_tests_)
79else
80targets = $(filter-out $(openssl_dependent_targets), $(targets_))
81ran_tests = $(filter-out $(openssl_dependent_ran_tests), $(ran_tests_))
82endif
83
84d_test_flags += -w -wi -O -release -inline -I$(top_srcdir)/lib/d/src -Igen-d \
Jens Geyer79f988c2014-10-03 20:42:54 +020085 $(top_builddir)/lib/d/$(D_LIB_NAME)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000086
87
88async_test client_pool_test transport_test: %: %.d
Jens Geyer79f988c2014-10-03 20:42:54 +020089 $(DMD) $(d_test_flags) -of$@ $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +000090
91serialization_benchmark: %: %.d $(debug_proto_gen)
Jens Geyer79f988c2014-10-03 20:42:54 +020092 $(DMD) $(d_test_flags) -of$@ $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +000093
94stress_test_server: %: %.d test_utils.d $(stress_test_gen)
Jens Geyer79f988c2014-10-03 20:42:54 +020095 $(DMD) $(d_test_flags) -of$@ $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +000096
97thrift_test_client: %: %.d thrift_test_common.d $(thrift_test_gen)
Jens Geyer79f988c2014-10-03 20:42:54 +020098 $(DMD) $(d_test_flags) -of$@ $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +000099
100thrift_test_server: %: %.d thrift_test_common.d test_utils.d $(thrift_test_gen)
Jens Geyer79f988c2014-10-03 20:42:54 +0200101 $(DMD) $(d_test_flags) -of$@ $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000102
103
104# Certificate generation targets (for the SSL tests).
105# Currently, we just assume that the "openssl" tool is on the path, could be
106# replaced by a more elaborate mechanism.
107
108server-certificate.pem: openssl.test.cnf
Jens Geyer79f988c2014-10-03 20:42:54 +0200109 openssl req -new -x509 -nodes -config openssl.test.cnf \
110 -out server-certificate.pem
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000111
112trusted-ca-certificate.pem: server-certificate.pem
Jens Geyer79f988c2014-10-03 20:42:54 +0200113 cat server-certificate.pem > $@
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000114
115check-local: $(targets)
116
117clean-local:
Jens Geyer79f988c2014-10-03 20:42:54 +0200118 $(RM) -rf gen-d $(targets) $(addsuffix .o, $(targets))
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000119
120
121# Tests ran as part of make check.
122
123async_test_runner.sh: async_test trusted-ca-certificate.pem server-certificate.pem
124thrift_test_runner.sh: thrift_test_client thrift_test_server \
Jens Geyer79f988c2014-10-03 20:42:54 +0200125 trusted-ca-certificate.pem server-certificate.pem
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000126
127TESTS = $(ran_tests)