Skip to content

Commit e1d93fa

Browse files
mbknustjlatusek
andauthored
Replaced nlunit-test with pw_unit_test in src/access/tests/ (#29682)
* Rewritten src/access/tests/ to use pw_unit_test * Fix building issue * Revert unnecessary changes * Replace EXPECT_TRUE to EXPECT_EQ --------- Co-authored-by: Jakub Latusek <j.latusek@samsung.com>
1 parent 6a7961d commit e1d93fa

File tree

5 files changed

+522
-576
lines changed

5 files changed

+522
-576
lines changed

build/chip/chip_test_suite.gni

+15-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ assert(chip_build_tests)
3939
#
4040
# public_deps = [
4141
# "${chip_root}/src/lib/foo", # add dependencies here
42-
# "${nlunit_test_root}:nlunit-test",
4342
# ]
4443
# }
4544
#
@@ -57,7 +56,6 @@ assert(chip_build_tests)
5756
#
5857
# public_deps = [
5958
# "${chip_root}/src/lib/foo", # add dependencies here
60-
# "${nlunit_test_root}:nlunit-test",
6159
# ]
6260
#
6361
# tests = [
@@ -94,6 +92,8 @@ template("chip_test_suite") {
9492
public_deps = []
9593
}
9694

95+
deps = [ dir_pw_unit_test ]
96+
9797
if (current_os != "zephyr" && current_os != "mbed") {
9898
# Depend on stdio logging, and have it take precedence over the default platform backend
9999
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
@@ -106,6 +106,11 @@ template("chip_test_suite") {
106106
foreach(_test, invoker.test_sources) {
107107
_test_name = string_replace(_test, ".cpp", "")
108108

109+
_test_output_dir = "${root_out_dir}/tests"
110+
if (defined(invoker.output_dir)) {
111+
_test_output_dir = invoker.output_dir
112+
}
113+
109114
pw_test(_test_name) {
110115
forward_variables_from(invoker,
111116
[
@@ -116,13 +121,19 @@ template("chip_test_suite") {
116121
])
117122
public_deps += [ ":${_suite_name}.lib" ]
118123
sources = [ _test ]
124+
output_dir = _test_output_dir
119125
}
120126
tests += [ _test_name ]
121127
}
122128
}
123129

124130
if (defined(invoker.tests)) {
125131
foreach(_test, invoker.tests) {
132+
_test_output_dir = "${root_out_dir}/tests"
133+
if (defined(invoker.output_dir)) {
134+
_test_output_dir = invoker.output_dir
135+
}
136+
126137
pw_test(_test) {
127138
forward_variables_from(invoker,
128139
[
@@ -137,6 +148,7 @@ template("chip_test_suite") {
137148
"${_test}.cpp",
138149
"${_test}Driver.cpp",
139150
]
151+
output_dir = _test_output_dir
140152
}
141153
tests += [ _test ]
142154
}
@@ -164,7 +176,7 @@ template("chip_test_suite") {
164176
}
165177
}
166178

167-
# TODO: remove this once transition away from nlunit-test is completed
179+
# TODO [PW_MIGRATION]: remove this once transition away from nlunit-test is completed
168180
template("chip_test_suite_using_nltest") {
169181
_suite_name = target_name
170182

src/access/tests/BUILD.gn

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@
1414

1515
import("//build_overrides/build.gni")
1616
import("//build_overrides/chip.gni")
17-
import("//build_overrides/nlunit_test.gni")
17+
import("//build_overrides/pigweed.gni")
1818

1919
import("${chip_root}/build/chip/chip_test_suite.gni")
2020

21-
chip_test_suite_using_nltest("tests") {
21+
chip_test_suite("tests") {
2222
output_name = "libaccesstest"
23-
2423
test_sources = [ "TestAccessControl.cpp" ]
2524

2625
cflags = [ "-Wconversion" ]
27-
2826
public_deps = [
2927
"${chip_root}/src/access",
3028
"${chip_root}/src/lib/support:test_utils",
31-
"${chip_root}/src/lib/support:testing_nlunit",
32-
"${nlunit_test_root}:nlunit-test",
29+
"${dir_pw_unit_test}",
3330
]
3431
}

0 commit comments

Comments
 (0)