Unit testing update:
- Verbosity is now honored globally - Added BTestCase::Outputf() - Migrated BNode, BStatable, BDirectory, and BPath tests - Added CommonTestLib, TestLib, and R5TestLib rules to Jamrules - Updated Jamfiles for unit testing stuff - Probably a few other things I've forgotten git-svn-id: file:///srv/svn/repos/haiku/trunk/current@269 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -46,6 +46,37 @@ BThreadedTestCase::NextSubTest() {
|
||||
BTestCase::NextSubTest();
|
||||
}
|
||||
|
||||
void
|
||||
BThreadedTestCase::Outputf(const char *str, ...) {
|
||||
if (BeVerbose()) {
|
||||
// Figure out if this is a multithreaded test or not
|
||||
thread_id id = find_thread(NULL);
|
||||
bool isSingleThreaded;
|
||||
{
|
||||
BAutolock lock(fUpdateLock);
|
||||
isSingleThreaded = fNumberMap.find(id) == fNumberMap.end();
|
||||
}
|
||||
if (isSingleThreaded) {
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
vprintf(str, args);
|
||||
va_end(args);
|
||||
fflush(stdout);
|
||||
} else {
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
char msg[1024]; // Need a longer string? Change the constant or change the function. :-)
|
||||
vsprintf(msg, str, args);
|
||||
va_end(args);
|
||||
{
|
||||
// Acquire the update lock and post our update
|
||||
BAutolock lock(fUpdateLock);
|
||||
fUpdateList.push_back(std::string(msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BThreadedTestCase::InitThreadInfo(thread_id id, std::string threadName) {
|
||||
BAutolock lock(fUpdateLock); // Lock the number map
|
||||
|
||||
Reference in New Issue
Block a user