1# Copyright © 2018, VideoLAN and dav1d authors 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this 8# list of conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, 11# this list of conditions and the following disclaimer in the documentation 12# and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 25# 26# Build definition for the dav1d tests 27# 28 29# Leave subdir if tests are disabled 30if not get_option('enable_tests') 31 subdir_done() 32endif 33 34if is_asm_enabled 35 checkasm_sources = files( 36 'checkasm/checkasm.c', 37 'checkasm/msac.c', 38 'checkasm/pal.c', 39 'checkasm/refmvs.c', 40 ) 41 42 checkasm_tmpl_sources = files( 43 'checkasm/cdef.c', 44 'checkasm/filmgrain.c', 45 'checkasm/ipred.c', 46 'checkasm/itx.c', 47 'checkasm/loopfilter.c', 48 'checkasm/looprestoration.c', 49 'checkasm/mc.c', 50 ) 51 52 checkasm_bitdepth_objs = [] 53 foreach bitdepth : dav1d_bitdepths 54 checkasm_bitdepth_lib = static_library( 55 'checkasm_bitdepth_@0@'.format(bitdepth), 56 checkasm_tmpl_sources, 57 include_directories: dav1d_inc_dirs, 58 dependencies : [stdatomic_dependencies], 59 c_args: ['-DBITDEPTH=@0@'.format(bitdepth)], 60 install: false, 61 build_by_default: false, 62 ) 63 checkasm_bitdepth_objs += checkasm_bitdepth_lib.extract_all_objects(recursive: true) 64 endforeach 65 66 checkasm_asm_objs = [] 67 checkasm_asm_sources = [] 68 if host_machine.cpu_family() == 'aarch64' or host_machine.cpu() == 'arm64' 69 checkasm_asm_sources += files('checkasm/arm/checkasm_64.S') 70 elif host_machine.cpu_family().startswith('arm') 71 checkasm_asm_sources += files('checkasm/arm/checkasm_32.S') 72 elif host_machine.cpu_family() == 'riscv64' 73 checkasm_asm_sources += files('checkasm/riscv/checkasm_64.S') 74 elif host_machine.cpu_family().startswith('x86') 75 checkasm_asm_objs += nasm_gen.process(files('checkasm/x86/checkasm.asm')) 76 endif 77 78 if use_gaspp 79 checkasm_asm_objs += gaspp_gen.process(checkasm_asm_sources) 80 else 81 checkasm_sources += checkasm_asm_sources 82 endif 83 84 checkasm = executable('checkasm', 85 checkasm_sources, 86 checkasm_asm_objs, 87 88 objects: [ 89 checkasm_bitdepth_objs, 90 libdav1d.extract_all_objects(recursive: true), 91 ], 92 93 include_directories: dav1d_inc_dirs, 94 build_by_default: false, 95 dependencies : [ 96 thread_dependency, 97 rt_dependency, 98 libdl_dependency, 99 libm_dependency, 100 ], 101 ) 102 103 test('checkasm', checkasm, suite: 'checkasm', timeout: 180) 104 benchmark('checkasm', checkasm, suite: 'checkasm', timeout: 3600, args: '--bench') 105endif 106 107c99_extension_flag = cc.first_supported_argument( 108 '-Werror=c11-extensions', 109 '-Werror=c99-c11-compat', 110 '-Wc11-extensions', 111 '-Wc99-c11-compat', 112) 113 114# dav1d_api_headers 115foreach header : dav1d_api_headers 116 target = header + '_test' 117 118 header_test_exe = executable(target, 119 'header_test.c', 120 include_directories: dav1d_inc_dirs, 121 c_args: ['-DDAV1D_TEST_HEADER="@0@"'.format(header), c99_extension_flag], 122 build_by_default: true 123 ) 124 125 test(target, header_test_exe, suite: 'headers') 126endforeach 127 128 129# fuzzing binaries 130subdir('libfuzzer') 131 132# seek stress test binary, depends on dav1d cli tool 133if (get_option('enable_tools') and get_option('enable_seek_stress')) 134 seek_stress_sources = files('seek_stress.c') 135 seek_stress = executable('seek_stress', 136 seek_stress_sources, rev_target, 137 objects: [ 138 dav1d.extract_objects('dav1d_cli_parse.c'), 139 dav1d_input_objs.extract_objects('input/input.c', 'input/ivf.c'), 140 ], 141 include_directories: [dav1d_inc_dirs, include_directories('../tools')], 142 link_with: libdav1d, 143 dependencies: [ 144 thread_dependency, 145 rt_dependency, 146 getopt_dependency, 147 libm_dependency, 148 ], 149 ) 150endif 151 152# Include dav1d test data repository with additional tests 153if get_option('testdata_tests') 154 subdir('dav1d-test-data') 155endif 156