From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4413 invoked by alias); 20 Sep 2004 06:48:31 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 4391 invoked from network); 20 Sep 2004 06:48:30 -0000 Received: from unknown (HELO johanna.resare.com) (193.14.119.138) by sourceware.org with SMTP; 20 Sep 2004 06:48:30 -0000 Received: from molly.resare.com (c-2f1f72d5.01-60-6c6b701.cust.bredbandsbolaget.se [213.114.31.47]) by johanna.resare.com (Postfix) with ESMTP id 2BFB8D6DDA for ; Mon, 20 Sep 2004 08:47:42 +0200 (CEST) Received: from [192.168.110.42] (marit [192.168.110.42]) by molly.resare.com (Postfix) with ESMTP id 259E7D42EE for ; Mon, 20 Sep 2004 08:48:29 +0200 (CEST) Subject: Re: [PATCH] xml output from mauve (updated) From: Noa Resare To: mauve-discuss@sources.redhat.com In-Reply-To: <1095630709.1284.65.camel@localhost.localdomain> References: <1095456018.2660.33.camel@marit.resare.com> <1095540446.2660.48.camel@c-351f72d5.01-60-6c6b701.cust.bredbandsbolaget.se> <1095630709.1284.65.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="=-m/OAg3Bz/3X6YBeTNEBl" Date: Mon, 20 Sep 2004 06:48:00 -0000 Message-Id: <1095662908.25818.19.camel@c-351f72d5.01-60-6c6b701.cust.bredbandsbolaget.se> Mime-Version: 1.0 X-SW-Source: 2004-q3/txt/msg00023.txt.bz2 --=-m/OAg3Bz/3X6YBeTNEBl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 1783 On sön, 2004-09-19 at 23:51 +0200, Mark Wielaard wrote: > Hi, > > On Sat, 2004-09-18 at 22:47, Noa Resare wrote: > > On fre, 2004-09-17 at 23:20 +0200, Noa Resare wrote: > > > So, I did some afternoon hacking and came up with this patch to mauve > > > that outputs the results from a mauve run into an xml file for easy > > > parsing. I haven't written anything that does anything with the output > > > yet but I thought I could share this with you anyway. > > > > This updated patch handles mauve output containing & < and > properly. > > It also adds Makefile.am to the changelog entry. > > > > ps. a test result diff program (that looks for regressions) in very > > rough form is available from http://resare.com/noa/testdiff > > Very nice! > > Maybe this should be written as a new XMLTestHarness class? > Although I don't really see a problem with just tagging it on the > SimpleTestHarness. Opinions anybody? Maybe that would be better. However, I don't think the current solution is horribly ugly and I'd rather use that time trying to contribute to fixing jvm bugs. I'm open to suggestions though :) > Are you sure the XML escaping is always correct? > Maybe it doesn't really matter in this case, but you might want to look > whether GNU Kawa (http://www.gnu.org/software/kawa/) has something > appropriate in the gnu.xml package. I'm think escaping is correct except for the case when any of the properties used to identify a jvm in the output header or a class name contains a single quote ('). The attached patch fixes this and applies on top of my previous patch. /noa -- And the lions ate the christians and the christians burned the witches, and even I am out of explanations -- Ola Salo gpg fingerprint: F3C4 AC90 B885 FE15 344B 4D05 220B 7662 A190 6F09 --=-m/OAg3Bz/3X6YBeTNEBl Content-Disposition: attachment; filename=mauve-xmlout-escape.patch Content-Type: text/x-patch; name=mauve-xmlout-escape.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 2258 --- mauve/gnu/testlet/TestReport.java.vanilla 2004-09-20 08:20:22.653300790 +0200 +++ mauve/gnu/testlet/TestReport.java 2004-09-20 08:43:54.765740326 +0200 @@ -68,18 +68,19 @@ Writer out = new OutputStreamWriter(new FileOutputStream(f), ENCODING); out.write("\n"); out.write("\n \n"); + escAttrib(systemProperties.get("java.vm.vendor")) + + "'\n version='" + + escAttrib(systemProperties.get("java.vm.version")) + "' \n" + + " os='" + escAttrib(systemProperties.get("os.name")) + " " + + escAttrib(systemProperties.get("os.version")) + " " + + escAttrib(systemProperties.get("os.arch")) + "' />\n"); Collections.sort(testResults); Iterator results = testResults.iterator(); while (results.hasNext()) { TestResult tr = (TestResult) results.next(); String[] failures = tr.getFailMessags(); - out.write(" \n"); @@ -92,7 +93,8 @@ if (tr.getException() != null) { Throwable t = tr.getException(); - out.write(" \n " + esc(tr.getExceptionMessage()) + "\n " + esc(t.getMessage()) + "\n \n"); @@ -117,4 +119,16 @@ str = str.replaceAll(">", ">"); return str; } + + /** + * Escapes single quotes in string by prepending a backslash. + */ + private String escAttrib(Object obj) + { + if (obj == null) + return null; + String str = (String)obj; + str = str.replaceAll("'", "\\'"); + return str; + } } --=-m/OAg3Bz/3X6YBeTNEBl--