-
-
Notifications
You must be signed in to change notification settings - Fork 335
/
TestsRules
120 lines (91 loc) · 2.57 KB
/
TestsRules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# unit test pseudo target
NotFile unittests ;
rule UnitTestDependency
{
Depends unittests : $(1) ;
}
rule UnitTestLib
{
# UnitTestLib <lib> : <sources> : <libraries> ;
#
local lib = $(1) ;
local sources = $(2) ;
local libraries = $(3) ;
# if TEST_DEBUG is defined, we turn on debugging
if $(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_test.so ;
} else {
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
}
UseCppUnitObjectHeaders $(sources) ;
MakeLocate $(lib) : $(TARGET_UNIT_TEST_LIB_DIR) ;
SharedLibrary $(lib) : $(sources) : $(libraries) libcppunit.so ;
UnitTestDependency $(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_test.so ;
} else {
ObjectDefines $(2) : TEST_HAIKU TEST_OBOS ;
}
UseCppUnitObjectHeaders $(sources) ;
MakeLocate $(target) : $(TARGET_UNIT_TEST_DIR) ;
SimpleTest $(target) : $(sources) : $(libraries) libcppunit.so
: $(resources) ;
UnitTestDependency $(target) ;
}
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_HAIKU TEST_OBOS ;
}
UseCppUnitObjectHeaders $(sources) ;
Objects $(sources) ;
}
rule SimpleTest
{
# SimpleTest <target> : <sources> : [ <libraries> ] : [ <resources> ] ;
# if TEST_DEBUG is defined, we turn on debugging
if $(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) ;
}