1# 2# Copyright (c) 2016, The OpenThread Authors. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 3. Neither the name of the copyright holder nor the 13# names of its contributors may be used to endorse or promote products 14# derived from this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26# POSSIBILITY OF SUCH DAMAGE. 27# 28 29include $(abs_top_nlbuild_autotools_dir)/automake/pre.am 30 31# 32# Local headers to build against and distribute but not to install 33# since they are not part of the package. 34# 35noinst_HEADERS = \ 36 test_lowpan.hpp \ 37 test_platform.h \ 38 test_util.h \ 39 test_util.hpp \ 40 $(NULL) 41 42# 43# Other files we do want to distribute with the package. 44# 45EXTRA_DIST = \ 46 $(NULL) 47 48if OPENTHREAD_BUILD_TESTS 49# C preprocessor option flags that will apply to all compiled objects in this 50# makefile. 51 52AM_CPPFLAGS = \ 53 -DOPENTHREAD_FTD=1 \ 54 -DOPENTHREAD_MTD=0 \ 55 -DOPENTHREAD_RADIO=0 \ 56 -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \ 57 -I$(top_srcdir)/include \ 58 -I$(top_srcdir)/src \ 59 -I$(top_srcdir)/src/core \ 60 $(NULL) 61 62if OPENTHREAD_EXAMPLES_SIMULATION 63AM_CPPFLAGS += \ 64 -I$(top_srcdir)/examples/platforms \ 65 $(NULL) 66endif 67 68if OPENTHREAD_PLATFORM_POSIX 69AM_CPPFLAGS += \ 70 -DOPENTHREAD_PLATFORM_POSIX=1 \ 71 -I$(top_srcdir)/src/posix/platform \ 72 $(NULL) 73endif 74 75COMMON_LDADD = \ 76 $(top_builddir)/third_party/tcplp/libtcplp.a \ 77 $(NULL) 78 79if OPENTHREAD_ENABLE_NCP 80COMMON_LDADD += \ 81 $(top_builddir)/src/ncp/libopenthread-ncp-ftd.a \ 82 $(NULL) 83endif 84 85COMMON_LDADD += \ 86 $(top_builddir)/src/core/libopenthread-ftd.a \ 87 -lpthread \ 88 $(NULL) 89 90if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS 91COMMON_LDADD += \ 92 $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ 93 $(NULL) 94endif 95 96if OPENTHREAD_PLATFORM_POSIX 97COMMON_LDADD += \ 98 -lutil 99 $(NULL) 100endif 101 102# Test applications that should be run when the 'check' target is run. 103 104check_PROGRAMS = \ 105 ot-test-toolchain \ 106 $(NULL) 107 108if OPENTHREAD_ENABLE_FTD 109check_PROGRAMS += \ 110 ot-test-aes \ 111 ot-test-array \ 112 ot-test-checksum \ 113 ot-test-child \ 114 ot-test-child-table \ 115 ot-test-cmd-line-parser \ 116 ot-test-dns \ 117 ot-test-ecdsa \ 118 ot-test-flash \ 119 ot-test-heap \ 120 ot-test-heap-string \ 121 ot-test-hkdf-sha256 \ 122 ot-test-hmac-sha256 \ 123 ot-test-ip-address \ 124 ot-test-link-quality \ 125 ot-test-linked-list \ 126 ot-test-lookup-table \ 127 ot-test-lowpan \ 128 ot-test-mac-frame \ 129 ot-test-macros \ 130 ot-test-message \ 131 ot-test-message-queue \ 132 ot-test-multicast-listeners-table \ 133 ot-test-ndproxy-table \ 134 ot-test-netif \ 135 ot-test-network-data \ 136 ot-test-pool \ 137 ot-test-priority-queue \ 138 ot-test-pskc \ 139 ot-test-steering-data \ 140 ot-test-string \ 141 ot-test-timer \ 142 $(NULL) 143 144if OPENTHREAD_ENABLE_NCP 145check_PROGRAMS += \ 146 ot-test-hdlc \ 147 ot-test-spinel-buffer \ 148 ot-test-spinel-decoder \ 149 ot-test-spinel-encoder \ 150 $(NULL) 151endif 152endif # OPENTHREAD_ENABLE_FTD 153 154XFAIL_TESTS = \ 155 $(NULL) 156 157if OPENTHREAD_WITH_ADDRESS_SANITIZER 158check_PROGRAMS += ot-test-address-sanitizer 159XFAIL_TESTS += ot-test-address-sanitizer 160ot_test_address_sanitizer_SOURCES = test_address_sanitizer.cpp 161endif # OPENTHREAD_WITH_ADDRESS_SANITIZER 162 163 164# Test applications and scripts that should be built and run when the 165# 'check' target is run. 166 167TESTS = \ 168 $(check_PROGRAMS) \ 169 $(NULL) 170 171# The additional environment variables and their values that will be 172# made available to all programs and scripts in TESTS. 173 174TESTS_ENVIRONMENT = \ 175 top_srcdir='$(top_srcdir)' \ 176 $(NULL) 177 178COMMON_SOURCES = test_platform.cpp test_util.cpp 179 180# Source, compiler, and linker options for test programs. 181 182ot_test_aes_LDADD = $(COMMON_LDADD) 183ot_test_aes_SOURCES = $(COMMON_SOURCES) test_aes.cpp 184 185ot_test_array_LDADD = $(COMMON_LDADD) 186ot_test_array_SOURCES = $(COMMON_SOURCES) test_array.cpp 187 188ot_test_checksum_LDADD = $(COMMON_LDADD) 189ot_test_checksum_SOURCES = $(COMMON_SOURCES) test_checksum.cpp 190 191ot_test_child_LDADD = $(COMMON_LDADD) 192ot_test_child_SOURCES = $(COMMON_SOURCES) test_child.cpp 193 194ot_test_child_table_LDADD = $(COMMON_LDADD) 195ot_test_child_table_SOURCES = $(COMMON_SOURCES) test_child_table.cpp 196 197ot_test_cmd_line_parser_LDADD = $(COMMON_LDADD) 198ot_test_cmd_line_parser_SOURCES = $(COMMON_SOURCES) test_cmd_line_parser.cpp 199 200ot_test_dns_LDADD = $(COMMON_LDADD) 201ot_test_dns_SOURCES = $(COMMON_SOURCES) test_dns.cpp 202 203ot_test_ecdsa_LDADD = $(COMMON_LDADD) 204ot_test_ecdsa_SOURCES = $(COMMON_SOURCES) test_ecdsa.cpp 205 206ot_test_flash_LDADD = $(COMMON_LDADD) 207ot_test_flash_SOURCES = $(COMMON_SOURCES) test_flash.cpp 208 209ot_test_hdlc_LDADD = $(COMMON_LDADD) 210ot_test_hdlc_SOURCES = $(COMMON_SOURCES) test_hdlc.cpp 211 212ot_test_heap_LDADD = $(COMMON_LDADD) 213ot_test_heap_SOURCES = $(COMMON_SOURCES) test_heap.cpp 214 215ot_test_heap_string_LDADD = $(COMMON_LDADD) 216ot_test_heap_string_SOURCES = $(COMMON_SOURCES) test_heap_string.cpp 217 218ot_test_hkdf_sha256_LDADD = $(COMMON_LDADD) 219ot_test_hkdf_sha256_SOURCES = $(COMMON_SOURCES) test_hkdf_sha256.cpp 220 221ot_test_hmac_sha256_LDADD = $(COMMON_LDADD) 222ot_test_hmac_sha256_SOURCES = $(COMMON_SOURCES) test_hmac_sha256.cpp 223 224ot_test_ip_address_LDADD = $(COMMON_LDADD) 225ot_test_ip_address_SOURCES = $(COMMON_SOURCES) test_ip_address.cpp 226 227ot_test_link_quality_LDADD = $(COMMON_LDADD) 228ot_test_link_quality_SOURCES = $(COMMON_SOURCES) test_link_quality.cpp 229 230ot_test_linked_list_LDADD = $(COMMON_LDADD) 231ot_test_linked_list_SOURCES = $(COMMON_SOURCES) test_linked_list.cpp 232 233ot_test_lookup_table_LDADD = $(COMMON_LDADD) 234ot_test_lookup_table_SOURCES = $(COMMON_SOURCES) test_lookup_table.cpp 235 236ot_test_lowpan_LDADD = $(COMMON_LDADD) 237ot_test_lowpan_SOURCES = $(COMMON_SOURCES) test_lowpan.cpp 238 239ot_test_mac_frame_LDADD = $(COMMON_LDADD) 240ot_test_mac_frame_SOURCES = $(COMMON_SOURCES) test_mac_frame.cpp 241 242ot_test_macros_LDADD = $(COMMON_LDADD) 243ot_test_macros_SOURCES = $(COMMON_SOURCES) test_macros.cpp 244 245ot_test_message_LDADD = $(COMMON_LDADD) 246ot_test_message_SOURCES = $(COMMON_SOURCES) test_message.cpp 247 248ot_test_message_queue_LDADD = $(COMMON_LDADD) 249ot_test_message_queue_SOURCES = $(COMMON_SOURCES) test_message_queue.cpp 250 251ot_test_multicast_listeners_table_LDADD = $(COMMON_LDADD) 252ot_test_multicast_listeners_table_SOURCES = $(COMMON_SOURCES) test_multicast_listeners_table.cpp 253 254ot_test_spinel_buffer_LDADD = $(COMMON_LDADD) 255ot_test_spinel_buffer_SOURCES = $(COMMON_SOURCES) test_spinel_buffer.cpp 256 257ot_test_ndproxy_table_LDADD = $(COMMON_LDADD) 258ot_test_ndproxy_table_SOURCES = $(COMMON_SOURCES) test_ndproxy_table.cpp 259 260ot_test_netif_LDADD = $(COMMON_LDADD) 261ot_test_netif_SOURCES = $(COMMON_SOURCES) test_netif.cpp 262 263ot_test_network_data_LDADD = $(COMMON_LDADD) 264ot_test_network_data_SOURCES = $(COMMON_SOURCES) test_network_data.cpp 265 266ot_test_pool_LDADD = $(COMMON_LDADD) 267ot_test_pool_SOURCES = $(COMMON_SOURCES) test_pool.cpp 268 269ot_test_priority_queue_LDADD = $(COMMON_LDADD) 270ot_test_priority_queue_SOURCES = $(COMMON_SOURCES) test_priority_queue.cpp 271 272ot_test_pskc_LDADD = $(COMMON_LDADD) 273ot_test_pskc_SOURCES = $(COMMON_SOURCES) test_pskc.cpp 274 275ot_test_steering_data_LDADD = $(COMMON_LDADD) 276ot_test_steering_data_SOURCES = $(COMMON_SOURCES) test_steering_data.cpp 277 278ot_test_string_LDADD = $(COMMON_LDADD) 279ot_test_string_SOURCES = $(COMMON_SOURCES) test_string.cpp 280 281ot_test_spinel_decoder_LDADD = $(COMMON_LDADD) 282ot_test_spinel_decoder_SOURCES = $(COMMON_SOURCES) test_spinel_decoder.cpp 283 284ot_test_spinel_encoder_LDADD = $(COMMON_LDADD) 285ot_test_spinel_encoder_SOURCES = $(COMMON_SOURCES) test_spinel_encoder.cpp 286 287ot_test_timer_LDADD = $(COMMON_LDADD) 288ot_test_timer_SOURCES = $(COMMON_SOURCES) test_timer.cpp 289 290ot_test_toolchain_LDADD = $(NULL) 291ot_test_toolchain_SOURCES = test_toolchain.cpp test_toolchain_c.c 292 293if OPENTHREAD_BUILD_COVERAGE 294CLEANFILES = $(wildcard *.gcda *.gcno) 295endif # OPENTHREAD_BUILD_COVERAGE 296 297endif # OPENTHREAD_BUILD_TESTS 298 299include $(abs_top_nlbuild_autotools_dir)/automake/post.am 300