haiku/build/jam/TestsRules
Ingo Weinhold 155b583ac3 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
2005-11-09 16:17:31 +00:00

112 lines
2.6 KiB
Plaintext

# unit test pseudo target
NotFile unittests ;
rule UnitTestLib
{
# UnitTestLib <lib> : <sources> : <libraries> ;
#
local lib = $(1) ;
local sources = $(2) ;
local libraries = $(3) ;
# unless NO_TEST_DEBUG is defined, we turn on debugging
if ! $(NO_TEST_DEBUG) {
DEBUG on $(lib) [ FGristFiles $(sources:S=$(SUFOBJ)) ] ?= 1 ;
}
# define TEST_R5/TEST_HAIKU depending on the platform we build for
if $(TARGET_PLATFORM) = libbe_test {
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
# make the target depend on the installed libbe libraries
Depends $(lib) :
<tests!unittests>libbe_haiku.so <tests!unittests>libbeadapter.so ;
} else {
ObjectDefines $(2) : TEST_R5 ;
}
UseCppUnitObjectHeaders $(sources) ;
MakeLocate $(lib) : $(TARGET_UNIT_TEST_LIB_DIR) ;
SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
Depends unittests : $(lib) ;
}
rule UnitTest
{
# UnitTest <target> : <sources> : <libraries> : <resources> ;
#
local target = $(1) ;
local sources = $(2) ;
local libraries = $(3) ;
local resources = $(4) ;
# define TEST_R5/TEST_HAIKU depending on the platform we build for
if $(TARGET_PLATFORM) = libbe_test {
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
# make the target depend on the installed libbe libraries
Depends $(target) :
<tests!unittests>libbe_haiku.so <tests!unittests>libbeadapter.so ;
} else {
ObjectDefines $(2) : TEST_R5 ;
}
UseCppUnitObjectHeaders $(sources) ;
MakeLocate $(target) : $(TARGET_UNIT_TEST_DIR) ;
SimpleTest $(target) : $(sources) : $(libraries) libcppunit.so
: $(resources) ;
Depends unittests : $(lib) ;
}
rule TestObjects
{
# TestObjects <sources> ;
#
local sources = $(1) ;
# define TEST_R5/TEST_HAIKU depending on the platform we build for
if $(TARGET_PLATFORM) = libbe_test {
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
} else {
ObjectDefines $(2) : TEST_R5 ;
}
UseCppUnitObjectHeaders $(sources) ;
Objects $(sources) ;
}
rule SimpleTest
{
# SimpleTest <target> : <sources> : [ <libraries> ] : [ <resources> ] ;
# unless NO_TEST_DEBUG is defined, we turn on debugging
if ! $(NO_TEST_DEBUG) {
DEBUG on $(1) [ FGristFiles $(2:S=$(SUFOBJ)) ] ?= 1 ;
}
Executable $(1) : $(2) : $(3) : $(4) ;
}
rule BuildPlatformTest
{
# Usage BuildPlatformTest <target> : <sources> ;
local target = $(1) ;
local sources = $(2) ;
local relPath ;
if [ FIsPrefix src tests : $(SUBDIR_TOKENS) ] {
relPath = $(SUBDIR_TOKENS[3-]) ;
} else {
relPath = $(SUBDIR_TOKENS[2-]) ;
}
MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
BuildPlatformMain $(target) : $(sources) ;
}