changeset in /hg/icedtea6: Upgrade to jtreg-4_0-src-b02-15_oct_2...
Mark Wielaard
mark at klomp.org
Sun Nov 9 13:31:58 PST 2008
changeset 76b5306fead0 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=76b5306fead0
description:
Upgrade to jtreg-4_0-src-b02-15_oct_2008.
diffstat:
18 files changed, 1771 insertions(+), 583 deletions(-)
ChangeLog | 21
test/jtreg/README | 2
test/jtreg/com/sun/javatest/diff/Diff.java | 161 ++
test/jtreg/com/sun/javatest/diff/Fault.java | 40
test/jtreg/com/sun/javatest/diff/HTMLReporter.java | 184 ++-
test/jtreg/com/sun/javatest/diff/HTMLWriter.java | 558 ++++++++++
test/jtreg/com/sun/javatest/diff/Main.java | 181 ---
test/jtreg/com/sun/javatest/diff/MultiMap.java | 79 -
test/jtreg/com/sun/javatest/diff/ReportReader.java | 38
test/jtreg/com/sun/javatest/diff/StandardDiff.java | 42
test/jtreg/com/sun/javatest/diff/SuperDiff.java | 342 ++++++
test/jtreg/com/sun/javatest/diff/WorkDirectoryReader.java | 30
test/jtreg/com/sun/javatest/diff/i18n.properties | 30
test/jtreg/com/sun/javatest/regtest/Main.java | 503 ++++-----
test/jtreg/com/sun/javatest/regtest/MainAction.java | 82 -
test/jtreg/com/sun/javatest/regtest/RegressionSecurityManager.java | 17
test/jtreg/com/sun/javatest/regtest/RegressionTestFinder.java | 43
test/jtreg/com/sun/javatest/regtest/i18n.properties | 1
diffs (truncated from 4178 to 500 lines):
diff -r 93e7061da818 -r 76b5306fead0 ChangeLog
--- a/ChangeLog Sun Nov 09 22:27:11 2008 +0100
+++ b/ChangeLog Sun Nov 09 22:29:59 2008 +0100
@@ -1,3 +1,24 @@ 2008-11-09 Mark Wielaard <mark at klomp.o
+2008-11-09 Mark Wielaard <mark at klomp.org>
+
+ * test/jtreg/README,
+ test/jtreg/com/sun/javatest/diff/HTMLReporter.java,
+ test/jtreg/com/sun/javatest/diff/Main.java,
+ test/jtreg/com/sun/javatest/diff/MultiMap.java,
+ test/jtreg/com/sun/javatest/diff/ReportReader.java,
+ test/jtreg/com/sun/javatest/diff/WorkDirectoryReader.java,
+ test/jtreg/com/sun/javatest/diff/i18n.properties,
+ test/jtreg/com/sun/javatest/regtest/Main.java,
+ test/jtreg/com/sun/javatest/regtest/MainAction.java,
+ test/jtreg/com/sun/javatest/regtest/RegressionSecurityManager.java,
+ test/jtreg/com/sun/javatest/regtest/RegressionTestFinder.java,
+ test/jtreg/com/sun/javatest/regtest/i18n.properties,
+ test/jtreg/com/sun/javatest/diff/Diff.java,
+ test/jtreg/com/sun/javatest/diff/Fault.java,
+ test/jtreg/com/sun/javatest/diff/HTMLWriter.java,
+ test/jtreg/com/sun/javatest/diff/StandardDiff.java,
+ test/jtreg/com/sun/javatest/diff/SuperDiff.java,
+ Upgrade to jtreg-4_0-src-b02-15_oct_2008.
+
2008-11-09 Mark Wielaard <mark at klomp.org>
* .hgignore: Add test/check-.*log.
diff -r 93e7061da818 -r 76b5306fead0 test/jtreg/README
--- a/test/jtreg/README Sun Nov 09 22:27:11 2008 +0100
+++ b/test/jtreg/README Sun Nov 09 22:29:59 2008 +0100
@@ -20,7 +20,7 @@ This version is based on:
This version is based on:
- jtharness-oss-4_1_3a-dev
-- jtreg-4_0-src-b01-29_apr_2008
+- jtreg-4_0-src-b02-15_oct_2008
IcedJTReg is distrubuted under the GPLv2.0, like jtreg and jtharness.
See the documents in the legal directory included in this release.
diff -r 93e7061da818 -r 76b5306fead0 test/jtreg/com/sun/javatest/diff/Diff.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jtreg/com/sun/javatest/diff/Diff.java Sun Nov 09 22:29:59 2008 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.javatest.diff;
+
+import com.sun.javatest.Status;
+import com.sun.javatest.TestResult;
+import com.sun.javatest.TestSuite;
+import com.sun.javatest.WorkDirectory;
+import com.sun.javatest.util.I18NResourceBundle;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+public abstract class Diff {
+
+ public abstract boolean report(File outFile) throws Fault, InterruptedException;
+
+ protected boolean diff(List<File> files, File outFile)
+ throws Fault, InterruptedException {
+ this.outFile = outFile;
+ List<DiffReader> list = new ArrayList<DiffReader>();
+ for (File f: files)
+ list.add(open(f));
+
+ PrintWriter prevOut = out;
+ if (out == null && outFile != null) {
+ try {
+ out = new PrintWriter(new BufferedWriter(new FileWriter(outFile))); // FIXME don't want to use PrintWriter
+ } catch (IOException e) {
+ throw new Fault(i18n, "diff.cantOpenFile", outFile, e);
+ }
+ }
+
+ try {
+ initComparator();
+
+ initReporter();
+ reporter.setTitle(title);
+ reporter.setComparator(comparator);
+ reporter.setReaders(list);
+
+ List<int[]> testCounts = new ArrayList<int[]>();
+ MultiMap<String,TestResult> table = new MultiMap<String,TestResult>();
+ for (DiffReader r: list) {
+ int index = table.addColumn(r.getFile().getPath());
+ int[] counts = new int[Status.NUM_STATES];
+ for (TestResult tr: r) {
+ table.addRow(index, tr.getTestName(), tr);
+ counts[tr.getStatus().getType()]++;
+ }
+ testCounts.add(counts);
+ }
+ reporter.setTestCounts(testCounts);
+
+ try {
+ reporter.write(table);
+ } catch (IOException e) {
+ throw new Fault(i18n, "diff.ioError", e);
+ }
+
+ return (reporter.diffs == 0);
+ } finally {
+ if (out != prevOut) {
+// try {
+ out.close();
+// } catch (IOException e) {
+// throw new Fault(i18n, "main.ioError", e);
+// }
+ out = prevOut;
+ }
+ }
+ }
+
+ protected void initFormat() {
+ if (format == null && outFile != null) {
+ String name = outFile.getName();
+ int dot = name.lastIndexOf(".");
+ if (dot != -1)
+ format = name.substring(dot + 1).toLowerCase();
+ }
+ }
+
+ protected void initReporter() throws Fault {
+ if (reporter == null) {
+ try {
+ initFormat();
+ if (format != null && format.equals("html"))
+ reporter = new HTMLReporter(out);
+ else
+ reporter = new SimpleReporter(out);
+ } catch (IOException e) {
+ throw new Fault(i18n, "diff.cantOpenReport", e);
+ }
+ }
+ }
+
+ protected void initComparator() {
+ if (comparator == null)
+ comparator = new StatusComparator(includeReason);
+ }
+
+ protected DiffReader open(File f) throws Fault {
+ if (!f.exists())
+ throw new Fault(i18n, "main.cantFindFile", f);
+
+ try {
+ if (WorkDirectoryReader.accepts(f))
+ return new WorkDirectoryReader(f);
+
+ if (ReportReader.accepts(f))
+ return new ReportReader(f);
+
+ throw new Fault(i18n, "main.unrecognizedFile", f);
+
+ } catch (TestSuite.Fault e) {
+ throw new Fault(i18n, "main.cantOpenFile", f, e);
+ } catch (WorkDirectory.Fault e) {
+ throw new Fault(i18n, "main.cantOpenFile", f, e);
+ } catch (IOException e) {
+ throw new Fault(i18n, "main.cantOpenFile", f, e);
+ }
+
+ }
+
+ protected File outFile;
+ protected PrintWriter out;
+ protected Comparator<TestResult> comparator;
+ protected Reporter reporter;
+ protected boolean includeReason;
+ protected String format;
+ protected String title;
+ private static I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(Diff.class);
+}
diff -r 93e7061da818 -r 76b5306fead0 test/jtreg/com/sun/javatest/diff/Fault.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jtreg/com/sun/javatest/diff/Fault.java Sun Nov 09 22:29:59 2008 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.javatest.diff;
+
+import com.sun.javatest.util.I18NResourceBundle;
+
+/**
+ * Exception to report a problem while executing in Main.
+ */
+public class Fault extends Exception {
+
+ static final long serialVersionUID = 1607979458544175906L;
+
+ Fault(I18NResourceBundle i18n, String s, Object... args) {
+ super(i18n.getString(s, args));
+ }
+}
diff -r 93e7061da818 -r 76b5306fead0 test/jtreg/com/sun/javatest/diff/HTMLReporter.java
--- a/test/jtreg/com/sun/javatest/diff/HTMLReporter.java Sun Nov 09 22:27:11 2008 +0100
+++ b/test/jtreg/com/sun/javatest/diff/HTMLReporter.java Sun Nov 09 22:29:59 2008 +0100
@@ -33,7 +33,6 @@ import java.util.Map;
import com.sun.javatest.TestResult;
import com.sun.javatest.Status;
-import com.sun.javatest.util.HTMLWriter;
import com.sun.javatest.util.I18NResourceBundle;
import static com.sun.javatest.util.HTMLWriter.*;
@@ -47,8 +46,8 @@ import static com.sun.javatest.util.HTML
* Report differences to an HTML file.
*/
public class HTMLReporter extends Reporter {
-
- /** Creates a new instance of SimpleDiffReporter */
+
+ /** Creates a new instance of HTMLReporter */
public HTMLReporter(Writer out) throws IOException {
this.out = new HTMLWriter(out, DOCTYPE);
this.out.setI18NResourceBundle(i18n);
@@ -56,10 +55,40 @@ public class HTMLReporter extends Report
public void write(MultiMap<String, TestResult> table) throws IOException {
this.table = table;
-
size = table.getColumns();
-
+
+ startReport(title);
+
+ out.startTag(H1);
+ if (title == null)
+ out.writeI18N("html.head.notitle");
+ else
+ out.writeI18N("html.head.title", title);
+ out.endTag(H1);
+
+ writeIndexTable();
+ writeMainTable();
+ writeSummary();
+
+ endReport();
+ }
+
+ protected void startReport(String title) throws IOException {
out.startTag(HTML);
+ writeHead(title);
+ out.startTag(BODY);
+ }
+
+ protected void endReport() throws IOException {
+ out.startTag(HR);
+ out.writeI18N("html.generatedAt", new Date());
+ out.endTag(BODY);
+
+ out.endTag(HTML);
+ out.flush();
+ }
+
+ protected void writeHead(String title) throws IOException {
out.startTag(HEAD);
out.startTag(TITLE);
if (title == null)
@@ -74,40 +103,24 @@ public class HTMLReporter extends Report
out.write("tr.head { background-color:#dddddd }");
out.write("tr.odd { background-color:#eeeeee }");
out.write("tr.even { background-color:white } ");
- out.write("td { padding: 0 1em }");
+ out.write("td { padding: 0 .5em }");
out.write("td.pass { background-color:#ddffdd } ");
out.write("td.fail { background-color:#ffdddd } ");
out.write("td.error { background-color:#ddddff } ");
out.write("td.notRun { background-color:#dddddd } ");
+ out.write("th { padding: 0 .5em }");
out.write("hr { margin-top:30px; }");
out.write("\n");
out.endTag(STYLE);
out.endTag(HEAD);
-
- out.startTag(BODY);
- out.startTag(H1);
- if (title == null)
- out.writeI18N("html.head.notitle");
- else
- out.writeI18N("html.head.title", title);
- out.endTag(H1);
- writeHead();
- writeBody();
- writeSummary();
-
- out.startTag(HR);
- out.writeI18N("html.generatedAt", new Date());
- out.endTag(BODY);
-
- out.endTag(HTML);
- out.flush();
- }
-
- private void writeHead() throws IOException {
+
+ }
+
+ private void writeIndexTable() throws IOException {
out.startTag(H2);
out.writeI18N("html.head.sets");
out.endTag(H2);
-
+
out.startTag(TABLE);
out.writeAttr(FRAME, BOX);
out.writeAttr(RULES, GROUPS);
@@ -120,6 +133,7 @@ public class HTMLReporter extends Report
out.startTag(TH);
out.writeI18N("html.th.location");
out.endTag(TH);
+ writeIndexTableInfoHeadings();
// out.startTag(TH);
// out.writeI18N("html.th.type");
// out.endTag(TH);
@@ -146,16 +160,17 @@ public class HTMLReporter extends Report
out.endTag(TH);
out.endTag(TR);
out.endTag(THEAD);
-
+
out.startTag(TBODY);
for (int i = 0; i < size; i++) {
out.startTag(TR);
out.writeAttr(CLASS, (i % 2 == 0 ? EVEN : ODD));
out.startTag(TD);
- out.write(String.valueOf(i));
+ out.write(String.valueOf(i + 1));
out.endTag(TD);
out.startTag(TD);
out.write(table.getColumnName(i));
+ writeIndexTableInfoValues(table.getColumnName(i));
out.endTag(TD);
// out.startTag(TD);
// out.write("??");
@@ -166,7 +181,7 @@ public class HTMLReporter extends Report
out.startTag(TD);
if (counts[c] > 0)
out.write(String.valueOf(counts[c]));
- else
+ else
out.writeEntity(" ");
total += counts[c];
out.endTag(TD);
@@ -179,8 +194,14 @@ public class HTMLReporter extends Report
out.endTag(TBODY);
out.endTag(TABLE);
}
-
- private void writeBody() throws IOException {
+
+ protected void writeIndexTableInfoHeadings() throws IOException {
+ }
+
+ protected void writeIndexTableInfoValues(String name) throws IOException {
+ }
+
+ private void writeMainTable() throws IOException {
diffs = 0;
for (Map.Entry<String, MultiMap.Entry<TestResult>> e: table.entrySet()) {
String testName = e.getKey();
@@ -202,7 +223,10 @@ public class HTMLReporter extends Report
out.endTag(TH);
for (int i = 0; i < result.getSize(); i++) {
out.startTag(TH);
- out.writeI18N("html.th.setN", i);
+ if (compact)
+ out.write(String.valueOf(i + 1));
+ else
+ out.writeI18N("html.th.setN", i + 1);
out.endTag(TH);
}
out.endTag(TR);
@@ -222,36 +246,24 @@ public class HTMLReporter extends Report
if (wd != null)
trFile = new File(wd, tr.getWorkRelativePath());
}
+ out.startTag(TD);
Status s = (tr == null ? null : tr.getStatus());
- out.startTag(TD);
- String classAttr;
- String text;
- switch (s == null ? Status.NOT_RUN : s.getType()) {
- case Status.PASSED:
- classAttr = PASS;
- text = i18n.getString("html.pass");
- break;
- case Status.FAILED:
- classAttr = FAIL;
- text = i18n.getString("html.fail");
- break;
- case Status.ERROR:
- classAttr = ERROR;
- text = i18n.getString("html.error");
- break;
- default:
- classAttr = NOT_RUN;
- text = i18n.getString("html.notRun");
- break;
- }
- out.writeAttr(CLASS, classAttr);
+ out.writeAttr(CLASS, getClassAttr(s));
+ String text = getText(s);
if (trFile != null && trFile.exists()) {
out.startTag(A);
out.writeAttr(HREF, trFile.toURI().toString());
- out.write(text);
+ if (text.startsWith("&"))
+ out.writeEntity(text);
+ else
+ out.write(text);
out.endTag(A);
- } else
- out.write(text);
+ } else {
+ if (text.startsWith("&"))
+ out.writeEntity(text);
+ else
+ out.write(text);
+ }
out.endTag(TD);
}
out.endTag(TR);
@@ -262,7 +274,7 @@ public class HTMLReporter extends Report
out.endTag(TABLE);
}
}
-
+
private void writeSummary() throws IOException {
out.startTag(P);
if (diffs == 0)
@@ -271,27 +283,60 @@ public class HTMLReporter extends Report
out.writeI18N("html.diffs.count", diffs);
out.endTag(P);
}
-
+
+ protected String getClassAttr(Status s) {
+ switch (s == null ? Status.NOT_RUN : s.getType()) {
+ case Status.PASSED:
+ return PASS;
+ case Status.FAILED:
+ return FAIL;
+ case Status.ERROR:
More information about the distro-pkg-dev
mailing list