Received: from eggs.gnu.org ([2001:4830:134:3::10]:36262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX44H-0005fx-Hf for qemu-devel@nongnu.org; Thu, 25 Sep 2014 04:06:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX449-0003eE-Rz for qemu-devel@nongnu.org; Thu, 25 Sep 2014 04:06:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX449-0003dq-L6 for qemu-devel@nongnu.org; Thu, 25 Sep 2014 04:06:17 -0400 From: Markus Armbruster References: <1411165504-18198-1-git-send-email-eblake@redhat.com> <1411165504-18198-13-git-send-email-eblake@redhat.com> <87h9zw9mqy.fsf@blackfin.pond.sub.org> Date: Thu, 25 Sep 2014 10:06:07 +0200 In-Reply-To: <87h9zw9mqy.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Thu, 25 Sep 2014 09:34:45 +0200") Message-ID: <87y4t85dlc.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 12/19] qapi: Add some type check tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Fam Zheng , qemu-devel@nongnu.org, wenchaoqemu@gmail.com, Luiz Capitulino Markus Armbruster writes: > Eric Blake writes: > >> Demonstrate that the qapi generator silently parses confusing >> types, which may cause other errors later on. Later patches >> will update the expected results as the generator is made stricter. [...] >> diff --git a/tests/qapi-schema/returns-array-bad.json >> b/tests/qapi-schema/returns-array-bad.json >> new file mode 100644 >> index 0000000..14882c1 >> --- /dev/null >> +++ b/tests/qapi-schema/returns-array-bad.json >> @@ -0,0 +1,2 @@ >> +# FIXME: we should reject an array return that is not a single type >> +{ 'command': 'oops', 'returns': [ 'str', 'str' ] } Yes, we want this test, and your remaining tests of 'returns' are fine, too. > Do we want to permit anything but a complex type for 'returns'? > > For what it's worth, docs/qmp/qmp-spec.txt specifies: > > 2.4.1 success > ------------- > > The format of a success response is: > > { "return": json-object, "id": json-value } > > Where, > > - The "return" member contains the command returned data, which is defined > in a per-command basis or an empty json-object if the command does not > return data > - The "id" member contains the transaction identification associated > with the command execution if issued by the Client > > The QAPI schema's 'returns' becomes "return" on the wire. We suck. > > qmp-spec.txt is *wrong*! We actually use json-array in addition to > json-object. Actually, we use json-int and json-str as well: query-migrate-cache-size, ringbuf-read, human-monitor-command. > Similar argument on types wanted as for 'data' / "arguments" above. I > think we should permit exactly the same QAPI types, plus lists. The similarity to 'data' just isn't there. Separate analysis needed. Any QAPI types that don't make sense, other than list with length != 1? [...]