From 8a63dd568375572f7befb9e73b3fe1ee1592025c Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 10 Apr 2008 16:53:16 +0000 Subject: [PATCH] ICU-2498 Make test pass w/o data in iotest and cintltest. X-SVN-Rev: 23783 --- icu4c/source/test/cintltst/ccapitst.c | 8 ++--- icu4c/source/test/cintltst/cintltst.c | 4 +-- icu4c/source/test/cintltst/cloctst.c | 2 +- icu4c/source/test/cintltst/cposxtst.c | 6 ++-- icu4c/source/test/cintltst/crestst.c | 22 ++++++------ icu4c/source/test/cintltst/creststn.c | 48 ++++++++++++------------- icu4c/source/test/cintltst/custrtrn.c | 4 +-- icu4c/source/test/cintltst/spreptst.c | 14 ++++---- icu4c/source/test/cintltst/sprpdata.c | 7 ++-- icu4c/source/test/cintltst/udatatst.c | 52 +++++++++++++-------------- icu4c/source/test/iotest/iotest.cpp | 10 +++--- 11 files changed, 90 insertions(+), 87 deletions(-) diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 4864ccd626..b6008f9473 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2007, International Business Machines Corporation and + * Copyright (c) 1997-2008, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /***************************************************************************** @@ -570,7 +570,7 @@ static void TestConvert() ucs_file_in = fopen(ucs_file_name,"rb"); if (!ucs_file_in) { - log_err("Couldn't open the Unicode file [%s]... Exiting...\n", ucs_file_name); + log_data_err("Couldn't open the Unicode file [%s]... Exiting...\n", ucs_file_name); return; } @@ -3136,7 +3136,7 @@ static void TestFromUCountPending(){ int i; UConverter* cnv = ucnv_openPackage(loadTestData(&status), "test3", &status); if(U_FAILURE(status)){ - log_err("Could not create converter for test3. Error: %s\n", u_errorName(status)); + log_data_err("Could not create converter for test3. Error: %s\n", u_errorName(status)); return; } for(i=0; i %s\n", u_errorName(ec)); + log_data_err("FAIL: loadTestData => %s\n", u_errorName(ec)); return; } catd = u_catopen(path, "mc", &ec); if (U_FAILURE(ec)) { - log_err("FAIL: u_catopen => %s\n", u_errorName(ec)); + log_data_err("FAIL: u_catopen => %s\n", u_errorName(ec)); return; } diff --git a/icu4c/source/test/cintltst/crestst.c b/icu4c/source/test/cintltst/crestst.c index 1f5cf321aa..64e5e1d112 100644 --- a/icu4c/source/test/cintltst/crestst.c +++ b/icu4c/source/test/cintltst/crestst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2007, International Business Machines Corporation and + * Copyright (c) 1997-2008, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************* @@ -132,7 +132,7 @@ void TestResourceBundles() UErrorCode status = U_ZERO_ERROR; loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } @@ -165,7 +165,7 @@ void TestConstruction1() testdatapath=loadTestData(&err); if(U_FAILURE(err)) { - log_err("Could not load testdata.dat %s \n",myErrorName(err)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(err)); return; } @@ -477,7 +477,7 @@ TestOpenDirect(void) { errorCode=U_ZERO_ERROR; idna_rules=ures_openDirect(loadTestData(&errorCode), "idna_rules", &errorCode); if(U_FAILURE(errorCode)) { - log_err("ures_openDirect(\"idna_rules\") failed: %s\n", u_errorName(errorCode)); + log_data_err("ures_openDirect(\"idna_rules\") failed: %s\n", u_errorName(errorCode)); return; } @@ -530,7 +530,7 @@ TestOpenDirect(void) { errorCode = U_USING_FALLBACK_WARNING;; idna_rules=ures_openDirect("testdata", "idna_rules", &errorCode); if(U_FAILURE(errorCode)) { - log_err("ures_openDirect(\"idna_rules\") failed when U_USING_FALLBACK_WARNING was set prior to call: %s\n", u_errorName(errorCode)); + log_data_err("ures_openDirect(\"idna_rules\") failed when U_USING_FALLBACK_WARNING was set prior to call: %s\n", u_errorName(errorCode)); return; } ures_close(idna_rules); @@ -553,7 +553,7 @@ TestOpenDirect(void) { errorCode=U_ZERO_ERROR; casing=ures_open("testdata", "casing", &errorCode); if(U_FAILURE(errorCode)) { - log_err("ures_open(\"casing\") failed: %s\n", u_errorName(errorCode)); + log_data_err("ures_open(\"casing\") failed: %s\n", u_errorName(errorCode)); return; } @@ -580,7 +580,7 @@ TestOpenDirect(void) { errorCode=U_ZERO_ERROR; ne=ures_open("testdata", "ne", &errorCode); if(U_FAILURE(errorCode)) { - log_err("ures_open(\"ne\") failed (expected to get root): %s\n", u_errorName(errorCode)); + log_data_err("ures_open(\"ne\") failed (expected to get root): %s\n", u_errorName(errorCode)); } if(errorCode!=U_USING_DEFAULT_WARNING || 0!=uprv_strcmp("root", ures_getLocale(ne, &errorCode))) { log_err("ures_open(\"ne\") found something other than \"root\" - %s\n", u_errorName(errorCode)); @@ -590,7 +590,7 @@ TestOpenDirect(void) { errorCode=U_ZERO_ERROR; ne=ures_openDirect("testdata", "ne", &errorCode); if(U_SUCCESS(errorCode)) { - log_err("ures_openDirect(\"ne\") succeeded unexpectedly\n"); + log_data_err("ures_openDirect(\"ne\") succeeded unexpectedly\n"); ures_close(ne); } @@ -598,7 +598,7 @@ TestOpenDirect(void) { errorCode=U_ZERO_ERROR; te_IN=ures_openDirect("testdata", "te_IN", &errorCode); if(U_FAILURE(errorCode)) { - log_err("ures_open(\"te_IN\") failed: %s\n", u_errorName(errorCode)); + log_data_err("ures_open(\"te_IN\") failed: %s\n", u_errorName(errorCode)); return; } errorCode=U_ZERO_ERROR; @@ -915,7 +915,7 @@ static void TestGetSize(void) { if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat %s\n", u_errorName(status)); return; } @@ -973,7 +973,7 @@ static void TestGetLocaleByType(void) { if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat %s\n", u_errorName(status)); return; } diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index 136a9a3465..147138c4c9 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -424,7 +424,7 @@ static void TestDecodedBundle(){ #if UCONFIG_NO_LEGACY_CONVERSION log_info("Couldn't load iscii.bin from test data bundle, (because UCONFIG_NO_LEGACY_CONVERSION is turned on)\n"); #else - log_err("Could not find iscii.bin from test data bundle. Error: %s\n", u_errorName(error)); + log_data_err("Could not find iscii.bin from test data bundle. Error: %s\n", u_errorName(error)); #endif ures_close(resB); return; @@ -465,7 +465,7 @@ static void TestNewTypes() { if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -763,7 +763,7 @@ static void TestEmptyTypes() { testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -897,7 +897,7 @@ static void TestEmptyBundle(){ testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } resb = ures_open(testdatapath, "testempty", &status); @@ -932,7 +932,7 @@ static void TestBinaryCollationData(){ testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -990,7 +990,7 @@ static void TestAPI() { testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } len =(int32_t)strlen(testdatapath); @@ -1152,7 +1152,7 @@ static void TestErrorConditions(){ testdatapath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } len = (int32_t)strlen(testdatapath); @@ -1459,7 +1459,7 @@ static void TestResourceBundles() UErrorCode status = U_ZERO_ERROR; loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } @@ -1501,7 +1501,7 @@ static void TestConstruction1() testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -1600,7 +1600,7 @@ static UBool testTag(const char* frag, testdatapath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return FALSE; } @@ -2103,7 +2103,7 @@ static void TestResourceLevelAliasing(void) { testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -2111,7 +2111,7 @@ static void TestResourceLevelAliasing(void) { if(U_FAILURE(status)) { - log_err("Could not load testaliases.res %s \n",myErrorName(status)); + log_data_err("Could not load testaliases.res %s \n",myErrorName(status)); return; } /* this should fail - circular alias */ @@ -2334,7 +2334,7 @@ static void TestDirectAccess(void) { t = ures_findResource("/testdata/te/zoneStrings/3/2", t, &status); if(U_FAILURE(status)) { - log_err("Couldn't access indexed resource, error %s\n", u_errorName(status)); + log_data_err("Couldn't access indexed resource, error %s\n", u_errorName(status)); status = U_ZERO_ERROR; } else { key = ures_getKey(t); @@ -2344,7 +2344,7 @@ static void TestDirectAccess(void) { } t = ures_findResource("en/calendar/gregorian/DateTimePatterns/3", t, &status); if(U_FAILURE(status)) { - log_err("Couldn't access indexed resource, error %s\n", u_errorName(status)); + log_data_err("Couldn't access indexed resource, error %s\n", u_errorName(status)); status = U_ZERO_ERROR; } else { key = ures_getKey(t); @@ -2355,7 +2355,7 @@ static void TestDirectAccess(void) { t = ures_findResource("ja/LocaleScript", t, &status); if(U_FAILURE(status)) { - log_err("Couldn't access keyed resource, error %s\n", u_errorName(status)); + log_data_err("Couldn't access keyed resource, error %s\n", u_errorName(status)); status = U_ZERO_ERROR; } else { key = ures_getKey(t); @@ -2388,14 +2388,14 @@ static void TestDirectAccess(void) { t = ures_findResource("root/calendar/islamic-civil/DateTime", t, &status); if(U_SUCCESS(status)) { - log_err("This resource does not exist. How did it get here?\n"); + log_data_err("This resource does not exist. How did it get here?\n"); } status = U_ZERO_ERROR; /* this one will freeze */ t = ures_findResource("root/calendar/islamic-civil/eras/abbreviated/0/mikimaus/pera", t, &status); if(U_SUCCESS(status)) { - log_err("Second resource does not exist. How did it get here?\n"); + log_data_err("Second resource does not exist. How did it get here?\n"); } status = U_ZERO_ERROR; @@ -2634,7 +2634,7 @@ static void TestXPath(void) { const char *testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } @@ -2694,7 +2694,7 @@ static void TestCLDRStyleAliases(void) { const char *expects[7] = { "", "a41", "a12", "a03", "ar4" }; const char *testdatapath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat %s \n",myErrorName(status)); + log_data_err("Could not load testdata.dat %s \n",myErrorName(status)); return; } log_verbose("Testing CLDR style aliases......\n"); @@ -2743,21 +2743,21 @@ static void TestFallbackCodes(void) { fall = ures_getByKeyWithFallback(r, "tag2", fall, &status); if(status != U_ZERO_ERROR) { - log_err("Expected error code to be U_ZERO_ERROR, got %s\n", u_errorName(status)); + log_data_err("Expected error code to be U_ZERO_ERROR, got %s\n", u_errorName(status)); status = U_ZERO_ERROR; } fall = ures_getByKeyWithFallback(r, "tag7", fall, &status); if(status != U_USING_FALLBACK_WARNING) { - log_err("Expected error code to be U_USING_FALLBACK_WARNING, got %s\n", u_errorName(status)); + log_data_err("Expected error code to be U_USING_FALLBACK_WARNING, got %s\n", u_errorName(status)); } status = U_ZERO_ERROR; fall = ures_getByKeyWithFallback(r, "tag1", fall, &status); if(status != U_USING_DEFAULT_WARNING) { - log_err("Expected error code to be U_USING_DEFAULT_WARNING, got %s\n", u_errorName(status)); + log_data_err("Expected error code to be U_USING_DEFAULT_WARNING, got %s\n", u_errorName(status)); } status = U_ZERO_ERROR; @@ -2773,7 +2773,7 @@ static void TestStackReuse(void) { UResourceBundle *rb = ures_open(NULL, "en_US", &errorCode); if(U_FAILURE(errorCode)) { - log_err("Could not load en_US locale. status=%s\n",myErrorName(errorCode)); + log_data_err("Could not load en_US locale. status=%s\n",myErrorName(errorCode)); return; } ures_initStackObject(&table); @@ -2913,7 +2913,7 @@ TestGetUTF8String() { status = U_ZERO_ERROR; testdatapath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat - %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat - %s\n", u_errorName(status)); return; } diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index 08e2da96b0..6c655555ef 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2001-2007, International Business Machines Corporation and + * Copyright (c) 2001-2008, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -1188,7 +1188,7 @@ Test_WCHART_LongString(){ UBool failed = FALSE; if(U_FAILURE(status)){ - log_err("Could not get testinclude resource from testtypes bundle. Error: %s\n",u_errorName(status)); + log_data_err("Could not get testinclude resource from testtypes bundle. Error: %s\n",u_errorName(status)); return; } diff --git a/icu4c/source/test/cintltst/spreptst.c b/icu4c/source/test/cintltst/spreptst.c index 1652984b52..8a2fa96805 100644 --- a/icu4c/source/test/cintltst/spreptst.c +++ b/icu4c/source/test/cintltst/spreptst.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2006, International Business Machines + * Copyright (C) 2003-2008, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -58,7 +58,7 @@ Test_nfs4_cs_prep_data(void){ UErrorCode errorCode = U_ZERO_ERROR; loadTestData(&errorCode); if(U_FAILURE(errorCode)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); return; } @@ -82,7 +82,7 @@ Test_nfs4_mixed_prep_data(void){ UErrorCode errorCode = U_ZERO_ERROR; loadTestData(&errorCode); if(U_FAILURE(errorCode)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); return; } @@ -309,7 +309,7 @@ static void Test_nfs4_cis_prep(void){ UErrorCode loadStatus = U_ZERO_ERROR; loadTestData(&loadStatus); if (U_FAILURE(loadStatus)) { - log_err("Test could not initialize. Got %s\n", u_errorName(loadStatus)); + log_data_err("Test could not initialize. Got %s\n", u_errorName(loadStatus)); return; } @@ -428,7 +428,7 @@ Test_nfs4_mixed_prep(void){ UErrorCode loadStatus = U_ZERO_ERROR; loadTestData(&loadStatus); if (U_FAILURE(loadStatus)) { - log_err("Test could not initialize. Got %s\n", u_errorName(loadStatus)); + log_data_err("Test could not initialize. Got %s\n", u_errorName(loadStatus)); return; } @@ -485,7 +485,7 @@ Test_nfs4_cs_prep(void){ UErrorCode errorCode = U_ZERO_ERROR; loadTestData(&errorCode); if(U_FAILURE(errorCode)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); return; } @@ -597,7 +597,7 @@ static void TestBEAMWarning(){ UChar src =0x0000; testdatapath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } /* open the profile */ diff --git a/icu4c/source/test/cintltst/sprpdata.c b/icu4c/source/test/cintltst/sprpdata.c index 0349541c4b..a96251cb34 100644 --- a/icu4c/source/test/cintltst/sprpdata.c +++ b/icu4c/source/test/cintltst/sprpdata.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2004, International Business Machines + * Copyright (C) 2003-2008, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -288,7 +288,10 @@ doStringPrepTest(const char* binFileName, const char* txtFileName, int32_t optio filename = (char*) malloc(strlen(srcdatapath)+strlen(relativepath)+strlen(txtFileName)+10 ); profile = usprep_open(testdatapath, binFileName, errorCode); - if(U_FAILURE(*errorCode)){ + if(*errorCode == U_FILE_ACCESS_ERROR) { + log_data_err("Failed to load %s data file. Error: %s \n", binFileName, u_errorName(*errorCode)); + return; + } else if(U_FAILURE(*errorCode)){ log_err("Failed to load %s data file. Error: %s \n", binFileName, u_errorName(*errorCode)); return; } diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c index 1bb031bf98..e609b476f1 100644 --- a/icu4c/source/test/cintltst/udatatst.c +++ b/icu4c/source/test/cintltst/udatatst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1998-2007, International Business Machines Corporation and + * Copyright (c) 1998-2008, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -132,7 +132,7 @@ static void TestUDataOpen(){ const char* testPath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } @@ -143,7 +143,7 @@ static void TestUDataOpen(){ log_verbose("Testing udata_open()\n"); result=udata_open(testPath, type, name, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_open() failed for path = %s, name=%s, type=%s, \n errorcode=%s\n", testPath, name, type, myErrorName(status)); + log_data_err("FAIL: udata_open() failed for path = %s, name=%s, type=%s, \n errorcode=%s\n", testPath, name, type, myErrorName(status)); } else { log_verbose("PASS: udata_open worked\n"); udata_close(result); @@ -247,7 +247,7 @@ static void TestUDataOpen(){ status = U_ZERO_ERROR; result = udata_open( testPath, "typ", "nam", &status); if (status != U_ZERO_ERROR) { - log_err("FAIL: udata_open( \"%s\", \"typ\", \"nam\") returned status %s\n", testPath, u_errorName(status)); + log_data_err("FAIL: udata_open( \"%s\", \"typ\", \"nam\") returned status %s\n", testPath, u_errorName(status)); } udata_close(result); free(icuDataFilePath); @@ -313,7 +313,7 @@ static void TestUDataOpen(){ strcat(longTestPath, testPath); result=udata_open(longTestPath, type, name, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_open() failed for path = %s\n name=%s, type=%s, \n errorcode=%s\n", + log_data_err("FAIL: udata_open() failed for path = %s\n name=%s, type=%s, \n errorcode=%s\n", longTestPath, name, type, myErrorName(status)); } else { log_verbose("PASS: udata_open worked\n"); @@ -332,7 +332,7 @@ static void TestUDataOpen(){ result=udata_open(longTestPath, type, longName, &status); if (status != U_FILE_ACCESS_ERROR) { - log_err("FAIL: udata_open() failed for path = %s\n name=%s, type=%s, \n errorcode=%s\n", + log_data_err("FAIL: udata_open() failed for path = %s\n name=%s, type=%s, \n errorcode=%s\n", longTestPath, longName, type, myErrorName(status)); } udata_close(result); @@ -602,13 +602,13 @@ static void TestUDataOpenChoiceDemo1() { const char* testPath="testdata"; const char* fullTestDataPath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } result=udata_openChoice(NULL, "icu", name[0], isAcceptable1, NULL, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_openChoice() failed name=%s, type=%s, \n errorcode=%s\n", name[0], type, myErrorName(status)); + log_data_err("FAIL: udata_openChoice() failed name=%s, type=%s, \n errorcode=%s\n", name[0], type, myErrorName(status)); } else { log_verbose("PASS: udata_openChoice worked\n"); udata_close(result); @@ -620,7 +620,7 @@ static void TestUDataOpenChoiceDemo1() { status=U_ZERO_ERROR; result=udata_openChoice(NULL, type, name[1], isAcceptable2, NULL, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_openChoice() failed name=%s, type=%s, \n errorcode=%s\n", name[1], type, myErrorName(status)); + log_data_err("FAIL: udata_openChoice() failed name=%s, type=%s, \n errorcode=%s\n", name[1], type, myErrorName(status)); } } else { @@ -637,7 +637,7 @@ static void TestUDataOpenChoiceDemo1() { status=U_ZERO_ERROR; result=udata_openChoice(testPath, type, name[2], isAcceptable3, NULL, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_openChoice() failed path=%s name=%s, type=%s, \n errorcode=%s\n", testPath, name[2], type, myErrorName(status)); + log_data_err("FAIL: udata_openChoice() failed path=%s name=%s, type=%s, \n errorcode=%s\n", testPath, name[2], type, myErrorName(status)); } } else { @@ -698,13 +698,13 @@ static void TestUDataOpenChoiceDemo2() { const char* type="icu"; const char* path = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } result=udata_openChoice(path, type, name, isAcceptable, &p, &status); if(U_FAILURE(status)){ - log_err("failed to load data at p=%s t=%s n=%s, isAcceptable", path, type, name); + log_data_err("failed to load data at p=%s t=%s n=%s, isAcceptable", path, type, name); } if(U_SUCCESS(status) ) { udata_close(result); @@ -720,12 +720,12 @@ static void TestUDataOpenChoiceDemo2() { p++; } else { - log_err("FAIL: failed to either load the data or to reject the loaded data. ERROR=%s\n", myErrorName(status) ); + log_data_err("FAIL: failed to either load the data or to reject the loaded data. ERROR=%s\n", myErrorName(status) ); } } else if(p == 2) { if(U_FAILURE(status)) { - log_err("FAIL: failed to load the data and accept it. ERROR=%s\n", myErrorName(status) ); + log_data_err("FAIL: failed to load the data and accept it. ERROR=%s\n", myErrorName(status) ); } else { log_verbose("Loads the data and accepts it for p==2 as expected\n"); @@ -760,14 +760,14 @@ static void TestUDataGetInfo() { const char* testPath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } log_verbose("Testing udata_getInfo() for cnvalias.icu\n"); result=udata_open(NULL, "icu", name, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_open() failed for path = NULL, name=%s, type=%s, \n errorcode=%s\n", name, type, myErrorName(status)); + log_data_err("FAIL: udata_open() failed for path = NULL, name=%s, type=%s, \n errorcode=%s\n", name, type, myErrorName(status)); return; } udata_getInfo(result, &dataInfo); @@ -791,7 +791,7 @@ static void TestUDataGetInfo() { log_verbose("Testing udata_getInfo() for test.icu\n"); result=udata_open(testPath, type, name2, &status); if(U_FAILURE(status)) { - log_err("FAIL: udata_open() failed for path=%s name2=%s, type=%s, \n errorcode=%s\n", testPath, name2, type, myErrorName(status)); + log_data_err("FAIL: udata_open() failed for path=%s name2=%s, type=%s, \n errorcode=%s\n", testPath, name2, type, myErrorName(status)); return; } udata_getInfo(result, &dataInfo); @@ -826,7 +826,7 @@ static void TestUDataGetMemory() { const char* testPath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } @@ -834,7 +834,7 @@ static void TestUDataGetMemory() { log_verbose("Testing udata_getMemory() for \"cnvalias.icu\"\n"); result=udata_openChoice(NULL, type, name, isAcceptable1, NULL, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_openChoice() failed for name=%s, type=%s, \n errorcode=%s\n", name, type, myErrorName(status)); + log_data_err("FAIL: udata_openChoice() failed for name=%s, type=%s, \n errorcode=%s\n", name, type, myErrorName(status)); return; } table=(const int32_t *)udata_getMemory(result); @@ -849,7 +849,7 @@ static void TestUDataGetMemory() { log_verbose("Testing udata_getMemory for \"test.icu\"()\n"); result=udata_openChoice(testPath, type, name2, isAcceptable3, NULL, &status); if(U_FAILURE(status)){ - log_err("FAIL: udata_openChoice() failed for path=%s name=%s, type=%s, \n errorcode=%s\n", testPath, name2, type, myErrorName(status)); + log_data_err("FAIL: udata_openChoice() failed for path=%s name=%s, type=%s, \n errorcode=%s\n", testPath, name2, type, myErrorName(status)); return; } intValue=(uint16_t *)udata_getMemory(result); @@ -885,7 +885,7 @@ static void TestErrorConditions(){ const char *testPath = loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } @@ -894,7 +894,7 @@ static void TestErrorConditions(){ log_verbose("Testing udata_open() with status != U_ZERO_ERROR\n"); result=udata_open(testPath, type, name, &status); if(result != NULL){ - log_err("FAIL: udata_open() is supposed to fail for path = %s, name=%s, type=%s, \n errorcode !=U_ZERO_ERROR\n", testPath, name, type); + log_data_err("FAIL: udata_open() is supposed to fail for path = %s, name=%s, type=%s, \n errorcode !=U_ZERO_ERROR\n", testPath, name, type); udata_close(result); } else { @@ -994,14 +994,14 @@ static void TestAppData() const char* testPath=loadTestData(&status); if(U_FAILURE(status)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); return; } icu = ures_open(NULL, "root", &status); if(U_FAILURE(status)) { - log_err("%s:%d: Couldn't open root ICU bundle- %s", __FILE__, __LINE__, u_errorName(status)); + log_data_err("%s:%d: Couldn't open root ICU bundle- %s", __FILE__, __LINE__, u_errorName(status)); return; } /* log_info("Open icu root: %s size_%d\n", u_errorName(status), ures_getSize(icu)); */ @@ -1010,7 +1010,7 @@ static void TestAppData() app = ures_open(testPath, "root", &status); if(U_FAILURE(status)) { - log_err("%s:%d: Couldn't open app ICU bundle [%s]- %s", __FILE__, __LINE__, testPath, u_errorName(status)); + log_data_err("%s:%d: Couldn't open app ICU bundle [%s]- %s", __FILE__, __LINE__, testPath, u_errorName(status)); return; } /* log_info("Open app: %s, size %d\n", u_errorName(status), ures_getSize(app)); */ @@ -1575,7 +1575,7 @@ TestSwapData() { testPath=loadTestData(&errorCode); if(U_FAILURE(errorCode)) { - log_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); + log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode)); } /* Test that printError works as expected. */ diff --git a/icu4c/source/test/iotest/iotest.cpp b/icu4c/source/test/iotest/iotest.cpp index 25b7753e68..f0f51c99c7 100644 --- a/icu4c/source/test/iotest/iotest.cpp +++ b/icu4c/source/test/iotest/iotest.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2002-2007, International Business Machines +* Copyright (C) 2002-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: iotest.cpp @@ -140,7 +140,7 @@ public: if(U_FAILURE(err)){ err = U_FILE_ACCESS_ERROR; - log_err("Could not load testtypes.res in testdata bundle with path %s - %s\n", tdpath, u_errorName(err)); + log_data_err("Could not load testtypes.res in testdata bundle with path %s - %s\n", tdpath, u_errorName(err)); return ""; } ures_close(test); @@ -337,7 +337,7 @@ static void U_CALLCONV DataDrivenPrintf(void) delete dataModule; } else { - log_err("Failed: could not load test icuio data\n"); + log_data_err("Failed: could not load test icuio data\n"); } #endif } @@ -539,7 +539,7 @@ static void U_CALLCONV DataDrivenScanf(void) delete dataModule; } else { - log_err("Failed: could not load test icuio data\n"); + log_data_err("Failed: could not load test icuio data\n"); } #endif } @@ -666,7 +666,7 @@ static void U_CALLCONV DataDrivenPrintfPrecision(void) delete dataModule; } else { - log_err("Failed: could not load test icuio data\n"); + log_data_err("Failed: could not load test icuio data\n"); } #endif }