2005-11-09 19:17:31 +03:00
|
|
|
# unit test pseudo target
|
|
|
|
NotFile unittests ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2015-11-01 12:26:22 +03:00
|
|
|
rule UnitTestDependency
|
|
|
|
{
|
|
|
|
Depends unittests : $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
rule UnitTestLib
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2005-11-09 19:17:31 +03:00
|
|
|
# UnitTestLib <lib> : <sources> : <libraries> ;
|
|
|
|
#
|
|
|
|
local lib = $(1) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local sources = $(2) ;
|
2005-11-09 19:17:31 +03:00
|
|
|
local libraries = $(3) ;
|
2009-08-19 18:17:13 +04:00
|
|
|
|
2007-02-04 00:55:45 +03:00
|
|
|
# if TEST_DEBUG is defined, we turn on debugging
|
|
|
|
if $(TEST_DEBUG) {
|
2005-11-09 19:17:31 +03:00
|
|
|
DEBUG on $(lib) [ FGristFiles $(sources:S=$(SUFOBJ)) ] ?= 1 ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
# define TEST_R5/TEST_HAIKU depending on the platform we build for
|
|
|
|
if $(TARGET_PLATFORM) = libbe_test {
|
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
# make the target depend on the installed libbe libraries
|
|
|
|
Depends $(lib) :
|
2014-10-01 12:57:59 +04:00
|
|
|
<tests!unittests>libbe_test.so ;
|
2005-11-09 19:17:31 +03:00
|
|
|
} else {
|
2011-01-08 20:26:26 +03:00
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-11-09 19:17:31 +03:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
UseCppUnitObjectHeaders $(sources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
MakeLocate $(lib) : $(TARGET_UNIT_TEST_LIB_DIR) ;
|
|
|
|
SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2015-11-01 12:26:22 +03:00
|
|
|
UnitTestDependency $(lib) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2014-10-01 12:57:59 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule UnitTest
|
|
|
|
{
|
2005-11-09 19:17:31 +03:00
|
|
|
# UnitTest <target> : <sources> : <libraries> : <resources> ;
|
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
local target = $(1) ;
|
|
|
|
local sources = $(2) ;
|
2005-11-09 19:17:31 +03:00
|
|
|
local libraries = $(3) ;
|
|
|
|
local resources = $(4) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
# define TEST_R5/TEST_HAIKU depending on the platform we build for
|
|
|
|
if $(TARGET_PLATFORM) = libbe_test {
|
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
# make the target depend on the installed libbe libraries
|
|
|
|
Depends $(target) :
|
2014-10-01 12:57:59 +04:00
|
|
|
<tests!unittests>libbe_test.so ;
|
2005-11-09 19:17:31 +03:00
|
|
|
} else {
|
2011-01-08 20:26:26 +03:00
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-11-09 19:17:31 +03:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
UseCppUnitObjectHeaders $(sources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
MakeLocate $(target) : $(TARGET_UNIT_TEST_DIR) ;
|
|
|
|
SimpleTest $(target) : $(sources) : $(libraries) libcppunit.so
|
|
|
|
: $(resources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2015-11-01 12:26:22 +03:00
|
|
|
UnitTestDependency $(target) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2014-10-01 12:57:59 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule TestObjects
|
|
|
|
{
|
2005-11-09 19:17:31 +03:00
|
|
|
# TestObjects <sources> ;
|
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
local sources = $(1) ;
|
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
# define TEST_R5/TEST_HAIKU depending on the platform we build for
|
|
|
|
if $(TARGET_PLATFORM) = libbe_test {
|
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-10-29 20:27:43 +04:00
|
|
|
} else {
|
2011-01-08 20:26:26 +03:00
|
|
|
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
UseCppUnitObjectHeaders $(sources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2005-11-09 19:17:31 +03:00
|
|
|
Objects $(sources) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2014-10-01 12:57:59 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule SimpleTest
|
|
|
|
{
|
2005-11-03 02:31:20 +03:00
|
|
|
# SimpleTest <target> : <sources> : [ <libraries> ] : [ <resources> ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-02-04 00:55:45 +03:00
|
|
|
# if TEST_DEBUG is defined, we turn on debugging
|
|
|
|
if $(TEST_DEBUG) {
|
2005-11-03 02:31:20 +03:00
|
|
|
DEBUG on $(1) [ FGristFiles $(2:S=$(SUFOBJ)) ] ?= 1 ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2005-11-03 02:31:20 +03:00
|
|
|
Executable $(1) : $(2) : $(3) : $(4) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2014-10-01 12:57:59 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
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) ] ;
|
2009-08-19 18:17:13 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
BuildPlatformMain $(target) : $(sources) ;
|
|
|
|
}
|