From 5c95e765c1f258c42ad9a0ac142e2654d49995df Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 30 May 2012 00:37:33 +0000 Subject: [PATCH] ICU-9345 add -T (notime) option to intltest X-SVN-Rev: 31880 --- icu4c/source/test/intltest/intltest.cpp | 43 ++++++++++++++++++------- icu4c/source/test/intltest/intltest.h | 4 ++- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index 58563504015..ff26c64de3e 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -508,6 +508,7 @@ IntlTest::IntlTest() errorCount = 0; dataErrorCount = 0; verbose = FALSE; + no_time = FALSE; no_err_msg = FALSE; warn_on_missing_data = FALSE; quick = FALSE; @@ -558,6 +559,13 @@ UBool IntlTest::setVerbose( UBool verboseVal ) return rval; } +UBool IntlTest::setNotime( UBool no_time ) +{ + UBool rval = this->no_time; + this->no_time = no_time; + return rval; +} + UBool IntlTest::setWarnOnMissingData( UBool warn_on_missing_dataVal ) { UBool rval = this->warn_on_missing_data; @@ -710,7 +718,11 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName ) UDate timeStop = uprv_getRawUTCtime(); rval = TRUE; // at least one test has been called char secs[256]; - sprintf(secs, "%f", (timeStop-timeStart)/1000.0); + if(!no_time) { + sprintf(secs, "%f", (timeStop-timeStart)/1000.0); + } else { + secs[0]=0; + } strcpy(saveBaseLoc,name); @@ -723,11 +735,11 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName ) if (lastErrorCount == errorCount) { sprintf( msg, " } OK: %s ", name ); - str_timeDelta(msg+strlen(msg),timeStop-timeStart); + if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); lastTestFailed = FALSE; }else{ sprintf(msg, " } ERRORS (%li) in %s", (long)(errorCount-lastErrorCount), name); - str_timeDelta(msg+strlen(msg),timeStop-timeStart); + if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); for(int i=0;i=argc) { printf("* Error: '-x' option requires an argument. usage: '-x outfile.xml'.\n"); @@ -1151,6 +1167,7 @@ main(int argc, char* argv[]) "### \n" "### Options are: verbose (v), all (a), noerrormsg (n), \n" "### exhaustive (e), leaks (l), -x xmlfile.xml, prop:=, \n" + "### notime (T), \n" "### threads: (Mulithreading must first be \n" "### enabled otherwise this will be ignored. \n" "### The default thread count is 1.),\n" @@ -1181,6 +1198,7 @@ main(int argc, char* argv[]) major.setLeaks( leaks ); major.setThreadCount( threadCount ); major.setWarnOnMissingData( warnOnMissingData ); + major.setNotime (no_time); for (int32_t i = 0; i < nProps; i++) { major.setProperty(props[i]); } @@ -1212,6 +1230,7 @@ main(int argc, char* argv[]) fprintf(stdout, " No error messages (n) : %s\n", (no_err_msg? "On" : "Off")); fprintf(stdout, " Exhaustive (e) : %s\n", (!quick? "On" : "Off")); fprintf(stdout, " Leaks (l) : %s\n", (leaks? "On" : "Off")); + fprintf(stdout, " notime (T) : %s\n", (no_time? "On" : "Off")); fprintf(stdout, " Warn on missing data (w) : %s\n", (warnOnMissingData? "On" : "Off")); #if (ICU_USE_THREADS==0) fprintf(stdout, " Threads : Disabled\n"); @@ -1394,13 +1413,15 @@ main(int argc, char* argv[]) if (execCount <= 0) { fprintf(stdout, "***** Not all called tests actually exist! *****\n"); } - endTime = uprv_getRawUTCtime(); - diffTime = (int32_t)(endTime - startTime); - printf("Elapsed Time: %02d:%02d:%02d.%03d\n", - (int)((diffTime%U_MILLIS_PER_DAY)/U_MILLIS_PER_HOUR), - (int)((diffTime%U_MILLIS_PER_HOUR)/U_MILLIS_PER_MINUTE), - (int)((diffTime%U_MILLIS_PER_MINUTE)/U_MILLIS_PER_SECOND), - (int)(diffTime%U_MILLIS_PER_SECOND)); + if(!no_time) { + endTime = uprv_getRawUTCtime(); + diffTime = (int32_t)(endTime - startTime); + printf("Elapsed Time: %02d:%02d:%02d.%03d\n", + (int)((diffTime%U_MILLIS_PER_DAY)/U_MILLIS_PER_HOUR), + (int)((diffTime%U_MILLIS_PER_HOUR)/U_MILLIS_PER_MINUTE), + (int)((diffTime%U_MILLIS_PER_MINUTE)/U_MILLIS_PER_SECOND), + (int)(diffTime%U_MILLIS_PER_SECOND)); + } if(ctest_xml_fini()) return 1; diff --git a/icu4c/source/test/intltest/intltest.h b/icu4c/source/test/intltest/intltest.h index be6993e8d7b..920c5d49926 100644 --- a/icu4c/source/test/intltest/intltest.h +++ b/icu4c/source/test/intltest/intltest.h @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -109,6 +109,7 @@ public: virtual UBool setNoErrMsg( UBool no_err_msg = TRUE ); virtual UBool setQuick( UBool quick = TRUE ); virtual UBool setLeaks( UBool leaks = TRUE ); + virtual UBool setNotime( UBool no_time = TRUE ); virtual UBool setWarnOnMissingData( UBool warn_on_missing_data = TRUE ); virtual int32_t setThreadCount( int32_t count = 1); @@ -244,6 +245,7 @@ protected: UBool quick; UBool leaks; UBool warn_on_missing_data; + UBool no_time; int32_t threadCount; private: -- 2.40.0