From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jSH-0004zU-RG for qemu-devel@nongnu.org; Fri, 26 Jul 2013 10:57:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2jSC-0007fq-UD for qemu-devel@nongnu.org; Fri, 26 Jul 2013 10:57:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jSC-0007fb-MJ for qemu-devel@nongnu.org; Fri, 26 Jul 2013 10:57:12 -0400 Message-ID: <51F28E44.2060701@redhat.com> Date: Fri, 26 Jul 2013 08:57:08 -0600 From: Eric Blake MIME-Version: 1.0 References: <1374842387-17146-1-git-send-email-armbru@redhat.com> <1374842387-17146-2-git-send-email-armbru@redhat.com> <51F27021.60905@redhat.com> <87bo5pl83s.fsf@blackfin.pond.sub.org> In-Reply-To: <87bo5pl83s.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Pp4j2fV23XTr16XC5AOARqTsJbAaWxrNo" Subject: Re: [Qemu-devel] [PATCH 1/9] tests: QAPI schema parser tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: aliguori@us.ibm.com, akong@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Pp4j2fV23XTr16XC5AOARqTsJbAaWxrNo Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/26/2013 08:16 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> On 07/26/2013 06:39 AM, Markus Armbruster wrote: >>> The parser handles erroneous input badly. To be improved shortly. >>> >>> Signed-off-by: Markus Armbruster >>> --- >> >> Lots of proof on how bad it is! I'd also like to see a couple tests o= n >> trailing commas: >> >> { 'enum': 'Foo', [ 'bar' ], } >> { 'enum': 'Gur', [ 'ble', ] } >=20 > I figure you mean >=20 > { 'enum': 'Foo', 'data': [ 'bar' ], } > { 'enum': 'Gur', 'data': [ 'ble', ] } Yep, you got my intent, even if I didn't type it right. >=20 > My parser rejects both: >=20 > :1:37: Expected string > :2:35: Expected "{", "[" or string Good! >=20 > I commented out the first to get the second error. Making the parser > continue after errors didn't seem to be worthwhile. Agree about not continuing after errors; once the file is clean, anyone adding a new command will have errors in at most the one command they are trying to add, and even if it is an iterative approach to get them to find all the problems, it's a lot easier to have that one developer fix their work than trying to bake error recovery into the parser. If you do add these two test cases (which I recommend), it should indeed be two separate tests. Another thought - is it worth testing other valid JSON but invalid schema constructs, such as: { 'enum': 1, 'data': false } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Pp4j2fV23XTr16XC5AOARqTsJbAaWxrNo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR8o5EAAoJEKeha0olJ0NqOWQH/1hQhahNfI2HgZThQJ6OiDBf vukfHWVdm+EuQMgcZwSNYgrzlvNZZml9EPH81K57wLSkwavBl/c5485b8xWTxtRe cEnHSbn4fAPl0XokP3LR8sMwB7v97wIzKmYQ1vUj3qW5Z37U9nT1RV9RBS9HB4lZ XLcQ1Zq5yuedeRhdR37b+6z/MPUWIYROgNWDOUXqGDe2Y1crh9rd6zgxIdDR0WF3 0AgfYbn5Rg24gfAiU3yHSX8oMW8VbVubYVCbhZJXMvAJbfRRhwpic1cQG01OnYIy WIU7ZIpcNgLH4vllD+Rmyva/+HWA3jxXt2EpQWmyYWu9XoIGMFAqK/j+VpfxJRU= =M/4V -----END PGP SIGNATURE----- --Pp4j2fV23XTr16XC5AOARqTsJbAaWxrNo--