// Static list of errors found
static UnicodeString errorList;
-static UnicodeString knownList;
+static void *knownList = NULL; // known issues
+static UBool noKnownIssues = FALSE; // if TRUE, don't emit known issues
//-----------------------------------------------------------------------------
//convenience classes to ease porting code that uses the Java
}
UBool IntlTest::logKnownIssue(const char *ticket, const UnicodeString &msg) {
- knownList.append(UnicodeString(ticket, ""));
- knownList.append(UnicodeString(" ",""));
- knownList.append(UnicodeString(basePath, ""));
- knownList.append(UnicodeString(currName, ""));
- knownList.append(UnicodeString(" ",""));
- char URL[UDBG_KNOWNISSUE_LEN];
- knownList.append(UnicodeString(udbg_knownIssueURLFrom(ticket, URL), ""));
- knownList.append(UnicodeString(" ",""));
- knownList.append(msg);
- knownList.append(UnicodeString("\n", ""));
+ if(noKnownIssues) return FALSE;
- return true;
+ char fullpath[2048];
+ strcpy(fullpath, basePath);
+ strcat(fullpath, currName);
+ UnicodeString msg2 =msg;
+ UBool firstForTicket, firstForWhere;
+ knownList = udbg_knownIssue_openU(knownList, ticket, fullpath, msg2.getTerminatedBuffer(), &firstForTicket, &firstForWhere);
+
+ if(firstForTicket || firstForWhere) {
+ infoln(UnicodeString("(Known issue #","") + UnicodeString(ticket,"")+ UnicodeString(") \"","") + msg);
+ } else {
+ logln(UnicodeString("(Known issue #","") + UnicodeString(ticket,"")+ UnicodeString(") \"","") + msg);
+ }
+
+ return TRUE;
}
/* convenience functions that include sprintf formatting */
UBool IntlTest::printKnownIssues()
{
- if(knownList.length()>0) {
- IntlTest::LL_message( UnicodeString("KNOWN ISSUES:\n", ""), TRUE );
- IntlTest::LL_message( knownList, TRUE );
+ if(knownList != NULL) {
+ udbg_knownIssue_print(knownList, NULL);
+ udbg_knownIssue_close(knownList);
return TRUE;
} else {
return FALSE;
else if (strcmp("utf-8", str) == 0 ||
strcmp("u", str) == 0)
utf8 = TRUE;
+ else if (strcmp("noknownissues", str) == 0 ||
+ strcmp("K", str) == 0)
+ noKnownIssues = TRUE;
else if (strcmp("leaks", str) == 0 ||
strcmp("l", str) == 0)
leaks = TRUE;
fprintf(stdout, " Leaks (l) : %s\n", (leaks? "On" : "Off"));
fprintf(stdout, " utf-8 (u) : %s\n", (utf8? "On" : "Off"));
fprintf(stdout, " notime (T) : %s\n", (no_time? "On" : "Off"));
+ fprintf(stdout, " noknownissues (K) : %s\n", (noKnownIssues? "On" : "Off"));
fprintf(stdout, " Warn on missing data (w) : %s\n", (warnOnMissingData? "On" : "Off"));
#if (ICU_USE_THREADS==0)
fprintf(stdout, " Threads : Disabled\n");
}
fprintf(stdout, "\n--------------------------------------\n");
- major.printKnownIssues();
+ if( major.printKnownIssues() ) {
+ fprintf(stdout, " To run suppressed tests, use the -K option. \n");
+ }
if (major.getErrors() == 0) {
/* Call it twice to make sure that the defaults were reset. */
/* Call it before the OK message to verify proper cleanup. */
col->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
for(int32_t i = 0; i < testCount; i += 1) {
- if (i>=4 && i<=6 && logKnownIssue("9156")) {
+ if (i>=4 && i<=6 && logKnownIssue("9156", "was 8081")) {
continue; // timebomb until ticket #9156 (was #8081) is resolved
}
UnicodeString ts = CharsToUnicodeString(test[i]);
#include "unicode/utrace.h"
#include "unicode/uclean.h"
#include "putilimp.h"
+#include "udbgutil.h"
/* NOTES:
3/20/1999 srl - strncpy called w/o setting nulls at the end
static int ONE_ERROR = 0; /* were there any other errors? */
static int DATA_ERROR_COUNT = 0; /* count of data related errors or warnings */
static int INDENT_LEVEL = 0;
+static UBool NO_KNOWN = FALSE;
+static void *knownList = NULL;
+static char gTestName[1024] = "";
static UBool ON_LINE = FALSE; /* are we on the top line with our test name? */
static UBool HANGING_OUTPUT = FALSE; /* did the user leave us without a trailing \n ? */
static int GLOBAL_PRINT_COUNT = 0; /* global count of printouts */
#if SHOW_TIMES
startTime = uprv_getRawUTCtime();
#endif
+ strcpy(gTestName, pathToFunction);
root->test(); /* PERFORM THE TEST ************************/
#if SHOW_TIMES
stopTime = uprv_getRawUTCtime();
ON_LINE=FALSE; /* just in case */
+ if(knownList != NULL) {
+ if( udbg_knownIssue_print(knownList, NULL) ) {
+ fprintf(stdout, "(To run suppressed tests, use the -K option.) \n\n");
+ }
+ udbg_knownIssue_close(knownList);
+ }
+
if (ERROR_COUNT)
{
fprintf(stdout,"\nSUMMARY:\n");
/* fputs(prefix, stdout); */
/* } */
char buf[2048], url[1024];
+ UBool firstForTicket;
+ UBool firstForWhere;
+
+ if(NO_KNOWN) return FALSE;
+ if(pattern==NULL) pattern="";
+
vsprintf(buf, pattern, ap);
+ knownList = udbg_knownIssue_open(knownList, ticket, gTestName, buf, &firstForTicket, &firstForWhere);
- printf("KNOWN ISSUE: #%s %s\n", ticket, buf);
+ if(firstForTicket || firstForWhere) {
+ log_info("(Known issue #%s) %s", ticket, buf);
+ } else {
+ log_verbose("(Known issue #%s) %s", ticket, buf);
+ }
+
+ /*printf("KNOWN ISSUE: #%s %s\n", ticket, buf); */
/* fflush(stdout); */
/* va_end(ap); */
{
QUICK = 0;
}
+ else if (strcmp( argv[i], "-K") ==0)
+ {
+ NO_KNOWN = 1;
+ }
else if (strncmp( argv[i], "-E",2) ==0)
{
SUMMARY_FILE=argv[i]+2;
printf(" -v To turn ON verbosity(same as -verbose)\n");
printf(" -x file.xml Write junit format output to file.xml\n");
printf(" -h To print this message\n");
+ printf(" -K to turn OFF suppressing known issues\n");
printf(" -n To turn OFF printing error messages\n");
printf(" -w Don't fail on data-loading errs, just warn. Useful if\n"
" user has reduced/changed the common set of ICU data \n");
}
return buf;
}
+
+
+#if !U_HAVE_STD_STRING
+const char *warning = "WARNING: Don't have std::string (STL) - known issue logs will be deficient.";
+
+U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket,
+ UBool *firstForWhere) {
+ if(ptr==NULL) {
+ puts(warning);
+ }
+ printf("%s\tKnown Issue #%s\n", where, ticket);
+
+ return (void*)warning;
+}
+
+U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket,
+ UBool *firstForWhere) {
+ if(ptr==NULL) {
+ puts(warning);
+ }
+ if(msg==NULL) msg = "";
+ printf("%s\tKnown Issue #%s \"%s\n", where, ticket, msg);
+
+ return (void*)warning;
+}
+
+U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output) {
+ puts(warning);
+ return FALSE;
+}
+
+U_CAPI void udbg_knownIssue_close(void *ptr) {
+ // nothing to do
+}
+#else
+
+#include <set>
+#include <map>
+#include <string>
+#include <ostream>
+#include <iostream>
+
+class KnownIssues {
+public:
+ KnownIssues();
+ ~KnownIssues();
+ void add(const char *ticket, const char *where, const UChar *msg, UBool *firstForTicket, UBool *firstForWhere);
+ void add(const char *ticket, const char *where, const char *msg, UBool *firstForTicket, UBool *firstForWhere);
+ UBool print(FILE *output) ;
+private:
+ std::map< std::string,
+ std::map < std::string, std::set < std::string > > > fTable;
+};
+
+KnownIssues::KnownIssues()
+ : fTable()
+{
+}
+
+KnownIssues::~KnownIssues()
+{
+}
+
+void KnownIssues::add(const char *ticket, const char *where, const UChar *msg, UBool *firstForTicket, UBool *firstForWhere)
+{
+ if(fTable.find(ticket) == fTable.end()) {
+ if(firstForTicket!=NULL) *firstForTicket = TRUE;
+ fTable[ticket] = std::map < std::string, std::set < std::string > >();
+ } else {
+ if(firstForTicket!=NULL) *firstForTicket = FALSE;
+ }
+ if(where==NULL) return;
+
+ if(fTable[ticket].find(where) == fTable[ticket].end()) {
+ if(firstForWhere!=NULL) *firstForWhere = TRUE;
+ fTable[ticket][where] = std::set < std::string >();
+ } else {
+ if(firstForWhere!=NULL) *firstForWhere = FALSE;
+ }
+ if(msg==NULL || !*msg) return;
+
+ std::string str;
+ fTable[ticket][where].insert(UnicodeString(msg).toUTF8String(str));
+}
+
+void KnownIssues::add(const char *ticket, const char *where, const char *msg, UBool *firstForTicket, UBool *firstForWhere)
+{
+ if(fTable.find(ticket) == fTable.end()) {
+ if(firstForTicket!=NULL) *firstForTicket = TRUE;
+ fTable[ticket] = std::map < std::string, std::set < std::string > >();
+ } else {
+ if(firstForTicket!=NULL) *firstForTicket = FALSE;
+ }
+ if(where==NULL) return;
+
+ if(fTable[ticket].find(where) == fTable[ticket].end()) {
+ if(firstForWhere!=NULL) *firstForWhere = TRUE;
+ fTable[ticket][where] = std::set < std::string >();
+ } else {
+ if(firstForWhere!=NULL) *firstForWhere = FALSE;
+ }
+ if(msg==NULL || !*msg) return;
+
+ std::string str(msg);
+ fTable[ticket][where].insert(str);
+}
+
+UBool KnownIssues::print(FILE *output)
+{
+ if(fTable.empty()) {
+ return FALSE;
+ }
+
+ std::cout << "KNOWN ISSUES" << std::endl;
+ for( std::map< std::string,
+ std::map < std::string, std::set < std::string > > >::iterator i = fTable.begin();
+ i != fTable.end();
+ i++ ) {
+ char URL[1024];
+ std::cout << '#' << (*i).first << " <" << udbg_knownIssueURLFrom( (*i).first.c_str(), URL ) << ">" << std::endl;
+
+ for( std::map< std::string, std::set < std::string > >::iterator ii = (*i).second.begin();
+ ii != (*i).second.end();
+ ii++ ) {
+ std::cout << " " << (*ii).first << std::endl;
+ for ( std::set < std::string >::iterator iii = (*ii).second.begin();
+ iii != (*ii).second.end();
+ iii++ ) {
+ std::cout << " " << '"' << (*iii) << '"' << std::endl;
+ }
+ }
+ }
+ return TRUE;
+}
+
+U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket,
+ UBool *firstForWhere) {
+ KnownIssues *t = static_cast<KnownIssues*>(ptr);
+ if(t==NULL) {
+ t = new KnownIssues();
+ }
+
+ t->add(ticket, where, msg, firstForTicket, firstForWhere);
+
+ return static_cast<void*>(t);
+}
+
+U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket,
+ UBool *firstForWhere) {
+ KnownIssues *t = static_cast<KnownIssues*>(ptr);
+ if(t==NULL) {
+ t = new KnownIssues();
+ }
+
+ t->add(ticket, where, msg, firstForTicket, firstForWhere);
+
+ return static_cast<void*>(t);
+}
+
+U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output) {
+ KnownIssues *t = static_cast<KnownIssues*>(ptr);
+ if(t==NULL) {
+ return FALSE;
+ } else {
+ t->print(output);
+ return TRUE;
+ }
+}
+
+U_CAPI void udbg_knownIssue_close(void *ptr) {
+ KnownIssues *t = static_cast<KnownIssues*>(ptr);
+ delete t;
+}
+
+#endif
*/
U_CAPI char *udbg_knownIssueURLFrom(const char *ticket, char *buf);
+/**
+ * Open (or reopen) a 'known issue' table.
+ * @param ptr pointer to 'table'. Opaque.
+ * @return new or existing ptr
+ */
+U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket,
+ UBool *firstForWhere);
+
+
+/**
+ * Open (or reopen) a 'known issue' table.
+ * @param ptr pointer to 'table'. Opaque.
+ * @return new or existing ptr
+ */
+U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket,
+ UBool *firstForWhere);
+
+/**
+ * Print 'known issue' table.
+ * @param ptr pointer from udbg_knownIssue
+ * @param output file to print to
+ * @return TRUE if there were any issues.
+ */
+U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output);
+
+/**
+ * Close 'known issue' table.
+ * @param ptr
+ */
+U_CAPI void udbg_knownIssue_close(void *ptr);
+
+
#endif