Received: from eggs.gnu.org ([2001:4830:134:3::10]:39201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWD2-0000GI-11 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 11:59:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKWCv-0003tZ-6c for qemu-devel@nongnu.org; Mon, 03 Mar 2014 11:59:19 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:56231 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWCu-0003t3-Px for qemu-devel@nongnu.org; Mon, 03 Mar 2014 11:59:13 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= 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> <87vbvvwaog.fsf@blackfin.pond.sub.org> Date: Mon, 03 Mar 2014 17:59:08 +0100 In-Reply-To: <87vbvvwaog.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Mon, 03 Mar 2014 16:42:39 +0100") Message-ID: <87zjl7w74z.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain 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: Markus Armbruster Cc: qemu-devel@nongnu.org Markus Armbruster writes: [...] >>>> self.fp = schema.fp >>>> self.msg = msg >>>> self.line = self.col = 1 >>>> @@ -50,12 +52,17 @@ class QAPISchemaError(Exception): >>>> self.col += 1 >>>> >>>> def __str__(self): >>>> - return "%s:%s:%s: %s" % (self.fp.name, self.line, self.col, >>>> self.msg) >>>> + name = 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 verified >> with diff. Otherwise the actual message depends on the path from which you'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=$(SRC_PATH)/scripts $(PYTHON) $(SRC_PATH)/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? Right. Paths are internally stored as absolute in "qapi.py" (to check for include cycles), and the "base directory" is only used to show them as relative. I can try to change the code to retain this functionality but without special-casing the tests. Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth