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:
Tyler Dauwalder
2002-07-17 10:50:55 +00:00
parent cbe085bc5a
commit d1f6c38f0d
26 changed files with 890 additions and 585 deletions
+31
View File
@@ -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