1. 04 9月, 2017 4 次提交
    • M
      qlit: move qlit from check-qjson to qobject/ · 28035bcd
      Marc-André Lureau 提交于
      Fix code style issues while at it, to please checkpatch.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20170825105913.4060-3-marcandre.lureau@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      28035bcd
    • M
      qdict: Add qdict_put_null() helper, and put it to use · 0f9afc2a
      Marc-André Lureau 提交于
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20170825105913.4060-2-marcandre.lureau@redhat.com>
      [Update to qobject.cocci squashed in, commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      0f9afc2a
    • M
      qobject: Explain how QNum works, and why · f90cb284
      Markus Armbruster 提交于
      Suggested-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1503384739-17207-1-git-send-email-armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      [Comment typos fixed]
      f90cb284
    • M
      tests/qmp-test: Add generic, basic test of query commands · e4a426e7
      Markus Armbruster 提交于
      A command is a query if it has no side effect and yields a result.
      Such commands are typically named query-FOO, but there are exceptions.
      
      The basic idea is to find candidates with query-qmp-schema, filter out
      the ones that aren't queries with an explicit blacklist, and test the
      remaining ones against a QEMU with no special arguments.
      
      The current blacklist is just add-fd.
      
      The test can't do queries with arguments, because it knows nothing
      about the arguments.  No coverage for query-cpu-model-baseline,
      query-cpu-model-comparison, query-cpu-model-expansion, query-rocker,
      query-rocker-ports, query-rocker-of-dpa-flows, and
      query-rocker-of-dpa-groups.
      
      Most tested commands are expected to succeed.  The test does not check
      the return value then.
      
      query-balloon and query-vm-generation-id are expected to fail because
      they need a virtio-balloon / vmgenid device to succeed, and this test
      is too dumb to set one up.  Could be addressed later.
      
      query-acpi-ospm-status and query-hotpluggable-cpus are expected to
      fail because they require features provided only by special machine
      types, and this test is too dumb to set that up.  Could also be
      addressed later.
      
      Several commands may either be functional or stubs that always fail,
      depending on build configuration.  Ideally, the stubs shouldn't be in
      query-qmp-schema, but that requires QAPI schema compile-time
      configuration, which we don't have, yet.  Until we do, we need to
      figure out whether a command is a stub.  When we have a suitable
      CONFIG_FOO preprocessor symbol is available, use that.  Else,
      simply blacklist the command for now.
      
      We get basic test coverage for the following commands, except as
      noted:
      
          qom-list-types
          query-acpi-ospm-status      (expected to fail)
          query-balloon               (expected to fail)
          query-block
          query-block-jobs
          query-blockstats
          query-chardev
          query-chardev-backends
          query-command-line-options
          query-commands
          query-cpu-definitions       (blacklisted for now)
          query-cpus
          query-dump
          query-dump-guest-memory-capability
          query-events
          query-fdsets
          query-gic-capabilities      (blacklisted for now)
          query-hotpluggable-cpus     (expected to fail)
          query-iothreads
          query-kvm
          query-machines
          query-memdev
          query-memory-devices
          query-mice
          query-migrate
          query-migrate-cache-size
          query-migrate-capabilities
          query-migrate-parameters
          query-name
          query-named-block-nodes
          query-pci                   (blacklisted for now)
          query-qmp-schema
          query-rx-filter
          query-spice
          query-status
          query-target
          query-tpm
          query-tpm-models
          query-tpm-types
          query-uuid
          query-version
          query-vm-generation-id      (expected to fail)
          query-vnc
          query-vnc-servers
          query-xen-replication-status
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1502461148-10154-1-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [Typos in code under #ifndef and in the commit message fixed]
      e4a426e7
  2. 01 9月, 2017 1 次提交
    • E
      qapi: Fix error handling code on alternate conflict · fda72ab4
      Eduardo Habkost 提交于
      The conflict check added by commit c0644771 ("qapi: Reject
      alternates that can't work with keyval_parse()") doesn't work
      with the following declaration:
      
        { 'alternate': 'Alt',
          'data': { 'one': 'bool',
                    'two': 'str' } }
      
      It crashes with:
      
        Traceback (most recent call last):
          File "./scripts/qapi-types.py", line 295, in <module>
            schema = QAPISchema(input_file)
          File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 1468, in __init__
            self.exprs = check_exprs(parser.exprs)
          File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 958, in check_exprs
            check_alternate(expr, info)
          File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 830, in check_alternate
            % (name, key, types_seen[qtype]))
        KeyError: 'QTYPE_QSTRING'
      
      This happens because the previously-seen conflicting member
      ('one') can't be found at types_seen[qtype], but at
      types_seen['QTYPE_BOOL'].
      
      Fix the bug by moving the error check to the same loop that adds
      new items to types_seen, raising an exception if types_seen[qt]
      is already set.
      
      Add two additional test cases that can detect the bug.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20170717180926.14924-1-ehabkost@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fda72ab4
  3. 31 8月, 2017 35 次提交