@@ -53,17 +53,13 @@ declare_args() {
53
53
template (" chip_test_suite" ) {
54
54
_suite_name = target_name
55
55
56
- if (! defined (invoker .test_sources )) {
57
- invoker .test_sources = []
58
- }
59
-
60
56
if (chip_build_test_static_libraries ) {
61
57
_target_type = " static_library"
62
58
} else {
63
59
_target_type = " source_set"
64
60
}
65
61
target (_target_type , " ${ _suite_name } .lib" ) {
66
- forward_variables_from (invoker , " *" , [ " tests" , " test_sources" , ])
62
+ forward_variables_from (invoker , " *" , [ " tests" , " test_sources" ])
67
63
68
64
output_dir = " ${ root_out_dir } /lib"
69
65
@@ -84,40 +80,42 @@ template("chip_test_suite") {
84
80
85
81
tests = []
86
82
87
- foreach (_test , invoker .test_sources ) {
88
- _test_name = string_replace (_test , " .cpp" , " " )
89
-
90
- _test_output_dir = " ${ root_out_dir } /tests"
91
- if (defined (invoker .output_dir )) {
92
- _test_output_dir = invoker .output_dir
93
- }
83
+ if (defined (invoker .test_sources )) {
84
+ foreach (_test , invoker .test_sources ) {
85
+ _test_name = string_replace (_test , " .cpp" , " " )
94
86
95
- pw_test (_test_name ) {
96
- # Forward certain variables from the invoker.
97
- forward_variables_from (invoker ,
98
- [
99
- " deps" ,
100
- " public_deps" ,
101
- " cflags" ,
102
- " configs" ,
103
- ])
104
-
105
- # Link to the common lib for this suite so we get its `sources`.
106
- public_deps += [ " :${ _suite_name } .lib" ]
107
-
108
- # Set variables that the platform executable may need.
109
- if (test_executable_output_name != " " ) {
110
- output_name = test_executable_output_name + _test_name +
111
- test_executable_output_name_suffix
87
+ _test_output_dir = " ${ root_out_dir } /tests"
88
+ if (defined (invoker .output_dir )) {
89
+ _test_output_dir = invoker .output_dir
112
90
}
113
- ldflags = test_executable_ldflags
114
91
115
- # Add the individual test source file (e.g. "TestSomething.cpp").
116
- sources = [ _test ]
117
-
118
- output_dir = _test_output_dir
92
+ pw_test (_test_name ) {
93
+ # Forward certain variables from the invoker.
94
+ forward_variables_from (invoker ,
95
+ [
96
+ " deps" ,
97
+ " public_deps" ,
98
+ " cflags" ,
99
+ " configs" ,
100
+ ])
101
+
102
+ # Link to the common lib for this suite so we get its `sources`.
103
+ public_deps += [ " :${ _suite_name } .lib" ]
104
+
105
+ # Set variables that the platform executable may need.
106
+ if (test_executable_output_name != " " ) {
107
+ output_name = test_executable_output_name + _test_name +
108
+ test_executable_output_name_suffix
109
+ }
110
+ ldflags = test_executable_ldflags
111
+
112
+ # Add the individual test source file (e.g. "TestSomething.cpp").
113
+ sources = [ _test ]
114
+
115
+ output_dir = _test_output_dir
116
+ }
117
+ tests += [ _test_name ]
119
118
}
120
- tests += [ _test_name ]
121
119
}
122
120
123
121
group (_suite_name ) {
@@ -127,6 +125,9 @@ template("chip_test_suite") {
127
125
foreach (_test , tests ) {
128
126
deps += [ " :${ _test } " ]
129
127
}
128
+
129
+ # Add the common library.
130
+ deps += [ " :${ _suite_name } .lib" ]
130
131
}
131
132
132
133
if (chip_pw_run_tests ) {
0 commit comments