tests: Move unit tests into a separate directory
[qemu/ar7.git] / tests / meson.build
blobaf43fd1eaf7ef9144cbcbdfa847ea6dc40b9a5ac
1 py3 = import('python').find_installation()
3 qht_bench = executable('qht-bench',
4                        sources: 'qht-bench.c',
5                        dependencies: [qemuutil])
7 executable('atomic_add-bench',
8            sources: files('atomic_add-bench.c'),
9            dependencies: [qemuutil],
10            build_by_default: false)
12 executable('atomic64-bench',
13            sources: files('atomic64-bench.c'),
14            dependencies: [qemuutil],
15            build_by_default: false)
17 test_qapi_outputs = [
18   'qapi-builtin-types.c',
19   'qapi-builtin-types.h',
20   'qapi-builtin-visit.c',
21   'qapi-builtin-visit.h',
22   'test-qapi-commands-sub-sub-module.c',
23   'test-qapi-commands-sub-sub-module.h',
24   'test-qapi-commands.c',
25   'test-qapi-commands.h',
26   'test-qapi-emit-events.c',
27   'test-qapi-emit-events.h',
28   'test-qapi-events-sub-sub-module.c',
29   'test-qapi-events-sub-sub-module.h',
30   'test-qapi-events.c',
31   'test-qapi-events.h',
32   'test-qapi-init-commands.c',
33   'test-qapi-init-commands.h',
34   'test-qapi-introspect.c',
35   'test-qapi-introspect.h',
36   'test-qapi-types-sub-sub-module.c',
37   'test-qapi-types-sub-sub-module.h',
38   'test-qapi-types.c',
39   'test-qapi-types.h',
40   'test-qapi-visit-sub-sub-module.c',
41   'test-qapi-visit-sub-sub-module.h',
42   'test-qapi-visit.c',
43   'test-qapi-visit.h',
46 test_qapi_files = custom_target('Test QAPI files',
47                                 output: test_qapi_outputs,
48                                 input: files('qapi-schema/qapi-schema-test.json',
49                                              'qapi-schema/include/sub-module.json',
50                                              'qapi-schema/sub-sub-module.json'),
51                                 command: [ qapi_gen, '-o', meson.current_build_dir(),
52                                            '-b', '-p', 'test-', '@INPUT0@' ],
53                                 depend_files: qapi_gen_depends)
55 # meson doesn't like generated output in other directories
56 # perhaps change qapi_gen to replace / with _, like Meson itself does?
57 subdir('include')
59 test_qapi_sources = []
60 test_qapi_headers = []
61 i = 0
62 foreach o: test_qapi_files.to_list() + test_qapi_files_extra.to_list()
63   if o.full_path().endswith('.h')
64     test_qapi_headers += o
65   endif
66   test_qapi_sources += o
67 endforeach
69 libtestqapi = static_library('testqapi', sources: [genh, test_qapi_sources])
70 testqapi = declare_dependency(link_with: libtestqapi, sources: [genh, test_qapi_headers])
72 test_deps = {
73   'test-qht-par': qht_bench,
76 benchs = {}
78 if have_block
79   benchs += {
80      'benchmark-crypto-hash': [crypto],
81      'benchmark-crypto-hmac': [crypto],
82      'benchmark-crypto-cipher': [crypto],
83   }
84 endif
86 foreach bench_name, deps: benchs
87   exe = executable(bench_name, bench_name + '.c',
88                    dependencies: [qemuutil] + deps)
89   benchmark(bench_name, exe,
90             args: ['--tap', '-k'],
91             protocol: 'tap',
92             timeout: 0,
93             suite: ['speed'])
94 endforeach
96 if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host
97   executable('vhost-user-bridge',
98              sources: files('vhost-user-bridge.c'),
99              dependencies: [qemuutil, vhost_user])
100 endif
102 if have_system and 'CONFIG_POSIX' in config_host
103   subdir('qemu-iotests')
104 endif
106 test('decodetree', sh,
107      args: [ files('decode/check.sh'), config_host['PYTHON'], files('../scripts/decodetree.py') ],
108      workdir: meson.current_source_dir() / 'decode',
109      suite: 'decodetree')
111 if 'CONFIG_TCG' in config_all
112   subdir('fp')
113 endif
115 if not get_option('tcg').disabled()
116   if 'CONFIG_PLUGIN' in config_host
117     subdir('plugin')
118   endif
119 endif
121 subdir('unit')
122 subdir('qapi-schema')
123 subdir('qtest')
124 subdir('migration')