1# 2# SPDX-License-Identifier: BSD-3-Clause 3# 4# Copyright © 2019 Keith Packard 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 13# 2. Redistributions in binary form must reproduce the above 14# copyright notice, this list of conditions and the following 15# disclaimer in the documentation and/or other materials provided 16# with the distribution. 17# 18# 3. Neither the name of the copyright holder nor the names of its 19# contributors may be used to endorse or promote products derived 20# from this software without specific prior written permission. 21# 22# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 33# OF THE POSSIBILITY OF SUCH DAMAGE. 34# 35foreach target : targets 36 value = get_variable('target_' + target) 37 38 _libs = [get_variable('lib_m' + target), get_variable('lib_c' + target)] 39 if is_variable('lib_semihost' + target) 40 _libs += [get_variable('lib_semihost' + target)] 41 endif 42 if is_variable('lib_crt' + target) 43 _libs += [get_variable('lib_crt'+ target)] 44 endif 45 46 _c_args = value[1] + test_c_args 47 _link_args = value[1] + test_link_args 48 49 t1 = 'printf/scanf' 50 if target == '' 51 t1_name = t1 52 else 53 t1_name = join_paths(target, t1) 54 endif 55 56 test(t1 + target, 57 executable(t1_name, 'printf_scanf.c', 58 c_args: _c_args, 59 link_args: _link_args, 60 link_with: _libs, 61 link_depends: test_link_depends, 62 include_directories: inc), 63 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 64 65 t1 = 'printff/scanff' 66 if target == '' 67 t1_name = t1 68 else 69 t1_name = join_paths(target, t1) 70 endif 71 72 test(t1 + target, 73 executable(t1_name, 'printf_scanf.c', 74 c_args: ['-DPICOLIBC_FLOAT_PRINTF_SCANF'] + _c_args, 75 link_args: _link_args, 76 link_with: _libs, 77 link_depends: test_link_depends, 78 include_directories: inc), 79 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 80 81 t1 = 'printf-tests' 82 if target == '' 83 t1_name = t1 84 else 85 t1_name = join_paths(target, t1) 86 endif 87 88 test(t1 + target, 89 executable(t1_name, ['printf-tests.c'], 90 c_args: _c_args, 91 link_args: _link_args, 92 link_with: _libs, 93 include_directories: inc), 94 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 95 96 t1 = 'printff-tests' 97 if target == '' 98 t1_name = t1 99 else 100 t1_name = join_paths(target, t1) 101 endif 102 103 test(t1 + target, 104 executable(t1_name, ['printf-tests.c'], 105 c_args: ['-DPICOLIBC_FLOAT_PRINTF_SCANF'] + _c_args, 106 link_args: _link_args, 107 link_with: _libs, 108 include_directories: inc), 109 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 110 111 t1 = 'rand' 112 if target == '' 113 t1_name = t1 114 else 115 t1_name = join_paths(target, t1) 116 endif 117 118 test(t1 + target, 119 executable(t1_name, ['rand.c'], 120 c_args: _c_args, 121 link_args: _link_args, 122 link_with: _libs, 123 link_depends: test_link_depends, 124 include_directories: inc), 125 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 126 127 if posix_io 128 t1 = 'posix-io' 129 if target == '' 130 t1_name = t1 131 else 132 t1_name = join_paths(target, t1) 133 endif 134 135 test(t1 + target, 136 executable(t1_name, ['posix-io.c'], 137 c_args: _c_args, 138 link_args: _link_args, 139 link_with: _libs, 140 link_depends: test_link_depends, 141 include_directories: inc), 142 env: ['MESON_SOURCE_ROOT=' + meson.source_root()]) 143 endif 144 145endforeach 146