Makefile.am 4.0 KB
Newer Older
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

AUTOMAKE_OPTIONS = serial-tests

BUILT_SOURCES = trusted-ca-certificate.pem server-certificate.pem


# Thrift compiler rules

THRIFT = $(top_builddir)/compiler/cpp/thrift

debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)

$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift
	$(THRIFT) --gen d -nowarn $<

stress_test_gen = $(addprefix gen-d/thrift/test/stress/, Service.d \
	StressTest_types.d)

$(stress_test_gen): $(top_srcdir)/test/StressTest.thrift
	$(THRIFT) --gen d $<

thrift_test_gen = $(addprefix gen-d/thrift/test/, SecondService.d \
	ThriftTest.d ThriftTest_constants.d ThriftTest_types.d)

$(thrift_test_gen): $(top_srcdir)/test/ThriftTest.thrift
	$(THRIFT) --gen d $<


# The actual test targets.
# There just must be some way to reassign a variable without warnings in
# Automake...
targets__ = async_test client_pool_test serialization_benchmark \
	stress_test_server thrift_test_client thrift_test_server transport_test
ran_tests__ = client_pool_test \
	transport_test \
	async_test_runner.sh \
	thrift_test_runner.sh

libevent_dependent_targets = async_test_client client_pool_test \
	stress_test_server thrift_test_server
libevent_dependent_ran_tests = client_pool_test async_test_runner.sh thrift_test_runner.sh

openssl_dependent_targets = async_test thrift_test_client thrift_test_server
openssl_dependent_ran_tests = async_test_runner.sh thrift_test_runner.sh

d_test_flags =

if WITH_D_EVENT_TESTS
d_test_flags += $(DMD_LIBEVENT_FLAGS) ../$(D_EVENT_LIB_NAME)
targets_ = $(targets__)
ran_tests_ = $(ran_tests__)
else
targets_ = $(filter-out $(libevent_dependent_targets), $(targets__))
ran_tests_ = $(filter-out $(libevent_dependent_ran_tests), $(ran_tests__))
endif

if WITH_D_SSL_TESTS
d_test_flags += $(DMD_OPENSSL_FLAGS) ../$(D_SSL_LIB_NAME)
targets = $(targets_)
ran_tests = $(ran_tests_)
else
targets = $(filter-out $(openssl_dependent_targets), $(targets_))
ran_tests = $(filter-out $(openssl_dependent_ran_tests), $(ran_tests_))
endif

d_test_flags += -w -wi -O -release -inline -I$(top_srcdir)/lib/d/src -Igen-d \
	$(top_builddir)/lib/d/$(D_LIB_NAME)


async_test client_pool_test transport_test: %: %.d
	$(DMD) $(d_test_flags) -of$@ $^

serialization_benchmark: %: %.d $(debug_proto_gen)
	$(DMD) $(d_test_flags) -of$@ $^

stress_test_server: %: %.d test_utils.d $(stress_test_gen)
	$(DMD) $(d_test_flags) -of$@ $^

thrift_test_client: %: %.d thrift_test_common.d $(thrift_test_gen)
	$(DMD) $(d_test_flags) -of$@ $^

thrift_test_server: %: %.d thrift_test_common.d test_utils.d $(thrift_test_gen)
	$(DMD) $(d_test_flags) -of$@ $^


# Certificate generation targets (for the SSL tests).
# Currently, we just assume that the "openssl" tool is on the path, could be
# replaced by a more elaborate mechanism.

server-certificate.pem: openssl.test.cnf
	openssl req -new -x509 -nodes -config openssl.test.cnf \
		-out server-certificate.pem

trusted-ca-certificate.pem: server-certificate.pem
	cat server-certificate.pem > $@

check-local: $(targets)

clean-local:
	$(RM) -rf gen-d $(targets) $(addsuffix .o, $(targets))


# Tests ran as part of make check.

async_test_runner.sh: async_test trusted-ca-certificate.pem server-certificate.pem
thrift_test_runner.sh: thrift_test_client thrift_test_server \
	trusted-ca-certificate.pem server-certificate.pem

TESTS = $(ran_tests)

precross: $(targets)