Date: Sat, 1 Nov 2008 21:59:10 +0600 (NOVT) From: Dmitry A Grigorovich <odip@bionet.nsc.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/128521: [patch] devel/icu build failed on TestFormatRelative Message-ID: <20081101155910.B3CC821981@manticore.bionet.nsc.ru> Resent-Message-ID: <200811011620.mA1GK3kY015483@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 128521 >Category: ports >Synopsis: [patch] devel/icu build failed on TestFormatRelative >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sat Nov 01 16:20:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Dmitry A Grigorovich >Release: FreeBSD 7.0-RELEASE-p5 i386 >Organization: ICiG SB RAS, Russia >Environment: FreeBSD druid.bionet.nsc.ru 7.0-RELEASE-p5 FreeBSD 7.0-RELEASE-p5 #0: Tue Oct 7 19:55:40 NOVST 2008 root@druid.bionet.nsc.ru:/usr/obj/usr/src/sys/ODIP i386 >Description: Try to build: portupgrade -pN devel/icu It failed with report: -------------------------------------- Errors in total: 2. TestFormatRelative DataDrivenFormatTest format -------------------------------------- ICU problem report: http://www.icu-project.org/trac/ticket/6018 ICU patch: http://www.icu-project.org/trac/changeset/23166 >How-To-Repeat: portupgrade -pN devel/icu >Fix: Copy following patch to /usr/ports/devel/icu/files/patch-format Try again: portupgrade -pN devel/icu --- patch-format begins here --- Index: /icu/trunk/source/i18n/calendar.cpp =================================================================== --- i18n/calendar.cpp (revision 22978) +++ i18n/calendar.cpp (revision 23166) @@ -1,5 +1,5 @@ /* ******************************************************************************* -* Copyright (C) 1997-2007, International Business Machines Corporation and * +* Copyright (C) 1997-2008, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* @@ -74,6 +74,12 @@ #if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL) + +/** + * fldName was removed as a duplicate implementation. + * use udbg_ services instead, + * which depend on include files and library from ../tools/ctestfw + */ +#include "unicode/udbgutil.h" #include <stdio.h> - /** @@ -83,12 +89,8 @@ * @internal */ -#error fldName() has been removed. Please use udbg_ucal_fieldName() from libctestfw instead. The following code might work. - -static const char* fldName(UCalendarDateFields f) { - const char *udbg_ucal_fieldName(int32_t fld); - return udbg_ucal_fieldName((int32_t)f); -} - - + +const char* fldName(UCalendarDateFields f) { + return udbg_enumName(UDBG_UCalendarDateFields, (int32_t)f); +} #if UCAL_DEBUG_DUMP Index: /icu/trunk/source/i18n/reldtfmt.cpp =================================================================== --- i18n/reldtfmt.cpp (revision 22561) +++ i18n/reldtfmt.cpp (revision 23166) @@ -1,5 +1,5 @@ /* ******************************************************************************* -* Copyright (C) 2007, International Business Machines Corporation and * +* Copyright (C) 2007-2008, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* @@ -304,8 +304,13 @@ return 0; } - // TODO: Cache the nowCal to avoid heap allocs? + // TODO: Cache the nowCal to avoid heap allocs? Would be difficult, don't know the calendar type Calendar *nowCal = cal.clone(); nowCal->setTime(Calendar::getNow(), status); - int32_t dayDiff = nowCal->fieldDifference(cal.getTime(status), Calendar::DATE, status); + + // For the day difference, we are interested in the difference in the (modified) julian day number + // which is midnight to midnight. Using fieldDifference() is NOT correct here, because + // 6pm Jan 4th to 10am Jan 5th should be considered "tomorrow". + int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN_DAY, status); + delete nowCal; return dayDiff; Index: /icu/trunk/source/test/intltest/dadrfmt.cpp =================================================================== --- test/intltest/dadrfmt.cpp (revision 22493) +++ test/intltest/dadrfmt.cpp (revision 23166) @@ -1,5 +1,5 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2007, International Business Machines Corporation and + * Copyright (c) 1997-2008, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -94,4 +94,5 @@ UnicodeString kMILLIS("MILLIS="); // TODO: static UnicodeString kRELATIVE_MILLIS("RELATIVE_MILLIS="); // TODO: static + UnicodeString kRELATIVE_ADD("RELATIVE_ADD:"); // TODO: static UErrorCode status = U_ZERO_ERROR; @@ -170,5 +171,10 @@ } } - + + Calendar *cal = Calendar::createInstance(loc, status); + if(U_FAILURE(status)) { + errln("case %d: could not create calendar from %s", n, calLoc); + } + // parse 'date' if(date.startsWith(kMILLIS)) { @@ -180,4 +186,28 @@ useDate = TRUE; fromDate = udbg_stoi(millis) + now; + } else if(date.startsWith(kRELATIVE_ADD)) { + UnicodeString add = UnicodeString(date, kRELATIVE_ADD.length()); // "add" is a string indicating which fields to add + if(fromSet.parseFrom(add, status)<0 || U_FAILURE(status)) { + errln("case %d: could not parse date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status)); + continue; + } + logln("Parsing ..\n"); + useDate=TRUE; + cal->clear(); + cal->setTime(now, status); + for (int q=0; q<UCAL_FIELD_COUNT; q++) { + if (fromSet.isSet((UCalendarDateFields)q)) { + int32_t oldv = cal->get((UCalendarDateFields)q, status); + cal->add((UCalendarDateFields)q, + fromSet.get((UCalendarDateFields)q), status); + int32_t newv = cal->get((UCalendarDateFields)q, status); + logln("adding %d to %s ..went from %d to %d\n", fromSet.get((UCalendarDateFields)q), udbg_enumName(UDBG_UCalendarDateFields, q), oldv, newv); + } + } + fromDate = cal->getTime(status); + if(U_FAILURE(status)) { + errln("case %d: could not apply date as RELATIVE_ADD calendar fields: %s", n, u_errorName(status)); + continue; + } } else if(fromSet.parseFrom(date, status)<0 || U_FAILURE(status)) { errln("case %d: could not parse date as calendar fields: %s", n, u_errorName(status)); @@ -185,8 +215,4 @@ } - Calendar *cal = Calendar::createInstance(loc, status); - if(U_FAILURE(status)) { - errln("case %d: could not create calendar from %s", n, calLoc); - } // now, do it. if (fmt) { Index: /icu/trunk/source/test/testdata/format.txt =================================================================== --- test/testdata/format.txt (revision 22885) +++ test/testdata/format.txt (revision 23166) @@ -1,3 +1,3 @@ -// Copyright (c) 2007 International Business Machines +// Copyright (c) 2007-2008 International Business Machines // Corporation and others. All Rights Reserved. format:table(nofallback) { @@ -23,5 +23,8 @@ // locale: locale including calendar type // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' - // date: either 'MILLIS=####' where #### is an unsigned long (millis), or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale + // date: either 'MILLIS=####' where #### is millis, + // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale + // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis + // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time // str: the expected unicode string Cases { @@ -61,5 +64,5 @@ "en_US@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=86410000", // one day from now + "RELATIVE_ADD:DATE=1", // one day from now "Tomorrow" }, @@ -67,5 +70,5 @@ "en_US@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=0", // one day before now + "RELATIVE_MILLIS=0", // today "Today" }, @@ -73,5 +76,5 @@ "en_US@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=-86410000", // one day before now + "RELATIVE_ADD:DATE=-1", // one day before now "Yesterday" }, @@ -79,5 +82,5 @@ "mt_MT@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=86410000", // one day from now + "RELATIVE_ADD:DATE=1", // one day from now "Għada" }, @@ -85,5 +88,5 @@ "mt_MT@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=0", // one day before now + "RELATIVE_MILLIS=0", // today "Illum" }, @@ -91,5 +94,5 @@ "mt_MT@calendar=gregorian", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=-86410000", // one day before now + "RELATIVE_ADD:DATE=-1", // one day before now "Lbieraħ" }, @@ -97,5 +100,5 @@ "ru", "DATE=RELATIVE_SHORT", - "RELATIVE_MILLIS=-172810000", // 2 days ago + "RELATIVE_ADD:DATE=-2", // 2 days ago "Позавчера" }, --- patch-format ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081101155910.B3CC821981>