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