From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKV0y-0004Jb-U3 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 10:42:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKV0u-0001dC-I6 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 10:42:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKV0u-0001d2-8H for qemu-devel@nongnu.org; Mon, 03 Mar 2014 10:42:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s23Fggww005422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 3 Mar 2014 10:42:42 -0500 Received: from blackfin.pond.sub.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s23FgeA9024350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 3 Mar 2014 10:42:41 -0500 From: Markus Armbruster References: <20140228155309.28087.96600.stgit@fimbulvetr.bsc.es> <20140228155316.28087.30919.stgit@fimbulvetr.bsc.es> <87ob1qgvtj.fsf@blackfin.pond.sub.org> <87y50rxsss.fsf@fimbulvetr.bsc.es> Date: Mon, 03 Mar 2014 16:42:39 +0100 In-Reply-To: <87y50rxsss.fsf@fimbulvetr.bsc.es> (=?utf-8?Q?=22Llu=C3=ADs?= Vilanova"'s message of "Mon, 03 Mar 2014 15:25:55 +0100") Message-ID: <87vbvvwaog.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 1/3] qapi: Use an explicit input file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Llu=C3=ADs Vilanova writes: > Markus Armbruster writes: > >> Llu=C3=ADs Vilanova writes: > [...] >>> diff --git a/scripts/qapi.py b/scripts/qapi.py >>> index 9b3de4c..59c2b9b 100644 >>> --- a/scripts/qapi.py >>> +++ b/scripts/qapi.py >>> @@ -12,6 +12,7 @@ >>> # See the COPYING.LIB file in the top-level directory. >>>=20 >>> from ordereddict import OrderedDict >>> +import os >>> import sys >>>=20 >>> builtin_types =3D [ >>> @@ -37,6 +38,7 @@ builtin_type_qtypes =3D { >>>=20 >>> class QAPISchemaError(Exception): >>> def __init__(self, schema, msg): >>> + self.base =3D schema.error_base > >> Non-obvious identifiers. Took me some reading on to figure out that >> this is a directory. > > Will fix. > > >>> self.fp =3D schema.fp >>> self.msg =3D msg >>> self.line =3D self.col =3D 1 >>> @@ -50,12 +52,17 @@ class QAPISchemaError(Exception): >>> self.col +=3D 1 >>>=20 >>> def __str__(self): >>> - return "%s:%s:%s: %s" % (self.fp.name, self.line, self.col, >>> self.msg) >>> + name =3D os.path.relpath(self.fp.name, self.base) >>> + return "%s:%s:%s: %s" % (name, self.line, self.col, self.msg) > >> Can you explain what this change does, and why it's wanted? > > Paths are shown as relative so that the test outputs (stderr) can be veri= fied > with diff. Otherwise the actual message depends on the path from which yo= u're > running the tests. Hmm. This is the applicable make rule: $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%= .json $(call quiet-command, PYTHONPATH=3D$(SRC_PATH)/scripts $(PYTHON) $(SRC_PAT= H)/tests/qapi-schema/test-qapi.py "$^" >$*.test.out 2>$*.test.err; echo $$?= >$*.test.exit, " TEST $*.out") @diff -q $(SRC_PATH)/$*.out $*.test.out @diff -q $(SRC_PATH)/$*.err $*.test.err @diff -q $(SRC_PATH)/$*.exit $*.test.exit Since $^ is in $(SRC_PATH), it's like $(SRC_PATH)/foo.json. If $(SRC_PATH)/foo.json has an error, the error messages duly points to $(SRC_PATH)/foo.json. The "diff -q $(SRC_PATH)/$*.err $*.test.err" fails unless your SRC_PATH matches the one that's encoded in tests/qapi-schema/foo.err. Is that the problem you're trying to solve? [...]