ICU-1872 A better test for the global mutex

X-SVN-Rev: 8517
This commit is contained in:
George Rhoten 2002-04-25 22:15:52 +00:00
parent 802688f52f
commit db3c628396
5 changed files with 79 additions and 74 deletions

View File

@ -47,10 +47,10 @@ static char* _testDataPath=NULL;
*/
void ctest_setICU_DATA(void);
static UBool gMutexInitialized = TRUE;
static UBool gMutexInitialized = FALSE;
static TestMutex(void) {
if (gMutexInitialized) {
if (!gMutexInitialized) {
log_err("*** Failure! The global mutex was not initialized.\n"
"*** Make sure the right linker was used.\n");
}
@ -72,9 +72,7 @@ int main(int argc, const char* const argv[])
UConverter *cnv;
/* This must be tested before using anything! */
if (umtx_isInitialized(NULL)) {
gMutexInitialized = FALSE;
}
gMutexInitialized = umtx_isInitialized(NULL);
while (REPEAT_TESTS > 0) {

View File

@ -26,6 +26,7 @@
#include "intltest.h"
#include "caltztst.h"
#include "itmajor.h"
#include "tsmutex.h"
#include "umutex.h"
@ -886,12 +887,7 @@ main(int argc, char* argv[])
UConverter *cnv = NULL;
/* This must be tested before using anything! */
if (!umtx_isInitialized(NULL)) {
fprintf(stderr,
"*** Failure! The global mutex was not initialized.\n"
"*** Make sure the right linker was used.\n");
return 1;
}
MutexTest::gMutexInitialized = umtx_isInitialized(NULL);
#ifdef XP_MAC_CONSOLE
argc = ccommand( &argv );
@ -1082,6 +1078,7 @@ main(int argc, char* argv[])
}
return major.getErrors();
}
const char* IntlTest::loadTestData(UErrorCode& err){
const char* directory=NULL;
UResourceBundle* test =NULL;

View File

@ -33,68 +33,6 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
if (exec) logln("TestSuite Utilities: ");
switch (index) {
case 0:
name = "StringTest";
if (exec) {
logln("StringTest---"); logln("");
StringTest test;
callTest( test, par );
}
break;
case 1:
name = "UnicodeStringTest";
if (exec) {
logln("UnicodeStringTest---"); logln("");
UnicodeStringTest test;
callTest( test, par );
}
break;
case 2:
name = "LocaleTest";
if (exec) {
logln("LocaleTest---"); logln("");
LocaleTest test;
callTest( test, par );
}
break;
case 3:
name = "CharIterTest";
if (exec) {
logln("CharIterTest---"); logln("");
CharIterTest test;
callTest( test, par );
}
break;
case 4:
name = "UnicodeTest";
if (exec) {
logln("UnicodeTest---"); logln("");
UnicodeTest test;
callTest( test, par );
}
break;
case 5:
name = "ResourceBundleTest";
if (exec) {
logln("ResourceBundleTest---"); logln("");
ResourceBundleTest test;
callTest( test, par );
}
break;
case 6:
name = "NewResourceBundleTest";
if (exec) {
logln("NewResourceBundleTest---"); logln("");
NewResourceBundleTest test;
callTest( test, par );
}
break;
case 7:
name = "MutexTest";
if (exec) {
logln("MutexTest---"); logln("");
@ -103,7 +41,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
}
break;
case 8:
case 1:
name = "MultithreadTest";
if (exec) {
logln("MultithreadTest---"); logln("");
@ -112,6 +50,68 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
}
break;
case 2:
name = "StringTest";
if (exec) {
logln("StringTest---"); logln("");
StringTest test;
callTest( test, par );
}
break;
case 3:
name = "UnicodeStringTest";
if (exec) {
logln("UnicodeStringTest---"); logln("");
UnicodeStringTest test;
callTest( test, par );
}
break;
case 4:
name = "LocaleTest";
if (exec) {
logln("LocaleTest---"); logln("");
LocaleTest test;
callTest( test, par );
}
break;
case 5:
name = "CharIterTest";
if (exec) {
logln("CharIterTest---"); logln("");
CharIterTest test;
callTest( test, par );
}
break;
case 6:
name = "UnicodeTest";
if (exec) {
logln("UnicodeTest---"); logln("");
UnicodeTest test;
callTest( test, par );
}
break;
case 7:
name = "ResourceBundleTest";
if (exec) {
logln("ResourceBundleTest---"); logln("");
ResourceBundleTest test;
callTest( test, par );
}
break;
case 8:
name = "NewResourceBundleTest";
if (exec) {
logln("NewResourceBundleTest---"); logln("");
NewResourceBundleTest test;
callTest( test, par );
}
break;
case 9:
name = "PUtilTest";
if (exec) {

View File

@ -63,7 +63,14 @@ void MutexTest::runIndexedTest( int32_t index, UBool exec,
}
}
UBool MutexTest::gMutexInitialized = FALSE;
void MutexTest::TestMutex() {
/* This is tested in intltest.cpp before anything starts. */
if (!gMutexInitialized) {
errln("*** Failure! The global mutex was not initialized.\n"
"*** Make sure the right linker was used.\n");
}
}

View File

@ -32,6 +32,9 @@ public:
**/
void TestLock(void);
/* Was the global mutex initialized. */
static UBool gMutexInitialized;
private:
};