]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tests/qapi-schema/meson.build
meson: switch minimum meson version to 0.58.2, minimum recommended to 0.59.2
[mirror_qemu.git] / tests / qapi-schema / meson.build
index f08c902911e499858ffd849732b7fa1c3745b509..df5acfd08b6b55d5b3795a07b8dc8d05282774c8 100644 (file)
@@ -1,5 +1,5 @@
 test_env = environment()
-test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
+test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
 test_env.set('PYTHONIOENCODING', 'utf-8')
 
 schemas = [
@@ -14,6 +14,7 @@ schemas = [
   'alternate-conflict-string.json',
   'alternate-conflict-bool-string.json',
   'alternate-conflict-num-string.json',
+  'alternate-data-invalid.json',
   'alternate-empty.json',
   'alternate-invalid-dict.json',
   'alternate-nested.json',
@@ -30,16 +31,19 @@ schemas = [
   'args-member-array-bad.json',
   'args-member-case.json',
   'args-member-unknown.json',
-  'args-name-clash.json',
   'args-union.json',
   'args-unknown.json',
   'bad-base.json',
   'bad-data.json',
   'bad-ident.json',
   'bad-if.json',
+  'bad-if-all.json',
   'bad-if-empty.json',
   'bad-if-empty-list.json',
+  'bad-if-key.json',
+  'bad-if-keys.json',
   'bad-if-list.json',
+  'bad-if-not.json',
   'bad-type-bool.json',
   'bad-type-dict.json',
   'bad-type-int.json',
@@ -103,23 +107,6 @@ schemas = [
   'features-name-bad-type.json',
   'features-no-list.json',
   'features-unknown-key.json',
-  'flat-union-array-branch.json',
-  'flat-union-bad-base.json',
-  'flat-union-bad-discriminator.json',
-  'flat-union-base-any.json',
-  'flat-union-base-union.json',
-  'flat-union-clash-member.json',
-  'flat-union-discriminator-bad-name.json',
-  'flat-union-empty.json',
-  'flat-union-inline.json',
-  'flat-union-inline-invalid-dict.json',
-  'flat-union-int-branch.json',
-  'flat-union-invalid-branch-key.json',
-  'flat-union-invalid-discriminator.json',
-  'flat-union-invalid-if-discriminator.json',
-  'flat-union-no-base.json',
-  'flat-union-optional-discriminator.json',
-  'flat-union-string-discriminator.json',
   'funny-char.json',
   'funny-word.json',
   'ident-with-escape.json',
@@ -135,26 +122,29 @@ schemas = [
   'indented-expr.json',
   'leading-comma-list.json',
   'leading-comma-object.json',
+  'missing-array-rsqb.json',
   'missing-colon.json',
   'missing-comma-list.json',
   'missing-comma-object.json',
+  'missing-object-member-element.json',
   'missing-type.json',
   'nested-struct-data.json',
   'nested-struct-data-invalid-dict.json',
   'non-objects.json',
+  'oob-coroutine.json',
   'oob-test.json',
   'allow-preconfig-test.json',
-  'pragma-doc-required-crap.json',
   'pragma-extra-junk.json',
-  'pragma-name-case-whitelist-crap.json',
   'pragma-non-dict.json',
   'pragma-unknown.json',
-  'pragma-returns-whitelist-crap.json',
+  'pragma-value-not-bool.json',
+  'pragma-value-not-list-of-str.json',
+  'pragma-value-not-list.json',
   'qapi-schema-test.json',
   'quoted-structural-chars.json',
-  'redefined-builtin.json',
   'redefined-command.json',
   'redefined-event.json',
+  'redefined-predefined.json',
   'redefined-type.json',
   'reserved-command-q.json',
   'reserved-enum-q.json',
@@ -162,13 +152,12 @@ schemas = [
   'reserved-member-q.json',
   'reserved-member-u.json',
   'reserved-member-underscore.json',
-  'reserved-type-kind.json',
   'reserved-type-list.json',
   'returns-alternate.json',
   'returns-array-bad.json',
+  'returns-bad-type.json',
   'returns-dict.json',
   'returns-unknown.json',
-  'returns-whitelist.json',
   'string-code-point-31.json',
   'string-code-point-127.json',
   'struct-base-clash-deep.json',
@@ -177,30 +166,50 @@ schemas = [
   'struct-member-if-invalid.json',
   'struct-member-invalid-dict.json',
   'struct-member-invalid.json',
+  'struct-member-name-clash.json',
   'trailing-comma-list.json',
   'trailing-comma-object.json',
   'type-bypass-bad-gen.json',
+  'type-case.json',
   'unclosed-list.json',
   'unclosed-object.json',
   'unclosed-string.json',
+  'union-array-branch.json',
+  'union-bad-base.json',
+  'union-bad-discriminator.json',
+  'union-base-any.json',
   'union-base-empty.json',
   'union-base-no-discriminator.json',
-  'union-branch-case.json',
+  'union-base-union.json',
   'union-branch-if-invalid.json',
   'union-branch-invalid-dict.json',
-  'union-clash-branches.json',
+  'union-clash-member.json',
+  'union-discriminator-bad-name.json',
   'union-empty.json',
+  'union-inline-invalid-dict.json',
+  'union-int-branch.json',
   'union-invalid-base.json',
-  'union-optional-branch.json',
+  'union-invalid-branch-key.json',
+  'union-invalid-data.json',
+  'union-invalid-discriminator.json',
+  'union-invalid-if-discriminator.json',
+  'union-no-base.json',
+  'union-optional-discriminator.json',
+  'union-string-discriminator.json',
   'union-unknown.json',
   'unknown-escape.json',
   'unknown-expr-key.json',
 ]
+schemas = files(schemas)
+
+# Intentionally missing schema file test -- not passed through files():
+schemas += [meson.current_source_dir() / 'missing-schema.json']
 
 # Because people may want to use test-qapi.py from the command line, we
 # are not using the "#! /usr/bin/env python3" trick here.  See
-# docs/devel/build-system.txt
-test('QAPI schema regression tests', python, args: files('test-qapi.py', schemas),
+# docs/devel/build-system.rst
+test('QAPI schema regression tests', python,
+     args: files('test-qapi.py') + schemas,
      env: test_env, suite: ['qapi-schema', 'qapi-frontend'])
 
 diff = find_program('diff')
@@ -218,53 +227,53 @@ qapi_doc = custom_target('QAPI doc',
                                     '-p', 'doc-good-', '@INPUT0@' ],
                          depend_files: qapi_gen_depends)
 
-# Test the document-comment document generation code by running a test schema
-# file through Sphinx's plain-text builder and comparing the result against
-# a golden reference. This is in theory susceptible to failures if Sphinx
-# changes its output, but the text output has historically been very stable
-# (no changes between Sphinx 1.6 and 3.0), so it is a better bet than
-# texinfo or HTML generation, both of which have had changes. We might
-# need to add more sophisticated logic here in future for some sort of
-# fuzzy comparison if future Sphinx versions produce different text,
-# but for now the simple comparison suffices.
-qapi_doc_out = custom_target('QAPI rST doc',
-                             output: ['doc-good.txt'],
-                             input: files('doc-good.json', 'doc-good.rst'),
-                             build_by_default: build_docs,
-                             depend_files: sphinx_extn_depends,
-                             # We use -E to suppress Sphinx's caching, because
-                             # we want it to always really run the QAPI doc
-                             # generation code. It also means we don't
-                             # clutter up the build dir with the cache.
-                             command: [SPHINX_ARGS,
-                                       '-b', 'text', '-E',
-                                       '-c', meson.source_root() / 'docs',
-                                       '-D', 'master_doc=doc-good',
-                                       meson.current_source_dir(),
-                                       meson.current_build_dir()])
+if build_docs
+  # Test the document-comment document generation code by running a test schema
+  # file through Sphinx's plain-text builder and comparing the result against
+  # a golden reference. This is in theory susceptible to failures if Sphinx
+  # changes its output, but the text output has historically been very stable
+  # (no changes between Sphinx 1.6 and 3.0), so it is a better bet than
+  # texinfo or HTML generation, both of which have had changes. We might
+  # need to add more sophisticated logic here in future for some sort of
+  # fuzzy comparison if future Sphinx versions produce different text,
+  # but for now the simple comparison suffices.
+  qapi_doc_out = custom_target('QAPI rST doc',
+                               output: ['doc-good.txt'],
+                               input: files('doc-good.json', 'doc-good.rst'),
+                               build_by_default: true,
+                               depend_files: sphinx_extn_depends,
+                               # We use -E to suppress Sphinx's caching, because
+                               # we want it to always really run the QAPI doc
+                               # generation code. It also means we don't
+                               # clutter up the build dir with the cache.
+                               command: [SPHINX_ARGS,
+                                         '-b', 'text', '-E',
+                                         '-c', meson.project_source_root() / 'docs',
+                                         '-D', 'master_doc=doc-good',
+                                         meson.current_source_dir(),
+                                         meson.current_build_dir()])
 
-# Fix possible inconsistency in line endings in generated output and
-# in the golden reference (which could otherwise cause test failures
-# on Windows hosts). Unfortunately diff --strip-trailing-cr
-# is GNU-diff only. The odd-looking perl is because we must avoid
-# using an explicit '\' character in the command arguments to
-# a custom_target(), as Meson will unhelpfully replace it with a '/'
-# (https://github.com/mesonbuild/meson/issues/1564)
-qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
-                                  output: ['doc-good.txt.nocr'],
-                                  input: qapi_doc_out[0],
-                                  build_by_default: build_docs,
-                                  command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
-                                  capture: true)
+  # Fix possible inconsistency in line endings in generated output and
+  # in the golden reference (which could otherwise cause test failures
+  # on Windows hosts). Unfortunately diff --strip-trailing-cr
+  # is GNU-diff only. The odd-looking perl is because we must avoid
+  # using an explicit '\' character in the command arguments to
+  # a custom_target(), as Meson will unhelpfully replace it with a '/'
+  # (https://github.com/mesonbuild/meson/issues/1564)
+  qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
+                                    output: ['doc-good.txt.nocr'],
+                                    input: qapi_doc_out[0],
+                                    build_by_default: true,
+                                    command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
+                                    capture: true)
 
-qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
-                                  output: ['doc-good.ref.nocr'],
-                                  input: files('doc-good.txt'),
-                                  build_by_default: build_docs,
-                                  command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
-                                  capture: true)
+  qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
+                                    output: ['doc-good.ref.nocr'],
+                                    input: files('doc-good.txt'),
+                                    build_by_default: true,
+                                    command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
+                                    capture: true)
 
-if build_docs
   # "full_path()" needed here to work around
   # https://github.com/mesonbuild/meson/issues/7585
   test('QAPI rST doc', diff, args: ['-u', qapi_doc_ref_nocr[0].full_path(),