From 4c605ab55aaac2a178976c8c0170d6bd7aceb3cf Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Sep 2002 18:58:56 +0000 Subject: [PATCH] ICU-1941 allow -w to not fail on missing data, in sanity tests X-SVN-Rev: 9913 --- icu4c/source/test/cintltst/cintltst.c | 38 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/icu4c/source/test/cintltst/cintltst.c b/icu4c/source/test/cintltst/cintltst.c index 22d419967d..c63d5e1e05 100644 --- a/icu4c/source/test/cintltst/cintltst.c +++ b/icu4c/source/test/cintltst/cintltst.c @@ -74,7 +74,10 @@ void addSetup(TestNode** root) int main(int argc, const char* const argv[]) { int nerrors = 0; + int warnOnMissingData = 0; + int i; TestNode *root; + const char *warnOrErr = "Failure"; /* initial check for the default converter */ UErrorCode errorCode = U_ZERO_ERROR; @@ -84,6 +87,14 @@ int main(int argc, const char* const argv[]) /* This must be tested before using anything! */ gMutexInitialized = umtx_isInitialized(NULL); + /* Checkargs */ + for(i=1;i 0) { #ifdef CTST_LEAK_CHECK @@ -116,10 +127,13 @@ int main(int argc, const char* const argv[]) ucnv_close(cnv); } else { fprintf(stderr, - "*** Failure! The default converter cannot be opened.\n" + "*** %s! The default converter cannot be opened.\n" "*** Check the ICU_DATA environment variable and \n" - "*** check that the data files are present.\n"); - return 1; + "*** check that the data files are present.\n", warnOrErr); + if(warnOnMissingData == 0) { + fprintf(stderr, "*** Exitting. Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n"); + return 1; + } } /* try more data */ @@ -129,10 +143,13 @@ int main(int argc, const char* const argv[]) ucnv_close(cnv); } else { fprintf(stderr, - "*** Failure! The converter for " TRY_CNV_2 " cannot be opened.\n" + "*** %s! The converter for " TRY_CNV_2 " cannot be opened.\n" "*** Check the ICU_DATA environment variable and \n" - "*** check that the data files are present.\n"); - return 1; + "*** check that the data files are present.\n", warnOrErr); + if(warnOnMissingData == 0) { + fprintf(stderr, "*** Exitting. Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n"); + return 1; + } } rb = ures_open(NULL, "en", &errorCode); @@ -141,10 +158,13 @@ int main(int argc, const char* const argv[]) ures_close(rb); } else { fprintf(stderr, - "*** Failure! The \"en\" locale resource bundle cannot be opened.\n" + "*** %s! The \"en\" locale resource bundle cannot be opened.\n" "*** Check the ICU_DATA environment variable and \n" - "*** check that the data files are present.\n"); - return 1; + "*** check that the data files are present.\n", warnOrErr); + if(warnOnMissingData == 0) { + fprintf(stderr, "*** Exitting. Use the '-w' option if data files were\n*** purposely removed, to continue test anyway.\n"); + return 1; + } } fprintf(stdout, "Default locale for this run is %s\n", uloc_getDefault());