hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize()
[qemu/ar7.git] / tests / qapi-schema / meson.build
blob8ba69171329b6d70afad27d6bcaaa3fada709931
1 test_env = environment()
2 test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
3 test_env.set('PYTHONIOENCODING', 'utf-8')
5 schemas = [
6   'alternate-any.json',
7   'alternate-array.json',
8   'alternate-base.json',
9   'alternate-branch-if-invalid.json',
10   'alternate-clash.json',
11   'alternate-conflict-dict.json',
12   'alternate-conflict-enum-bool.json',
13   'alternate-conflict-enum-int.json',
14   'alternate-conflict-string.json',
15   'alternate-conflict-bool-string.json',
16   'alternate-conflict-num-string.json',
17   'alternate-empty.json',
18   'alternate-invalid-dict.json',
19   'alternate-nested.json',
20   'alternate-unknown.json',
21   'args-alternate.json',
22   'args-any.json',
23   'args-array-empty.json',
24   'args-array-unknown.json',
25   'args-bad-boxed.json',
26   'args-boxed-anon.json',
27   'args-boxed-string.json',
28   'args-int.json',
29   'args-invalid.json',
30   'args-member-array-bad.json',
31   'args-member-case.json',
32   'args-member-unknown.json',
33   'args-union.json',
34   'args-unknown.json',
35   'bad-base.json',
36   'bad-data.json',
37   'bad-ident.json',
38   'bad-if.json',
39   'bad-if-empty.json',
40   'bad-if-empty-list.json',
41   'bad-if-list.json',
42   'bad-type-bool.json',
43   'bad-type-dict.json',
44   'bad-type-int.json',
45   'base-cycle-direct.json',
46   'base-cycle-indirect.json',
47   'command-int.json',
48   'comments.json',
49   'doc-bad-alternate-member.json',
50   'doc-bad-boxed-command-arg.json',
51   'doc-bad-command-arg.json',
52   'doc-bad-enum-member.json',
53   'doc-bad-event-arg.json',
54   'doc-bad-feature.json',
55   'doc-bad-indent.json',
56   'doc-bad-section.json',
57   'doc-bad-symbol.json',
58   'doc-bad-union-member.json',
59   'doc-before-include.json',
60   'doc-before-pragma.json',
61   'doc-duplicated-arg.json',
62   'doc-duplicated-return.json',
63   'doc-duplicated-since.json',
64   'doc-empty-arg.json',
65   'doc-empty-section.json',
66   'doc-empty-symbol.json',
67   'doc-good.json',
68   'doc-interleaved-section.json',
69   'doc-invalid-end.json',
70   'doc-invalid-end2.json',
71   'doc-invalid-return.json',
72   'doc-invalid-section.json',
73   'doc-invalid-start.json',
74   'doc-missing-colon.json',
75   'doc-missing-expr.json',
76   'doc-missing-space.json',
77   'doc-missing.json',
78   'doc-no-symbol.json',
79   'doc-undoc-feature.json',
80   'double-type.json',
81   'duplicate-key.json',
82   'empty.json',
83   'enum-bad-member.json',
84   'enum-bad-name.json',
85   'enum-bad-prefix.json',
86   'enum-clash-member.json',
87   'enum-dict-member-unknown.json',
88   'enum-if-invalid.json',
89   'enum-int-member.json',
90   'enum-member-case.json',
91   'enum-missing-data.json',
92   'enum-wrong-data.json',
93   'event-boxed-empty.json',
94   'event-case.json',
95   'event-member-invalid-dict.json',
96   'event-nest-struct.json',
97   'features-bad-type.json',
98   'features-deprecated-type.json',
99   'features-duplicate-name.json',
100   'features-if-invalid.json',
101   'features-missing-name.json',
102   'features-name-bad-type.json',
103   'features-no-list.json',
104   'features-unknown-key.json',
105   'flat-union-array-branch.json',
106   'flat-union-bad-base.json',
107   'flat-union-bad-discriminator.json',
108   'flat-union-base-any.json',
109   'flat-union-base-union.json',
110   'flat-union-clash-member.json',
111   'flat-union-discriminator-bad-name.json',
112   'flat-union-empty.json',
113   'flat-union-inline-invalid-dict.json',
114   'flat-union-int-branch.json',
115   'flat-union-invalid-branch-key.json',
116   'flat-union-invalid-discriminator.json',
117   'flat-union-invalid-if-discriminator.json',
118   'flat-union-no-base.json',
119   'flat-union-optional-discriminator.json',
120   'flat-union-string-discriminator.json',
121   'funny-char.json',
122   'funny-word.json',
123   'ident-with-escape.json',
124   'include-before-err.json',
125   'include-cycle.json',
126   'include-extra-junk.json',
127   'include-nested-err.json',
128   'include-no-file.json',
129   'include-non-file.json',
130   'include-repetition.json',
131   'include-self-cycle.json',
132   'include-simple.json',
133   'indented-expr.json',
134   'leading-comma-list.json',
135   'leading-comma-object.json',
136   'missing-colon.json',
137   'missing-comma-list.json',
138   'missing-comma-object.json',
139   'missing-type.json',
140   'nested-struct-data.json',
141   'nested-struct-data-invalid-dict.json',
142   'non-objects.json',
143   'oob-coroutine.json',
144   'oob-test.json',
145   'allow-preconfig-test.json',
146   'pragma-extra-junk.json',
147   'pragma-non-dict.json',
148   'pragma-unknown.json',
149   'pragma-value-not-bool.json',
150   'pragma-value-not-list-of-str.json',
151   'pragma-value-not-list.json',
152   'qapi-schema-test.json',
153   'quoted-structural-chars.json',
154   'redefined-command.json',
155   'redefined-event.json',
156   'redefined-predefined.json',
157   'redefined-type.json',
158   'reserved-command-q.json',
159   'reserved-enum-q.json',
160   'reserved-member-has.json',
161   'reserved-member-q.json',
162   'reserved-member-u.json',
163   'reserved-member-underscore.json',
164   'reserved-type-kind.json',
165   'reserved-type-list.json',
166   'returns-alternate.json',
167   'returns-array-bad.json',
168   'returns-bad-type.json',
169   'returns-dict.json',
170   'returns-unknown.json',
171   'string-code-point-31.json',
172   'string-code-point-127.json',
173   'struct-base-clash-deep.json',
174   'struct-base-clash.json',
175   'struct-data-invalid.json',
176   'struct-member-if-invalid.json',
177   'struct-member-invalid-dict.json',
178   'struct-member-invalid.json',
179   'struct-member-name-clash.json',
180   'trailing-comma-list.json',
181   'trailing-comma-object.json',
182   'type-bypass-bad-gen.json',
183   'type-case.json',
184   'unclosed-list.json',
185   'unclosed-object.json',
186   'unclosed-string.json',
187   'union-base-empty.json',
188   'union-base-no-discriminator.json',
189   'union-branch-case.json',
190   'union-branch-if-invalid.json',
191   'union-branch-invalid-dict.json',
192   'union-clash-branches.json',
193   'union-empty.json',
194   'union-invalid-base.json',
195   'union-optional-branch.json',
196   'union-unknown.json',
197   'unknown-escape.json',
198   'unknown-expr-key.json',
201 # Because people may want to use test-qapi.py from the command line, we
202 # are not using the "#! /usr/bin/env python3" trick here.  See
203 # docs/devel/build-system.txt
204 test('QAPI schema regression tests', python, args: files('test-qapi.py', schemas),
205      env: test_env, suite: ['qapi-schema', 'qapi-frontend'])
207 diff = find_program('diff')
209 qapi_doc = custom_target('QAPI doc',
210                          output: ['doc-good-qapi-commands.c', 'doc-good-qapi-commands.h',
211                                   'doc-good-qapi-emit-events.c', 'doc-good-qapi-emit-events.h',
212                                   'doc-good-qapi-events.c', 'doc-good-qapi-events.h',
213                                   'doc-good-qapi-init-commands.c', 'doc-good-qapi-init-commands.h',
214                                   'doc-good-qapi-introspect.c', 'doc-good-qapi-introspect.h',
215                                   'doc-good-qapi-types.c', 'doc-good-qapi-types.h',
216                                   'doc-good-qapi-visit.c', 'doc-good-qapi-visit.h' ],
217                          input: files('doc-good.json'),
218                          command: [ qapi_gen, '-o', meson.current_build_dir(),
219                                     '-p', 'doc-good-', '@INPUT0@' ],
220                          depend_files: qapi_gen_depends)
222 if build_docs
223   # Test the document-comment document generation code by running a test schema
224   # file through Sphinx's plain-text builder and comparing the result against
225   # a golden reference. This is in theory susceptible to failures if Sphinx
226   # changes its output, but the text output has historically been very stable
227   # (no changes between Sphinx 1.6 and 3.0), so it is a better bet than
228   # texinfo or HTML generation, both of which have had changes. We might
229   # need to add more sophisticated logic here in future for some sort of
230   # fuzzy comparison if future Sphinx versions produce different text,
231   # but for now the simple comparison suffices.
232   qapi_doc_out = custom_target('QAPI rST doc',
233                                output: ['doc-good.txt'],
234                                input: files('doc-good.json', 'doc-good.rst'),
235                                build_by_default: true,
236                                depend_files: sphinx_extn_depends,
237                                # We use -E to suppress Sphinx's caching, because
238                                # we want it to always really run the QAPI doc
239                                # generation code. It also means we don't
240                                # clutter up the build dir with the cache.
241                                command: [SPHINX_ARGS,
242                                          '-b', 'text', '-E',
243                                          '-c', meson.source_root() / 'docs',
244                                          '-D', 'master_doc=doc-good',
245                                          meson.current_source_dir(),
246                                          meson.current_build_dir()])
248   # Fix possible inconsistency in line endings in generated output and
249   # in the golden reference (which could otherwise cause test failures
250   # on Windows hosts). Unfortunately diff --strip-trailing-cr
251   # is GNU-diff only. The odd-looking perl is because we must avoid
252   # using an explicit '\' character in the command arguments to
253   # a custom_target(), as Meson will unhelpfully replace it with a '/'
254   # (https://github.com/mesonbuild/meson/issues/1564)
255   qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
256                                     output: ['doc-good.txt.nocr'],
257                                     input: qapi_doc_out[0],
258                                     build_by_default: true,
259                                     command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
260                                     capture: true)
262   qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
263                                     output: ['doc-good.ref.nocr'],
264                                     input: files('doc-good.txt'),
265                                     build_by_default: true,
266                                     command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
267                                     capture: true)
269   # "full_path()" needed here to work around
270   # https://github.com/mesonbuild/meson/issues/7585
271   test('QAPI rST doc', diff, args: ['-u', qapi_doc_ref_nocr[0].full_path(),
272                                     qapi_doc_out_nocr[0].full_path()],
273        depends: [qapi_doc_ref_nocr, qapi_doc_out_nocr],
274        suite: ['qapi-schema', 'qapi-doc'])
275 endif