From 35bdabdc688285908c7807f53ffce2a60f5d2033 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Thu, 25 Apr 2002 21:49:16 +0000 Subject: [PATCH] ICU-1872 A better test for the global mutex X-SVN-Rev: 8515 --- icu4c/source/test/cintltst/calltest.c | 16 +++++++++------- icu4c/source/test/cintltst/cintltst.c | 21 ++++++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/icu4c/source/test/cintltst/calltest.c b/icu4c/source/test/cintltst/calltest.c index ea5128b293c..b69b59a1929 100644 --- a/icu4c/source/test/cintltst/calltest.c +++ b/icu4c/source/test/cintltst/calltest.c @@ -16,6 +16,7 @@ #include "cintltst.h" +void addSetup(TestNode** root); void addUtility(TestNode** root); void addBreakIter(TestNode** root); void addStandardNamesTest(TestNode **root); @@ -34,20 +35,21 @@ void addUCharTransformTest(TestNode** root); void addAllTests(TestNode** root) { - addStandardNamesTest(root); + addSetup(root); /* Leave this test first! */ + addUDataTest(root); + addPUtilTest(root); addUTF16Test(root); addUTF8Test(root); addUtility(root); - addBreakIter(root); - addFormatTest(root); addConvert(root); + addUCharTransformTest(root); + addCompactArrayTest(root); + addFormatTest(root); + addStandardNamesTest(root); + addBreakIter(root); addCollTest(root); addComplexTest(root); - addUDataTest(root); addUTransTest(root); - addPUtilTest(root); - addCompactArrayTest(root); addTestDeprecatedAPI(root); - addUCharTransformTest(root); } diff --git a/icu4c/source/test/cintltst/cintltst.c b/icu4c/source/test/cintltst/cintltst.c index ce11c64498d..ea044ad6596 100644 --- a/icu4c/source/test/cintltst/cintltst.c +++ b/icu4c/source/test/cintltst/cintltst.c @@ -47,6 +47,20 @@ static char* _testDataPath=NULL; */ void ctest_setICU_DATA(void); +static UBool gMutexInitialized = TRUE; + +static TestMutex(void) { + if (gMutexInitialized) { + log_err("*** Failure! The global mutex was not initialized.\n" + "*** Make sure the right linker was used.\n"); + } +} + +void addSetup(TestNode** root) +{ + addTest(root, &TestMutex, "setup/TestMutex"); +} + int main(int argc, const char* const argv[]) { int nerrors = 0; @@ -58,11 +72,8 @@ int main(int argc, const char* const argv[]) UConverter *cnv; /* 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; + if (umtx_isInitialized(NULL)) { + gMutexInitialized = FALSE; } while (REPEAT_TESTS > 0) {