ICU-9743 Logging known issues with ticket information, instead of timebomb.

X-SVN-Rev: 33503
This commit is contained in:
Yoshito Umaoka 2013-04-10 08:15:11 +00:00
parent aa08affb3c
commit 5fbc363972
5 changed files with 106 additions and 25 deletions

View file

@ -1790,7 +1790,7 @@ public class SearchTest extends TestFmwk {
}
public void TestSupplementary() {
if (isICUVersionBefore(52, 0, 1)) { // ticket#8080
if (logKnownIssue("8080", null)) {
return;
}
int count = 0;
@ -1803,7 +1803,7 @@ public class SearchTest extends TestFmwk {
}
public void TestSupplementaryCanonical() {
if (isICUVersionBefore(52, 0, 1)) { // ticket#8080
if (logKnownIssue("8080", null)) {
return;
}
int count = 0;

View file

@ -278,7 +278,7 @@ public class ChineseTest extends CalendarTest {
Date e = fmt.parse(s);
if (e.equals(DATA[i])) {
logln("Ok: " + DATA[i] + " -> " + s + " -> " + e);
} else if (isICUVersionBefore(52, 0, 1)) { // until ticket #9043 fixes the ambiguous era problem
} else if (logKnownIssue("9043", "Ambiguous Chinese era parsing")) {
logln("Ambiguous parse fails: " + DATA[i] + " -> " + s + " -> " + e);
} else {
errln("FAIL: " + DATA[i] + " -> " + s + " -> " + e);

View file

@ -72,7 +72,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
* and if the result TimeZone has the expected behavior.
*/
public void TestTimeZoneRoundTrip() {
boolean TEST_ALL = "true".equalsIgnoreCase(getProperty("TimeZoneRoundTripAll"));
boolean TEST_ALL = getBooleanProperty("TimeZoneRoundTripAll", false);
TimeZone unknownZone = new SimpleTimeZone(-31415, "Etc/Unknown");
int badDstOffset = -1234;
@ -282,7 +282,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
*/
public void TestTimeRoundTrip() {
boolean TEST_ALL = "true".equalsIgnoreCase(getProperty("TimeZoneRoundTripAll"));
boolean TEST_ALL = getBooleanProperty("TimeZoneRoundTripAll", false);
int startYear, endYear;

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2012, International Business Machines Corporation and *
* Copyright (C) 1996-2013, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -21,9 +21,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.MissingResourceException;
import java.util.Random;
import java.util.TreeMap;
import com.ibm.icu.util.TimeZone;
import com.ibm.icu.util.ULocale;
@ -548,15 +552,32 @@ public class TestFmwk extends AbstractTestLog {
localParams.log.flush();
}
if (localParams.timeLog != null && localParams.timeLog.length() > 0) {
localParams.log.println("\nTest cases taking excessive time (>" +
localParams.maxTargetSec + "s):");
localParams.log.println(localParams.timeLog.toString());
}
if (localParams.knownIssues != null) {
localParams.log.println("\nKnown Issues:");
for (Entry<String, List<String>> entry : localParams.knownIssues.entrySet()) {
String ticketLink = entry.getKey();
localParams.log.println("[" + ticketLink + "]");
for (String line : entry.getValue()) {
localParams.log.println(" - " + line);
}
}
}
if (localParams.errorSummary != null && localParams.errorSummary.length() > 0) {
localParams.log.println("\nError summary:");
localParams.log.println(localParams.errorSummary.toString());
}
if (localParams.timeLog != null && localParams.timeLog.length() > 0) {
localParams.log.println("\nTest cases taking excessive time (>" +
localParams.maxTargetSec + "s):");
localParams.log.println(localParams.timeLog.toString());
if (errorCount > 0) {
localParams.log.println("\n<< " + errorCount+ " TEST(S) FAILED >>");
} else {
localParams.log.println("\n<< ALL TESTS PASSED >>");
}
if (prompt) {
@ -604,6 +625,7 @@ public class TestFmwk extends AbstractTestLog {
_params.errorSummary = summary;
}
} catch (Exception e) {
ec++;
e.printStackTrace(_params.log);
_params.log.println(e.getMessage());
_params.log.println("encountered exception, exiting");
@ -800,6 +822,59 @@ public class TestFmwk extends AbstractTestLog {
params.msg(message, level, incCount, newln);
}
static final String ICU_TRAC_URL = "http://bugs.icu-project.org/trac/ticket/";
static final String CLDR_TRAC_URL = "http://unicode.org/cldr/trac/ticket/";
static final String CLDR_TICKET_PREFIX = "cldrbug:";
/**
* Log the known issue.
* This method returns true unless -prop:logKnownIssue=no is specified
* in the argument list.
*
* @param ticket A ticket number string. For an ICU ticket, use numeric characters only,
* such as "10245". For a CLDR ticket, use prefix "cldrbug:" followed by ticket number,
* such as "cldrbug:5013".
* @param comment Additional comment, or null
* @return true unless -prop:logKnownIssue=no is specified in the test command line argument.
*/
public boolean logKnownIssue(String ticket, String comment) {
if (!getBooleanProperty("logKnownIssue", true)) {
return false;
}
StringBuffer descBuf = new StringBuffer();
params.stack.appendPath(descBuf);
if (comment != null && comment.length() > 0) {
descBuf.append(" (" + comment + ")");
}
String description = descBuf.toString();
String ticketLink = "Unknown Ticket";
if (ticket != null && ticket.length() > 0) {
boolean isCldr = false;
ticket = ticket.toLowerCase(Locale.ENGLISH);
if (ticket.startsWith(CLDR_TICKET_PREFIX)) {
isCldr = true;
ticket = ticket.substring(CLDR_TICKET_PREFIX.length());
}
ticketLink = (isCldr ? CLDR_TRAC_URL : ICU_TRAC_URL) + ticket;
}
if (params.knownIssues == null) {
params.knownIssues = new TreeMap<String, List<String>>();
}
List<String> lines = params.knownIssues.get(ticketLink);
if (lines == null) {
lines = new ArrayList<String>();
params.knownIssues.put(ticketLink, lines);
}
if (!lines.contains(description)) {
lines.add(description);
}
return true;
}
protected int getErrorCount() {
return params.errorCount;
}
@ -812,6 +887,19 @@ public class TestFmwk extends AbstractTestLog {
return val;
}
public boolean getBooleanProperty(String key, boolean defVal) {
String s = getProperty(key);
if (s != null) {
if (s.equalsIgnoreCase("yes") || s.equals("true")) {
return true;
}
if (s.equalsIgnoreCase("no") || s.equalsIgnoreCase("false")) {
return false;
}
}
return defVal;
}
protected TimeZone safeGetTimeZone(String id) {
TimeZone tz = TimeZone.getTimeZone(id);
if (tz == null) {
@ -1072,6 +1160,7 @@ public class TestFmwk extends AbstractTestLog {
public StringBuffer errorSummary;
private StringBuffer timeLog;
private Map<String, List<String>> knownIssues;
public PrintWriter log;
public int indentLevel;

View file

@ -73,17 +73,6 @@ public class RoundTripTest extends TestFmwk {
static String KATAKANA_ITERATION = "[\u30FD\u30FE]";
static String HIRAGANA_ITERATION = "[\u309D\u309E]";
// TODO(Mark): Fix ticket #8989, transliterate U+0970.
// Remove all references to minusDevAbbBefore51.
private String minusDevAbbBefore51;
@Override
public void init() {
// TODO(Mark): Fix ticket #8989 (CLDR#4375), transliterate U+0970.
// Remove this method?
minusDevAbbBefore51 = isICUVersionBefore(52, 0, 1) ? "-[\u0970]" : "";
}
//------------------------------------------------------------------
// AbbreviatedUnicodeSetIterator
//------------------------------------------------------------------
@ -172,7 +161,7 @@ public class RoundTripTest extends TestFmwk {
public void TestHangul() throws IOException {
long start = System.currentTimeMillis();
Test t = new Test("Latin-Hangul", 5);
boolean TEST_ALL = "true".equalsIgnoreCase(getProperty("HangulRoundTripAll"));
boolean TEST_ALL = getBooleanProperty("HangulRoundTripAll", false);
if (TEST_ALL && getInclusion() == 10) {
t.setPairLimit(Integer.MAX_VALUE); // only go to the limit if we have TEST_ALL and getInclusion
}
@ -504,8 +493,9 @@ public class RoundTripTest extends TestFmwk {
}
logln("Warning: TestDevanagariLatin needs to be updated to remove delete the section marked [:Age=4.1:] filter");
String minusDevAbb = logKnownIssue("cldrbug:4375", null) ? "-[\u0970]" : "";
new Test("Latin-DEVANAGARI", 50)
.test(latinForIndic, "[[[:Devanagari:][\u094d][\u0964\u0965]" + minusDevAbbBefore51 + "]&[:Age=4.1:]]", "[\u0965\u0904]", this, new LegalIndic());
.test(latinForIndic, "[[[:Devanagari:][\u094d][\u0964\u0965]" + minusDevAbb + "]&[:Age=4.1:]]", "[\u0965\u0904]", this, new LegalIndic());
showElapsed(start, "TestDevanagariLatin");
}
@ -889,9 +879,11 @@ public class RoundTripTest extends TestFmwk {
/* comment lines below when transliterator is fixed */
// start
// TODO(Mark): Fix ticket #8989, transliterate U+0970.
String minusDevAbb = logKnownIssue("cldrbug:4375", null) ? "-[\u0970]" : "";
new Test(interIndicArray[i][0], 50)
.test("[["+interIndicArray[i][1] + minusDevAbbBefore51 + "] &[:Age=4.1:]]",
"[["+interIndicArray[i][2] + minusDevAbbBefore51 + "] &[:Age=4.1:]]",
.test("[["+interIndicArray[i][1] + minusDevAbb + "] &[:Age=4.1:]]",
"[["+interIndicArray[i][2] + minusDevAbb + "] &[:Age=4.1:]]",
interIndicArray[i][3],
this, new LegalIndic());
//end