imported patch australianTime
authorPavel Heimlich <pavel.heimlich@oracle.com>
Mon, 22 Nov 2010 09:49:19 +0100
changeset 43 8204420456b3
parent 42 cc10a222c09d
child 44 e40f7cd559ea
imported patch australianTime
icu/icu.spec
icu/patches/source_test_intltest_tztest.patch
--- a/icu/icu.spec	Mon Nov 08 12:20:51 2010 +0100
+++ b/icu/icu.spec	Mon Nov 22 09:49:19 2010 +0100
@@ -59,6 +59,8 @@
 Patch26: source_test_ccapitst.c.patch
 #Studio 12.1 changed behaviour of 'CC -m64', this patch is needed for proper detection of 64 bit abolities of the compiler
 Patch27: source_configure_64.patch
+#backport upstream fix for http://bugs.icu-project.org/trac/ticket/6814 (australian timezone test failure)
+Patch28: source_test_intltest_tztest.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}
 SUNW_Copyright: %{src_name}.copyright
@@ -127,6 +129,7 @@
 %patch25 -p1
 %patch26 -p1
 %patch27 
+%patch28
 
 #cat Makefile.config.in %{PATCH2} > Makefile.config
 #touch Makefile.depend
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/patches/source_test_intltest_tztest.patch	Mon Nov 22 09:49:19 2010 +0100
@@ -0,0 +1,131 @@
+--- source/test/intltest/tztest.cpp.orig	2010-11-09 18:11:42.050866346 +0100
++++ source/test/intltest/tztest.cpp	2010-11-09 18:20:29.337723538 +0100
+@@ -34,6 +34,11 @@
+ // class TimeZoneTest
+ // *****************************************************************************
+ 
++// TODO: We should probably read following data at runtime, so we can update
++// the these values every release with necessary data changes.
++const int32_t TimeZoneTest::REFERENCE_YEAR = 2009;
++const char * TimeZoneTest::REFERENCE_DATA_VERSION = "2009d";
++
+ void TimeZoneTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
+ {
+     if (exec) logln("TestSuite TestTimeZone");
+@@ -579,18 +584,13 @@
+  */
+ void TimeZoneTest::TestShortZoneIDs()
+ {
+-    // TODO: This test case is tzdata sensitive.
+-    // We should actually put the data version in this test code
+-    // at build time.  For now, we just hardcode the version string
+-    // and display warning instead of error if non-reference tzdata
+-    // version is used.
+-    const char *REFERENCE_DATA_VERSION = "2008i";
+-
+     UErrorCode status = U_ZERO_ERROR;
++
++    // This test case is tzdata version sensitive.
+     UBool isNonReferenceTzdataVersion = FALSE;
+     const char *tzdataVer = TimeZone::getTZDataVersion(status);
+     if (failure(status, "getTZDataVersion")) return;
+-    if (uprv_strcmp(tzdataVer, REFERENCE_DATA_VERSION) != 0) {
++    if (uprv_strcmp(tzdataVer, TimeZoneTest::REFERENCE_DATA_VERSION) != 0) {
+         // Note: We want to display a warning message here if
+         // REFERENCE_DATA_VERSION is out of date - so we
+         // do not forget to update the value before GA.
+@@ -604,10 +604,9 @@
+     // in the time zone in the current calendar year.  The test
+     // data is valid for the date after the reference year below.
+     // If system clock is before the year, some test cases may fail.
+-    const int32_t REFERENCE_YEAR = 2009;
+     GregorianCalendar cal(*TimeZone::getGMT(), status);
+     if (failure(status, "GregorianCalendar")) return;
+-    cal.set(REFERENCE_YEAR, UCAL_JANUARY, 2); // day 2 in GMT
++    cal.set(TimeZoneTest::REFERENCE_YEAR, UCAL_JANUARY, 2); // day 2 in GMT
+ 
+     UBool isDateBeforeReferenceYear = ucal_getNow() < cal.getTime(status);
+     if (failure(status, "Calendar::getTime")) return;
+@@ -1898,6 +1897,15 @@
+     };
+ 
+ void TimeZoneTest::TestDisplayNamesMeta() {
++    UErrorCode status = U_ZERO_ERROR; 
++    GregorianCalendar cal(*TimeZone::getGMT(), status); 
++    if (failure(status, "GregorianCalendar")) return; 
++ 
++    UBool isReferenceYear = TRUE; 
++    if (cal.get(UCAL_YEAR, status) != TimeZoneTest::REFERENCE_YEAR) { 
++        isReferenceYear = FALSE; 
++    } 
++ 
+     UBool sawAnError = FALSE;
+     for (int testNum   = 0; zoneDisplayTestData[testNum].zoneName != NULL; testNum++) {
+         Locale locale  = Locale::createFromName(zoneDisplayTestData[testNum].localeName);
+@@ -1908,20 +1916,33 @@
+                              locale,
+                              displayName);
+         if (displayName != zoneDisplayTestData[testNum].expectedDisplayName) {
+-            sawAnError = TRUE;
+             char  name[100];
+             UErrorCode status = U_ZERO_ERROR;
+             displayName.extract(name, 100, NULL, status);
+-            errln("Incorrect time zone display name.  zone = \"%s\",\n"
+-                  "   locale = \"%s\",   style = %s,  Summertime = %d\n"
+-                  "   Expected \"%s\", "
+-                  "   Got \"%s\"\n", zoneDisplayTestData[testNum].zoneName,
+-                                     zoneDisplayTestData[testNum].localeName,
+-                                     zoneDisplayTestData[testNum].style==TimeZone::SHORT ?
+-                                        "SHORT" : "LONG",
+-                                     zoneDisplayTestData[testNum].summerTime,
+-                                     zoneDisplayTestData[testNum].expectedDisplayName,
+-                                     name);
++            if (isReferenceYear) { 
++                sawAnError = TRUE; 
++                errln("Incorrect time zone display name.  zone = \"%s\",\n" 
++                      "   locale = \"%s\",   style = %s,  Summertime = %d\n" 
++                      "   Expected \"%s\", " 
++                      "   Got \"%s\"\n", zoneDisplayTestData[testNum].zoneName, 
++                                         zoneDisplayTestData[testNum].localeName, 
++                                         zoneDisplayTestData[testNum].style==TimeZone::SHORT ? 
++                                            "SHORT" : "LONG", 
++                                         zoneDisplayTestData[testNum].summerTime, 
++                                         zoneDisplayTestData[testNum].expectedDisplayName, 
++                                         name); 
++            } else { 
++                logln("Incorrect time zone display name.  zone = \"%s\",\n" 
++                      "   locale = \"%s\",   style = %s,  Summertime = %d\n" 
++                      "   Expected \"%s\", " 
++                      "   Got \"%s\"\n", zoneDisplayTestData[testNum].zoneName, 
++                                         zoneDisplayTestData[testNum].localeName, 
++                                         zoneDisplayTestData[testNum].style==TimeZone::SHORT ? 
++                                            "SHORT" : "LONG", 
++                                         zoneDisplayTestData[testNum].summerTime, 
++                                         zoneDisplayTestData[testNum].expectedDisplayName, 
++                                         name); 
++            } 
+         }
+         delete zone;
+     }
+--- source/test/intltest/tztest.h.orig	2010-11-10 10:13:43.085093156 +0100
++++ source/test/intltest/tztest.h	2010-11-10 10:14:29.186212963 +0100
+@@ -1,6 +1,6 @@
+ 
+ /********************************************************************
+- * Copyright (c) 1997-2008, International Business Machines
++ * Copyright (c) 1997-2009, International Business Machines
+  * Corporation and others. All Rights Reserved.
+  ********************************************************************/
+  
+@@ -98,6 +98,11 @@
+     // internal functions
+     static UnicodeString& formatOffset(int32_t offset, UnicodeString& rv);
+     static UnicodeString& formatTZID(int32_t offset, UnicodeString& rv);
++
++    // Some test case data is current date/tzdata version sensitive and producing errors 
++    // when year/rule are changed. 
++    static const int32_t REFERENCE_YEAR; 
++    static const char *REFERENCE_DATA_VERSION;
+ };
+ 
+ #endif /* #if !UCONFIG_NO_FORMATTING */