qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators
@ 2023-09-11 11:13 Victor Toso
  2023-09-11 11:13 ` [PATCH v2 11/11] qapi: scripts: add a generator for qapi's examples Victor Toso
  2023-09-11 11:26 ` [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators Victor Toso
  0 siblings, 2 replies; 4+ messages in thread
From: Victor Toso @ 2023-09-11 11:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster, John Snow, Daniel P . Berrangé

The next patch adds a generator that also validates qapi
documentation. We don't want to execute it with a test schema.

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 scripts/qapi/main.py | 4 ++++
 tests/meson.build    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py
index 316736b6a2..7efdcc6b8d 100644
--- a/scripts/qapi/main.py
+++ b/scripts/qapi/main.py
@@ -33,6 +33,7 @@ def generate(schema_file: str,
              prefix: str,
              unmask: bool = False,
              builtins: bool = False,
+             test_schema: bool = False,
              gen_tracing: bool = False) -> None:
     """
     Generate C code for the given schema into the target directory.
@@ -75,6 +76,8 @@ def main() -> int:
     parser.add_argument('-u', '--unmask-non-abi-names', action='store_true',
                         dest='unmask',
                         help="expose non-ABI names in introspection")
+    parser.add_argument('-t', '--tests', action='store_true',
+                        help="flag generator that is running with a test schema")
 
     # Option --suppress-tracing exists so we can avoid solving build system
     # problems.  TODO Drop it when we no longer need it.
@@ -96,6 +99,7 @@ def main() -> int:
                  prefix=args.prefix,
                  unmask=args.unmask,
                  builtins=args.builtins,
+                 test_schema=args.tests,
                  gen_tracing=not args.suppress_tracing)
     except QAPIError as err:
         print(err, file=sys.stderr)
diff --git a/tests/meson.build b/tests/meson.build
index debaa4505e..ed0844a6a0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -43,7 +43,7 @@ test_qapi_files = custom_target('Test QAPI files',
                                              'qapi-schema/include/sub-module.json',
                                              'qapi-schema/sub-sub-module.json'),
                                 command: [ qapi_gen, '-o', meson.current_build_dir(),
-                                           '-b', '-p', 'test-', '@INPUT0@',
+                                           '-t', '-b', '-p', 'test-', '@INPUT0@',
                                            '--suppress-tracing' ],
                                 depend_files: qapi_gen_depends)
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH v2 00/11] Validate and test qapi examples
@ 2023-09-11 10:40 Victor Toso
  2023-09-11 11:27 ` [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators Victor Toso
  0 siblings, 1 reply; 4+ messages in thread
From: Victor Toso @ 2023-09-11 10:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster, John Snow, Daniel P . Berrangé

Hi,

v1: https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg00853.html

Changes:
- Fixed running the generator with tests (Daniel). Added a flag for the
  generator, set in tests/meson.build (Philippe).
- Moved the script to the end of the series, to avoid git bisect issues
  (Daniel)
- Added a proper assert() to the generator, making it fail if any
  documentation error was found instead of just printing to the stderr
  and carry on. (Daniel)
- Fixed the 3 other warnings the generator was showing, we are 100% free
  of warnings (in my machine)

Cheers,
Victor

Victor Toso (11):
  qapi: fix example of get-win32-socket command
  qapi: fix example of dumpdtb command
  qapi: fix example of cancel-vcpu-dirty-limit command
  qapi: fix example of set-vcpu-dirty-limit command
  qapi: fix example of calc-dirty-rate command
  qapi: fix example of NETDEV_STREAM_CONNECTED event
  qapi: fix example of query-rocker-of-dpa-flows command
  qapi: fix example of query-spice command
  qapi: fix example of query-blockstats command
  qapi: meson: add test flag to allow skip generators
  qapi: scripts: add a generator for qapi's examples

 qapi/block-core.json         |  32 +++---
 qapi/machine.json            |   2 +-
 qapi/migration.json          |   6 +-
 qapi/misc.json               |   2 +-
 qapi/net.json                |   6 +-
 qapi/rocker.json             |   3 +-
 qapi/ui.json                 |   3 +-
 scripts/qapi/dumpexamples.py | 204 +++++++++++++++++++++++++++++++++++
 scripts/qapi/main.py         |   9 +-
 tests/meson.build            |   2 +-
 10 files changed, 239 insertions(+), 30 deletions(-)
 create mode 100644 scripts/qapi/dumpexamples.py

-- 
2.41.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-11 11:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 11:13 [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators Victor Toso
2023-09-11 11:13 ` [PATCH v2 11/11] qapi: scripts: add a generator for qapi's examples Victor Toso
2023-09-11 11:26 ` [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators Victor Toso
  -- strict thread matches above, loose matches on Subject: below --
2023-09-11 10:40 [PATCH v2 00/11] Validate and test qapi examples Victor Toso
2023-09-11 11:27 ` [PATCH v2 10/11] qapi: meson: add test flag to allow skip generators Victor Toso
2023-09-11 11:27   ` [PATCH v2 11/11] qapi: scripts: add a generator for qapi's examples Victor Toso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).