ICU-9345 add -T (notime) option to intltest

X-SVN-Rev: 31880
This commit is contained in:
Steven R. Loomis 2012-05-30 00:37:33 +00:00
parent ba912623dc
commit 5c95e765c1
2 changed files with 35 additions and 12 deletions

View File

@ -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<LL_indentlevel;i++) {
errorList += " ";
@ -1073,6 +1085,7 @@ main(int argc, char* argv[])
UBool all = FALSE;
UBool verbose = FALSE;
UBool no_err_msg = FALSE;
UBool no_time = FALSE;
UBool quick = TRUE;
UBool name = FALSE;
UBool leaks = FALSE;
@ -1109,6 +1122,9 @@ main(int argc, char* argv[])
else if (strcmp("leaks", str) == 0 ||
strcmp("l", str) == 0)
leaks = TRUE;
else if (strcmp("notime", str) == 0 ||
strcmp("T", str) == 0)
no_time = TRUE;
else if (strcmp("x", str)==0) {
if(++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:<propery>=<value>, \n"
"### notime (T), \n"
"### threads:<threadCount> (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;

View File

@ -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: