ICU-11657 Synchronize intltest message output.

X-SVN-Rev: 38036
This commit is contained in:
Andy Heninger 2015-10-06 23:13:49 +00:00
parent 48d33a120f
commit 1c869c6791

View file

@ -11,34 +11,35 @@
* IntlTest is a base class for tests.
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unicode/ctest.h" // for str_timeDelta
#include "unicode/curramt.h"
#include "unicode/locid.h"
#include "unicode/putil.h"
#include "unicode/smpdtfmt.h"
#include "unicode/timezone.h"
#include "unicode/uclean.h"
#include "unicode/ucnv.h"
#include "unicode/unistr.h"
#include "unicode/ures.h"
#include "unicode/smpdtfmt.h"
#include "unicode/ucnv.h"
#include "unicode/uclean.h"
#include "unicode/timezone.h"
#include "unicode/curramt.h"
#include "unicode/putil.h"
#include "intltest.h"
#include "caltztst.h"
#include "itmajor.h"
#include "cstring.h"
#include "umutex.h"
#include "uassert.h"
#include "cmemory.h"
#include "uoptions.h"
#include "caltztst.h"
#include "cmemory.h"
#include "cstring.h"
#include "itmajor.h"
#include "mutex.h"
#include "putilimp.h" // for uprv_getRawUTCtime()
#include "unicode/locid.h"
#include "unicode/ctest.h" // for str_timeDelta
#include "uassert.h"
#include "udbgutil.h"
#include "umutex.h"
#include "uoptions.h"
#ifdef XP_MAC_CONSOLE
#include <console.h>
@ -948,6 +949,7 @@ void IntlTest::logln(const char *fmt, ...)
vsprintf(buffer, fmt, ap);
va_end(ap);
if( verbose ) {
// TODO: change to default conversion in UnicodeString constructor.
logln(UnicodeString(buffer, ""));
}
}
@ -1079,8 +1081,16 @@ UBool IntlTest::printKnownIssues()
}
}
static UMutex messageMutex = U_MUTEX_INITIALIZER;
void IntlTest::LL_message( UnicodeString message, UBool newline )
{
// Synchronize this function.
// All error messages generated by tests funnel through here.
// Multithreaded tests can concurrently generate errors, requiring syncronization
// to keep each message together.
Mutex lock(&messageMutex);
// string that starts with a LineFeed character and continues
// with spaces according to the current indentation
static const UChar indentUChars[] = {
@ -1096,6 +1106,7 @@ void IntlTest::LL_message( UnicodeString message, UBool newline )
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
U_ASSERT(1 + LL_indentlevel <= UPRV_LENGTHOF(indentUChars));
UnicodeString indent(FALSE, indentUChars, 1 + LL_indentlevel);
char buffer[30000];