1 # unit test pseudo target
4 rule UnitTestDependency
6 Depends unittests : $(1) ;
12 # UnitTestLib <lib> : <sources> : <libraries> ;
15 local sources = $(2) ;
16 local libraries = $(3) ;
18 # if TEST_DEBUG is defined, we turn on debugging
20 DEBUG on $(lib) [ FGristFiles $(sources:S=$(SUFOBJ)) ] ?= 1 ;
23 # define TEST_R5/TEST_HAIKU depending on the platform we build for
24 if $(TARGET_PLATFORM) = libbe_test {
25 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
27 # make the target depend on the installed libbe libraries
29 <tests!unittests>libbe_test.so ;
31 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
34 UseCppUnitObjectHeaders $(sources) ;
36 MakeLocate $(lib) : $(TARGET_UNIT_TEST_LIB_DIR) ;
37 SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
39 UnitTestDependency $(lib) ;
45 # UnitTest <target> : <sources> : <libraries> : <resources> ;
48 local sources = $(2) ;
49 local libraries = $(3) ;
50 local resources = $(4) ;
52 # define TEST_R5/TEST_HAIKU depending on the platform we build for
53 if $(TARGET_PLATFORM) = libbe_test {
54 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
56 # make the target depend on the installed libbe libraries
58 <tests!unittests>libbe_test.so ;
60 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
63 UseCppUnitObjectHeaders $(sources) ;
65 MakeLocate $(target) : $(TARGET_UNIT_TEST_DIR) ;
66 SimpleTest $(target) : $(sources) : $(libraries) libcppunit.so
69 UnitTestDependency $(target) ;
75 # TestObjects <sources> ;
77 local sources = $(1) ;
79 # define TEST_R5/TEST_HAIKU depending on the platform we build for
80 if $(TARGET_PLATFORM) = libbe_test {
81 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
83 ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
86 UseCppUnitObjectHeaders $(sources) ;
94 # SimpleTest <target> : <sources> : [ <libraries> ] : [ <resources> ] ;
96 # if TEST_DEBUG is defined, we turn on debugging
98 DEBUG on $(1) [ FGristFiles $(2:S=$(SUFOBJ)) ] ?= 1 ;
101 Executable $(1) : $(2) : $(3) : $(4) ;
105 rule BuildPlatformTest
107 # Usage BuildPlatformTest <target> : <sources> ;
108 local target = $(1) ;
109 local sources = $(2) ;
112 if [ FIsPrefix src tests : $(SUBDIR_TOKENS) ] {
113 relPath = $(SUBDIR_TOKENS[3-]) ;
115 relPath = $(SUBDIR_TOKENS[2-]) ;
117 MakeLocate $(target) : [ FDirName $(HAIKU_TEST_DIR) $(relPath) ] ;
119 BuildPlatformMain $(target) : $(sources) ;