1. 06 5月, 2015 9 次提交
    • E
      qapi: Clean up test coverage of simple unions · 805017b7
      Eric Blake 提交于
      The tests of UserDefNativeListUnion serve to validate code
      generation of simple unions without a base type, except that it
      did not have full coverage in the strict test.  The next commits
      will remove tests and support for simple unions with a base type,
      so there is no real loss at repurposing that test here as
      opposed to churn of adding a new test then deleting the old one.
      
      Fix some indentation and long lines while at it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      805017b7
    • E
      qapi: Add some union tests · 3d0c4829
      Eric Blake 提交于
      Demonstrate that the qapi generator doesn't deal well with unions
      that aren't up to par. Later patches will update the expected
      reseults as the generator is made stricter.  A few tests work
      as planned, but most show poor or missing error messages.
      
      Of particular note, qapi-code-gen.txt documents 'base' only for
      flat unions, but the tests here demonstrate that we currently allow
      a 'base' to a simple union, although it is exercised only in the
      testsuite.  Later patches will remove this undocumented feature, to
      give us more flexibility in adding other future extensions to union
      types.  For example, one possible extension is the idea of a
      type-safe simple enum, where added fields tie the discriminator to
      a user-defined enum type rather than creating an implicit enum from
      the names in 'data'.  But adding such safety on top of a simple
      enum with a base type could look ambiguous with a flat enum;
      besides, the documentation also mentions how any simple union can
      be represented by an equivalent flat union.  So it will be simpler
      to just outlaw support for something we aren't using.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3d0c4829
    • E
      qapi: Better error messages for bad enums · cf393590
      Eric Blake 提交于
      The previous commit demonstrated that the generator had several
      flaws with less-than-perfect enums:
      - an enum that listed the same string twice (or two variant
      strings that map to the same C enumerator) ended up generating
      an invalid C enum
      - because the generator adds a _MAX terminator to each enum,
      the use of an enum member 'max' can also cause this clash
      - if an enum omits 'data', the generator left a python stack
      trace rather than a graceful message
      - an enum that used a non-array 'data' was silently accepted by
      the parser
      - an enum that used non-string members in the 'data' member
      was silently accepted by the parser
      
      Add check_enum to cover these situations, and update testcases
      to match.  While valid .json files won't trigger any of these
      cases, we might as well be nicer to developers that make a typo
      while trying to add new QAPI code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cf393590
    • E
      qapi: Add some enum tests · ad11dbb9
      Eric Blake 提交于
      Demonstrate that the qapi generator doesn't deal well with enums
      that aren't up to par. Later patches will update the expected
      results as the generator is made stricter.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ad11dbb9
    • E
      qapi: Require ASCII in schema · fe2a9303
      Eric Blake 提交于
      Python 2 and Python 3 have a wild history of whether strings
      default to ascii or unicode, where Python 3 requires checking
      isinstance(foo, basestr) to cover all strings, but where that
      code is not portable to Python 2.  It's simpler to just state
      that we don't care about Unicode strings, and to just always
      use the simpler isinstance(foo, str) everywhere.
      
      I'm no python expert, so I'm basing it on this conversation:
      https://lists.gnu.org/archive/html/qemu-devel/2014-09/msg05278.htmlSigned-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fe2a9303
    • E
      qapi: Fix generation of 'size' builtin type · cb17f79e
      Eric Blake 提交于
      We were missing the 'size' builtin type (which means that QAPI using
      [ 'size' ] would fail to compile).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cb17f79e
    • E
      qapi: Simplify builtin type handling · b52c4b9c
      Eric Blake 提交于
      There was some redundancy between builtin_types[] and
      builtin_type_qtypes{}.  Merge them into one.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b52c4b9c
    • E
      qapi: Document type-safety considerations · e790e666
      Eric Blake 提交于
      Go into more details about the various types of valid expressions
      in a qapi schema, including tweaks to document fixes being done
      later in the current patch series.  Also fix some stale and missing
      documentation in the QMP specification.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      e790e666
    • E
      qapi: Add copyright declaration on docs · 6fb55451
      Eric Blake 提交于
      While our top-level COPYING with its GPLv2+ license applies to
      any documentation file that omits explicit instructions, these
      days it's better to be a good example of calling out our
      intentions.  Correct use of GPL requires the use of a copyright
      statement, so I'm adding notice to two QAPI documents, by
      attributing these files to the initial authors and major
      contributors.  I used:
      
      $ git blame --line-porcelain $file \
        | sed -n 's/^author //p' | sort | uniq -c | sort -rn
      
      to determine authorship of these two files.  qmp-spec.txt blames
      entirely to Red Hat (easy, since my contribution falls in that
      category); while qapi-code-gen.txt has multiple contributors
      representing multiple entities.  But since it was originally
      supplied by Michael Roth, the notice I added there copies the
      notice he has used in other files.  As there is no intended
      change in license from the implicit one previously present from
      the top level, I have not bothered to CC other contributors;
      if we want to weaken things to something looser (such as LGPL)
      so that there is no question that someone re-implementing the
      spec is not forced to use GPL, that would be a different commit.
      
      CC: Michael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      6fb55451
  2. 05 5月, 2015 9 次提交
  3. 01 5月, 2015 1 次提交
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 5bccbb04
      Peter Maydell 提交于
      Block patches
      
      # gpg: Signature made Thu Apr 30 19:51:16 2015 BST using RSA key ID C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
      
      * remotes/kevin/tags/for-upstream:
        Enable NVMe start controller for Windows guest.
        MAINTAINERS: Add qemu-block list where missing
        MAINTAINERS: make block layer core Kevin Wolf's responsibility
        MAINTAINERS: make image fuzzer Stefan Hajnoczi's responsibility
        MAINTAINERS: make block I/O path Stefan Hajnoczi's responsibility
        MAINTAINERS: split out image formats
        MAINTAINERS: make virtio-blk Stefan Hajnoczi's responsibility
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      5bccbb04
  4. 30 4月, 2015 21 次提交