1marshalers_h = custom_target('marshalers_h', 2 output : 'marshalers.h', 3 input : 'marshalers.list', 4 command : [ 5 python, glib_genmarshal, 6 '--prefix=test', 7 '--valist-marshallers', 8 '--output=@OUTPUT@', 9 '--quiet', 10 '--header', 11 '@INPUT@', 12 ], 13) 14marshalers_c = custom_target('marshalers_c', 15 output : 'marshalers.c', 16 input : 'marshalers.list', 17 command : [ 18 python, glib_genmarshal, 19 '--prefix=test', 20 '--valist-marshallers', 21 '--include-header=marshalers.h', 22 '--output=@OUTPUT@', 23 '--quiet', 24 '--body', 25 '@INPUT@', 26 ], 27) 28 29gobject_tests = { 30 'qdata' : {}, 31 'boxed' : {}, 32 'enums' : {}, 33 'param' : {}, 34 'threadtests' : {}, 35 'dynamictests' : {}, 36 'binding' : {}, 37 'properties' : {}, 38 'reference' : {}, 39 'flags' : {}, 40 'value' : {}, 41 'type' : {}, 42 'gobject-private' : { 43 'source' : 'private.c', 44 }, 45 'closure' : {}, 46 'closure-refcount' : { 'suite': ['slow'] }, 47 'object' : {}, 48 'signal-handler' : {}, 49 'ifaceproperties' : {}, 50 'signals' : { 51 'source' : ['signals.c', marshalers_h, marshalers_c], 52 }, 53 'testing' : {}, 54} 55 56if cc.get_id() != 'msvc' 57 gobject_tests += {'autoptr' : {}} 58endif 59 60python_tests = [ 61 'genmarshal.py', 62 'mkenums.py', 63] 64 65# FIXME: put common bits of test environment() in one location 66# Not entirely random of course, but at least it changes over time 67random_number = minor_version + meson.version().split('.').get(1).to_int() 68 69test_env = environment() 70test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 71test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 72test_env.set('G_DEBUG', 'gc-friendly') 73test_env.set('MALLOC_CHECK_', '2') 74test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) 75 76test_deps = [libm, thread_dep, libglib_dep, libgobject_dep] 77test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT'] 78 79foreach test_name, extra_args : gobject_tests 80 source = extra_args.get('source', test_name + '.c') 81 install = installed_tests_enabled and extra_args.get('install', true) 82 83 if install 84 test_conf = configuration_data() 85 test_conf.set('installed_tests_dir', installed_tests_execdir) 86 test_conf.set('program', test_name) 87 test_conf.set('env', '') 88 configure_file( 89 input: installed_tests_template_tap, 90 output: test_name + '.test', 91 install_dir: installed_tests_metadir, 92 configuration: test_conf 93 ) 94 endif 95 96 exe = executable(test_name, source, 97 c_args : test_cargs + extra_args.get('c_args', []), 98 dependencies : test_deps + extra_args.get('dependencies', []), 99 install_dir: installed_tests_execdir, 100 install: install, 101 ) 102 103 suite = ['gobject'] + extra_args.get('suite', []) 104 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout 105 106 # FIXME: https://gitlab.gnome.org/GNOME/glib/issues/1316 107 # aka https://bugs.debian.org/880883 108 if test_name == 'closure-refcount' and ['arm', 'aarch64'].contains(host_machine.cpu_family()) 109 timeout = timeout * 10 110 endif 111 112 test(test_name, exe, env : test_env, timeout : timeout, suite : suite) 113endforeach 114 115foreach test_name : python_tests 116 test( 117 test_name, 118 python, 119 args: ['-B', files(test_name)], 120 env: test_env, 121 suite: ['gobject', 'no-valgrind'], 122 ) 123 124 if installed_tests_enabled 125 install_data( 126 files(test_name), 127 install_dir: installed_tests_execdir, 128 install_mode: 'rwxr-xr-x', 129 ) 130 131 test_conf = configuration_data() 132 test_conf.set('installed_tests_dir', installed_tests_execdir) 133 test_conf.set('program', test_name) 134 test_conf.set('env', '') 135 configure_file( 136 input: installed_tests_template_tap, 137 output: test_name + '.test', 138 install_dir: installed_tests_metadir, 139 configuration: test_conf, 140 ) 141 endif 142endforeach 143 144# TAP test runner for Python tests 145if installed_tests_enabled 146 install_data( 147 files('taptestrunner.py'), 148 install_dir: installed_tests_execdir, 149 ) 150endif 151