Made the Unit test stuff a bit more mwcc/mwld friendly. It still doesn't build right out of the box with our build system, but with a few changes to the build system it can be done (I'm not going to do that, though).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6640 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -6,13 +6,20 @@ rule CppUnitLibrary
|
||||
{
|
||||
# CppUnitLibrary <sources> ;
|
||||
local _lib = libcppunit.so ;
|
||||
|
||||
|
||||
UseCppUnitHeaders ;
|
||||
SetupObjectsDir ;
|
||||
MakeLocateObjects [ FGristFiles $(<) ] ;
|
||||
BuildPlatformMain $(_lib) : $(<) ;
|
||||
MakeLocateObjects [ FGristFiles $(1) ] ;
|
||||
BuildPlatformMain $(_lib) : $(1) ;
|
||||
MakeLocate $(_lib) : /boot/home/config/lib ;
|
||||
LINKFLAGS on $(_lib) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(_lib)\" ;
|
||||
|
||||
local defines = BUILDING_CPPUNIT ;
|
||||
|
||||
if $(OS) = BEOS && $(OSPLAT) = PPC {
|
||||
defines += NO_ELF_SYMBOL_PATCHING ;
|
||||
}
|
||||
ObjectsDefines $(1) : $(defines) ;
|
||||
}
|
||||
|
||||
CppUnitLibrary
|
||||
@@ -49,7 +56,10 @@ CppUnitLibrary
|
||||
;
|
||||
|
||||
LinkSharedOSLibs libcppunit.so :
|
||||
stdc++.r4
|
||||
/boot/develop/lib/x86/libbe.so
|
||||
libelfsymbolpatcher.a
|
||||
stdc++.r4 # is called `mslcpp_4_0' on PPC -- just create a symlink
|
||||
be
|
||||
;
|
||||
|
||||
if $(OS) != BEOS || $(OSPLAT) != PPC {
|
||||
LinkSharedOSLibs libcppunit.so : libelfsymbolpatcher.a ;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <SemaphoreSyncObject.h>
|
||||
#include <cppunit/Exception.h>
|
||||
|
||||
_EXPORT
|
||||
SemaphoreSyncObject::SemaphoreSyncObject()
|
||||
: fSemId(create_sem(1, "CppUnitSync"))
|
||||
{
|
||||
@@ -8,16 +9,19 @@ SemaphoreSyncObject::SemaphoreSyncObject()
|
||||
throw CppUnit::Exception("SemaphoreSyncObject::SemaphoreSyncObject() -- Error creating semaphore");
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
SemaphoreSyncObject::~SemaphoreSyncObject() {
|
||||
delete_sem(fSemId);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
SemaphoreSyncObject::lock() {
|
||||
if (acquire_sem(fSemId) < B_OK)
|
||||
throw CppUnit::Exception("SemaphoreSyncObject::lock() -- Error acquiring semaphore");
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
SemaphoreSyncObject::unlock() {
|
||||
if (release_sem(fSemId) < B_OK)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// TestHandler
|
||||
|
||||
// MessageReceived
|
||||
_EXPORT
|
||||
void
|
||||
BTestHandler::MessageReceived(BMessage *message)
|
||||
{
|
||||
@@ -18,6 +19,7 @@ BTestHandler::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
// Queue
|
||||
_EXPORT
|
||||
BMessageQueue &
|
||||
BTestHandler::Queue()
|
||||
{
|
||||
@@ -28,6 +30,7 @@ BTestHandler::Queue()
|
||||
// TestApp
|
||||
|
||||
// constructor
|
||||
_EXPORT
|
||||
BTestApp::BTestApp(const char *signature)
|
||||
: BApplication(signature),
|
||||
fAppThread(B_ERROR),
|
||||
@@ -38,6 +41,7 @@ BTestApp::BTestApp(const char *signature)
|
||||
}
|
||||
|
||||
// destructor
|
||||
_EXPORT
|
||||
BTestApp::~BTestApp()
|
||||
{
|
||||
int32 count = fHandlers.CountItems();
|
||||
@@ -46,6 +50,7 @@ BTestApp::~BTestApp()
|
||||
}
|
||||
|
||||
// Init
|
||||
_EXPORT
|
||||
status_t
|
||||
BTestApp::Init()
|
||||
{
|
||||
@@ -65,6 +70,7 @@ BTestApp::Init()
|
||||
}
|
||||
|
||||
// Terminate
|
||||
_EXPORT
|
||||
void
|
||||
BTestApp::Terminate()
|
||||
{
|
||||
@@ -74,12 +80,14 @@ BTestApp::Terminate()
|
||||
}
|
||||
|
||||
// ReadyToRun
|
||||
_EXPORT
|
||||
void
|
||||
BTestApp::ReadyToRun()
|
||||
{
|
||||
}
|
||||
|
||||
// CreateTestHandler
|
||||
_EXPORT
|
||||
BTestHandler *
|
||||
BTestApp::CreateTestHandler()
|
||||
{
|
||||
@@ -92,6 +100,7 @@ BTestApp::CreateTestHandler()
|
||||
}
|
||||
|
||||
// DeleteTestHandler
|
||||
_EXPORT
|
||||
bool
|
||||
BTestApp::DeleteTestHandler(BTestHandler *handler)
|
||||
{
|
||||
@@ -107,6 +116,7 @@ BTestApp::DeleteTestHandler(BTestHandler *handler)
|
||||
}
|
||||
|
||||
// Handler
|
||||
_EXPORT
|
||||
BTestHandler &
|
||||
BTestApp::Handler()
|
||||
{
|
||||
@@ -116,6 +126,7 @@ BTestApp::Handler()
|
||||
}
|
||||
|
||||
// TestHandlerAt
|
||||
_EXPORT
|
||||
BTestHandler *
|
||||
BTestApp::TestHandlerAt(int32 index)
|
||||
{
|
||||
@@ -124,6 +135,7 @@ BTestApp::TestHandlerAt(int32 index)
|
||||
}
|
||||
|
||||
// _AppThreadStart
|
||||
_EXPORT
|
||||
int32
|
||||
BTestApp::_AppThreadStart(void *data)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
_EXPORT
|
||||
BTestCase::BTestCase(string name)
|
||||
: CppUnit::TestCase(name)
|
||||
, fValidCWD(false)
|
||||
@@ -11,12 +12,14 @@ BTestCase::BTestCase(string name)
|
||||
{
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::tearDown() {
|
||||
if (fSubTestNum != 0)
|
||||
NextSubTestBlock();
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::NextSubTest() {
|
||||
if (BTestShell::GlobalBeVerbose()) {
|
||||
@@ -25,12 +28,14 @@ BTestCase::NextSubTest() {
|
||||
}
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::NextSubTestBlock() {
|
||||
if (BTestShell::GlobalBeVerbose())
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::Outputf(const char *str, ...) {
|
||||
if (BTestShell::GlobalBeVerbose()) {
|
||||
@@ -43,6 +48,7 @@ BTestCase::Outputf(const char *str, ...) {
|
||||
}
|
||||
|
||||
/*! To return to the last saved working directory, call RestoreCWD(). */
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::SaveCWD() {
|
||||
fValidCWD = getcwd(fCurrentWorkingDir, B_PATH_NAME_LENGTH);
|
||||
@@ -53,6 +59,7 @@ BTestCase::SaveCWD() {
|
||||
changed to alternate. If alternate is null, the current working directory
|
||||
is not modified.
|
||||
*/
|
||||
_EXPORT
|
||||
void
|
||||
BTestCase::RestoreCWD(const char *alternate) {
|
||||
if (fValidCWD)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
#include <OS.h>
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestListener::startTest( CppUnit::Test *test ) {
|
||||
fOkay = true;
|
||||
@@ -14,6 +15,7 @@ BTestListener::startTest( CppUnit::Test *test ) {
|
||||
startTime = real_time_clock_usecs();
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestListener::addFailure( const CppUnit::TestFailure &failure ) {
|
||||
fOkay = false;
|
||||
@@ -26,6 +28,7 @@ BTestListener::addFailure( const CppUnit::TestFailure &failure ) {
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestListener::endTest( CppUnit::Test *test ) {
|
||||
bigtime_t length = real_time_clock_usecs() - startTime;
|
||||
@@ -37,6 +40,7 @@ BTestListener::endTest( CppUnit::Test *test ) {
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestListener::printTime(bigtime_t time) {
|
||||
// Print out the elapsed time all pretty and stuff:
|
||||
|
||||
@@ -21,32 +21,42 @@
|
||||
|
||||
#include <TestShell.h>
|
||||
#include <TestListener.h>
|
||||
#include <ElfSymbolPatcher.h>
|
||||
|
||||
BTestShell *BTestShell::fGlobalShell = NULL;
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
# include <ElfSymbolPatcher.h>
|
||||
#endif
|
||||
|
||||
_EXPORT BTestShell *BTestShell::fGlobalShell = NULL;
|
||||
const char BTestShell::indent[] = " ";
|
||||
|
||||
_EXPORT
|
||||
BTestShell::BTestShell(const string &description, SyncObject *syncObject)
|
||||
: fVerbosityLevel(v2)
|
||||
, fTestResults(syncObject)
|
||||
, fDescription(description)
|
||||
, fListTestsAndExit(false)
|
||||
, fTestDir(NULL)
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
, fPatchGroupLocker(new(nothrow) BLocker)
|
||||
, fPatchGroup(NULL)
|
||||
, fOldDebuggerHook(NULL)
|
||||
, fOldLoadAddOnHook(NULL)
|
||||
, fOldUnloadAddOnHook(NULL)
|
||||
#endif // ! NO_ELF_SYMBOL_PATCHING
|
||||
{
|
||||
fTLSDebuggerCall = tls_allocate();
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
BTestShell::~BTestShell() {
|
||||
delete fTestDir;
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
delete fPatchGroupLocker;
|
||||
#endif // ! NO_ELF_SYMBOL_PATCHING
|
||||
}
|
||||
|
||||
|
||||
_EXPORT
|
||||
status_t
|
||||
BTestShell::AddSuite(BTestSuite *suite) {
|
||||
if (suite) {
|
||||
@@ -71,6 +81,7 @@ BTestShell::AddSuite(BTestSuite *suite) {
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::AddTest(const string &name, CppUnit::Test *test) {
|
||||
if (test != NULL)
|
||||
@@ -79,6 +90,7 @@ BTestShell::AddTest(const string &name, CppUnit::Test *test) {
|
||||
fTests.erase(name);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
int32
|
||||
BTestShell::LoadSuitesFrom(BDirectory *libDir) {
|
||||
if (!libDir || libDir->InitCheck() != B_OK)
|
||||
@@ -117,6 +129,7 @@ BTestShell::LoadSuitesFrom(BDirectory *libDir) {
|
||||
return count;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
int
|
||||
BTestShell::Run(int argc, char *argv[]) {
|
||||
// Make note of which directory we started in
|
||||
@@ -206,11 +219,13 @@ BTestShell::Run(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
BTestShell::VerbosityLevel
|
||||
BTestShell::Verbosity() const {
|
||||
return fVerbosityLevel;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
const char*
|
||||
BTestShell::TestDir() const {
|
||||
return (fTestDir ? fTestDir->Path() : NULL);
|
||||
@@ -222,6 +237,7 @@ BTestShell::TestDir() const {
|
||||
A subsequent call of debugger() will be intercepted and a respective
|
||||
flag will be set. WasDebuggerCalled() will then return \c true.
|
||||
*/
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::ExpectDebuggerCall()
|
||||
{
|
||||
@@ -238,6 +254,7 @@ BTestShell::ExpectDebuggerCall()
|
||||
\return \c true, if debugger() has been called by the current thread since
|
||||
the last invocation of ExpectDebuggerCall(), \c false otherwise.
|
||||
*/
|
||||
_EXPORT
|
||||
bool
|
||||
BTestShell::WasDebuggerCalled()
|
||||
{
|
||||
@@ -246,11 +263,13 @@ BTestShell::WasDebuggerCalled()
|
||||
return ((int)var > 1);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::PrintDescription(int argc, char *argv[]) {
|
||||
cout << endl << fDescription;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::PrintHelp() {
|
||||
cout << endl;
|
||||
@@ -260,6 +279,7 @@ BTestShell::PrintHelp() {
|
||||
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::PrintValidArguments() {
|
||||
cout << indent << "--help Displays this help text plus some other garbage" << endl;
|
||||
@@ -281,6 +301,7 @@ BTestShell::PrintValidArguments() {
|
||||
cout << indent << " libraries" << endl;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::PrintInstalledTests() {
|
||||
// Print out the list of installed suites
|
||||
@@ -302,6 +323,7 @@ BTestShell::PrintInstalledTests() {
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
bool
|
||||
BTestShell::ProcessArguments(int argc, char *argv[]) {
|
||||
// If we're given no parameters, the default settings
|
||||
@@ -321,6 +343,7 @@ BTestShell::ProcessArguments(int argc, char *argv[]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
bool
|
||||
BTestShell::ProcessArgument(string arg, int argc, char *argv[]) {
|
||||
if (arg == "--help") {
|
||||
@@ -347,6 +370,7 @@ BTestShell::ProcessArgument(string arg, int argc, char *argv[]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::InitOutput() {
|
||||
// For vebosity level 2, we output info about each test
|
||||
@@ -361,6 +385,7 @@ BTestShell::InitOutput() {
|
||||
fTestResults.addListener(&fResultsCollector);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::PrintResults() {
|
||||
|
||||
@@ -411,6 +436,7 @@ BTestShell::PrintResults() {
|
||||
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::LoadDynamicSuites() {
|
||||
if (Verbosity() >= v3) {
|
||||
@@ -447,6 +473,7 @@ BTestShell::LoadDynamicSuites() {
|
||||
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::UpdateTestDir(char *argv[]) {
|
||||
BPath path(argv[0]);
|
||||
@@ -465,9 +492,11 @@ BTestShell::UpdateTestDir(char *argv[]) {
|
||||
load_add_on() and unload_add_on() are patches as well, to keep the
|
||||
patch group up to date, when images are loaded/unloaded.
|
||||
*/
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::InstallPatches()
|
||||
{
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
if (fPatchGroup) {
|
||||
cerr << "BTestShell::InstallPatches(): Patch group already exist!"
|
||||
<< endl;
|
||||
@@ -503,14 +532,17 @@ BTestShell::InstallPatches()
|
||||
<< endl;
|
||||
UninstallPatches();
|
||||
}
|
||||
#endif // ! NO_ELF_SYMBOL_PATCHING
|
||||
}
|
||||
|
||||
// UninstallPatches
|
||||
/*! \brief Undoes the patches applied by InstallPatches().
|
||||
*/
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::UninstallPatches()
|
||||
{
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
BAutolock locker(fPatchGroupLocker);
|
||||
if (!locker.IsLocked()) {
|
||||
cerr << "BTestShell::UninstallPatches(): "
|
||||
@@ -522,9 +554,13 @@ BTestShell::UninstallPatches()
|
||||
delete fPatchGroup;
|
||||
fPatchGroup = NULL;
|
||||
}
|
||||
#endif // ! NO_ELF_SYMBOL_PATCHING
|
||||
}
|
||||
|
||||
#ifndef NO_ELF_SYMBOL_PATCHING
|
||||
|
||||
// _Debugger
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::_Debugger(const char *message)
|
||||
{
|
||||
@@ -546,6 +582,7 @@ cout << "debugger() called: " << message << endl;
|
||||
}
|
||||
|
||||
// _LoadAddOn
|
||||
_EXPORT
|
||||
image_id
|
||||
BTestShell::_LoadAddOn(const char *path)
|
||||
{
|
||||
@@ -560,6 +597,7 @@ BTestShell::_LoadAddOn(const char *path)
|
||||
}
|
||||
|
||||
// _UnloadAddOn
|
||||
_EXPORT
|
||||
status_t
|
||||
BTestShell::_UnloadAddOn(image_id image)
|
||||
{
|
||||
@@ -577,6 +615,7 @@ BTestShell::_UnloadAddOn(image_id image)
|
||||
}
|
||||
|
||||
// _DebuggerHook
|
||||
_EXPORT
|
||||
void
|
||||
BTestShell::_DebuggerHook(const char *message)
|
||||
{
|
||||
@@ -584,6 +623,7 @@ BTestShell::_DebuggerHook(const char *message)
|
||||
}
|
||||
|
||||
// _LoadAddOnHook
|
||||
_EXPORT
|
||||
image_id
|
||||
BTestShell::_LoadAddOnHook(const char *path)
|
||||
{
|
||||
@@ -591,9 +631,11 @@ BTestShell::_LoadAddOnHook(const char *path)
|
||||
}
|
||||
|
||||
// _UnloadAddOnHook
|
||||
_EXPORT
|
||||
status_t
|
||||
BTestShell::_UnloadAddOnHook(image_id image)
|
||||
{
|
||||
return fGlobalShell->_UnloadAddOn(image);
|
||||
}
|
||||
|
||||
#endif // ! NO_ELF_SYMBOL_PATCHING
|
||||
|
||||
@@ -3,18 +3,21 @@
|
||||
#include <cppunit/TestResult.h>
|
||||
|
||||
// Default constructor
|
||||
_EXPORT
|
||||
BTestSuite::BTestSuite( string name )
|
||||
: fName(name)
|
||||
{
|
||||
}
|
||||
|
||||
// Destructor
|
||||
_EXPORT
|
||||
BTestSuite::~BTestSuite() {
|
||||
deleteContents();
|
||||
}
|
||||
|
||||
|
||||
// Deletes all tests in the suite.
|
||||
_EXPORT
|
||||
void
|
||||
BTestSuite::deleteContents() {
|
||||
for ( map<string, CppUnit::Test*>::iterator it = fTests.begin();
|
||||
@@ -26,6 +29,7 @@ BTestSuite::deleteContents() {
|
||||
|
||||
|
||||
/// Runs the tests and collects their result in a TestResult.
|
||||
_EXPORT
|
||||
void
|
||||
BTestSuite::run( CppUnit::TestResult *result ) {
|
||||
for ( map<string, CppUnit::Test*>::iterator it = fTests.begin();
|
||||
@@ -42,6 +46,7 @@ BTestSuite::run( CppUnit::TestResult *result ) {
|
||||
|
||||
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
_EXPORT
|
||||
int
|
||||
BTestSuite::countTestCases() const {
|
||||
int count = 0;
|
||||
@@ -56,6 +61,7 @@ BTestSuite::countTestCases() const {
|
||||
|
||||
|
||||
// Adds a test to the suite.
|
||||
_EXPORT
|
||||
void
|
||||
BTestSuite::addTest(string name, CppUnit::Test *test) {
|
||||
fTests[name] = test;
|
||||
@@ -63,6 +69,7 @@ BTestSuite::addTest(string name, CppUnit::Test *test) {
|
||||
|
||||
|
||||
// Returns a string representation of the test suite.
|
||||
_EXPORT
|
||||
string
|
||||
BTestSuite::toString() const {
|
||||
return "suite " + getName();
|
||||
@@ -70,12 +77,14 @@ BTestSuite::toString() const {
|
||||
|
||||
|
||||
// Returns the name of the test suite.
|
||||
_EXPORT
|
||||
string
|
||||
BTestSuite::getName() const {
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
_EXPORT
|
||||
const map<string, CppUnit::Test*> &
|
||||
BTestSuite::getTests() const {
|
||||
return fTests;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
_EXPORT
|
||||
status_t DecodeResult(status_t result) {
|
||||
if (!BTestShell::GlobalBeVerbose())
|
||||
return result;
|
||||
@@ -178,17 +179,20 @@ status_t DecodeResult(status_t result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
string IntToStr(int i) {
|
||||
char num[32];
|
||||
sprintf(num, "%d", i);
|
||||
return string(num);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void ExecCommand(const char *command) {
|
||||
if (command)
|
||||
system(command);
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void ExecCommand(const char *command, const char *parameter) {
|
||||
if (command && parameter) {
|
||||
char *cmdLine = new char[strlen(command) + strlen(parameter) + 1];
|
||||
@@ -199,6 +203,7 @@ void ExecCommand(const char *command, const char *parameter) {
|
||||
}
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void ExecCommand(const char *command, const char *parameter1,
|
||||
const char *parameter2) {
|
||||
if (command && parameter1 && parameter2) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <TestShell.h>
|
||||
#include <ThreadedTestCase.h>
|
||||
#include <Autolock.h>
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
_EXPORT
|
||||
BThreadedTestCase::BThreadedTestCase(string name, string progressSeparator)
|
||||
: BTestCase(name)
|
||||
, fProgressSeparator(progressSeparator)
|
||||
@@ -10,6 +12,7 @@ BThreadedTestCase::BThreadedTestCase(string name, string progressSeparator)
|
||||
{
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
BThreadedTestCase::~BThreadedTestCase() {
|
||||
// Kill our locker
|
||||
delete fUpdateLock;
|
||||
@@ -23,6 +26,7 @@ BThreadedTestCase::~BThreadedTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BThreadedTestCase::NextSubTest() {
|
||||
// Find out what thread we're in
|
||||
@@ -47,6 +51,7 @@ BThreadedTestCase::NextSubTest() {
|
||||
BTestCase::NextSubTest();
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BThreadedTestCase::Outputf(const char *str, ...) {
|
||||
if (BTestShell::GlobalBeVerbose()) {
|
||||
@@ -78,6 +83,7 @@ BThreadedTestCase::Outputf(const char *str, ...) {
|
||||
}
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BThreadedTestCase::InitThreadInfo(thread_id id, string threadName) {
|
||||
BAutolock lock(fUpdateLock); // Lock the number map
|
||||
@@ -94,6 +100,7 @@ BThreadedTestCase::InitThreadInfo(thread_id id, string threadName) {
|
||||
}
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
bool
|
||||
BThreadedTestCase::RegisterForUse() {
|
||||
if (!fInUse) {
|
||||
@@ -103,17 +110,20 @@ BThreadedTestCase::RegisterForUse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BThreadedTestCase::UnregisterForUse() {
|
||||
fInUse = false;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
vector<string>&
|
||||
BThreadedTestCase::AcquireUpdateList() {
|
||||
fUpdateLock->Lock();
|
||||
return fUpdateList;
|
||||
}
|
||||
|
||||
_EXPORT
|
||||
void
|
||||
BThreadedTestCase::ReleaseUpdateList() {
|
||||
fUpdateLock->Unlock();
|
||||
|
||||
Reference in New Issue
Block a user