Fixed unit tests build for platforms libbe_test and r5. Only randomly tested

a few whether they actually work.
New pseudo target "unittests", which builds all unit tests for the currently
set TARGET_PLATFORM. They are placed in generated/tests/<platform>/unittests.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14791 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-11-09 16:17:31 +00:00
parent 5e3af71d64
commit 155b583ac3
46 changed files with 253 additions and 465 deletions
+70
View File
@@ -0,0 +1,70 @@
#include <TestCase.h>
#include <TestShell.h>
#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
_EXPORT
BTestCase::BTestCase(string name)
: CppUnit::TestCase(name)
, fValidCWD(false)
, fSubTestNum(0)
{
}
_EXPORT
void
BTestCase::tearDown() {
if (fSubTestNum != 0)
NextSubTestBlock();
}
_EXPORT
void
BTestCase::NextSubTest() {
if (BTestShell::GlobalBeVerbose()) {
printf("[%ld]", fSubTestNum++);
fflush(stdout);
}
}
_EXPORT
void
BTestCase::NextSubTestBlock() {
if (BTestShell::GlobalBeVerbose())
printf("\n");
}
_EXPORT
void
BTestCase::Outputf(const char *str, ...) {
if (BTestShell::GlobalBeVerbose()) {
va_list args;
va_start(args, str);
vprintf(str, args);
va_end(args);
fflush(stdout);
}
}
/*! To return to the last saved working directory, call RestoreCWD(). */
_EXPORT
void
BTestCase::SaveCWD() {
fValidCWD = getcwd(fCurrentWorkingDir, B_PATH_NAME_LENGTH);
}
/* If SaveCWD() has not been called and an alternate
directory is specified by alternate, the current working directory is
changed to alternate. If alternate is null, the current working directory
is not modified.
*/
_EXPORT
void
BTestCase::RestoreCWD(const char *alternate) {
if (fValidCWD)
chdir(fCurrentWorkingDir);
else if (alternate != NULL)
chdir(alternate);
}