Skip to content

Commit 947fef5

Browse files
authored
Removing NL Unit Infrastructure (#33943)
* removing nl_unit infra from ESP32 * removing nl_unit infra from Nordic * removing nl_unit infra from OpenIoTSDK * removing nl_unit infra from mbed * removing nl_unit infra from EFR32 * removing include dependencies of nl_unit_test * making Mbed Unit Tests return an Error to clarify that they are disabled * adding issue number to code comment
1 parent 4cdce52 commit 947fef5

35 files changed

+17
-786
lines changed

.github/workflows/examples-mbed.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ jobs:
158158
rm -rf ./out
159159
160160
- name: Build unit tests
161-
# Temporarily disable build due to running out of flash space
161+
# Temporarily disabled build due to running out of flash space
162+
# TODO Issue #33978: re-enable unit testing after split of unit tests is done
162163
if: false
163164
run: scripts/tests/mbed/mbed_unit_tests.sh -b=$APP_TARGET -p=$APP_PROFILE
164165

BUILD.gn

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import("//build_overrides/build.gni")
1616
import("//build_overrides/chip.gni")
1717
import("//build_overrides/mbedtls.gni")
1818
import("//build_overrides/nlassert.gni")
19-
import("//build_overrides/nlunit_test.gni")
2019
import("//build_overrides/pigweed.gni")
2120

2221
import("//src/lwip/lwip.gni")
@@ -135,7 +134,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
135134
"${chip_root}/src/system",
136135
"${chip_root}/src/transport",
137136
"${nlassert_root}:nlassert",
138-
"${nlunit_test_root}:nlunit-test",
139137
]
140138

141139
if (enable_fuzz_test_targets) {

build/chip/chip_test_suite.gni

+2-99
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ assert(chip_build_tests)
3333
# ]
3434
#
3535
# test_sources = [
36-
# "TestFoo.cpp", # Files are parsed for `CHIP_REGISTER_TEST_SUITE(...)`
37-
# "TestBar.cpp", # and a driver is created automatically
36+
# "TestFoo.cpp",
37+
# "TestBar.cpp",
3838
# ]
3939
#
4040
# public_deps = [
@@ -175,100 +175,3 @@ template("chip_test_suite") {
175175
}
176176
}
177177
}
178-
179-
# TODO [PW_MIGRATION]: remove this once transition away from nlunit-test is completed
180-
template("chip_test_suite_using_nltest") {
181-
_suite_name = target_name
182-
183-
# Ensures that the common library has sources containing both common
184-
# and individual unit tests.
185-
if (!defined(invoker.sources)) {
186-
invoker.sources = []
187-
}
188-
189-
if (defined(invoker.test_sources)) {
190-
invoker.sources += invoker.test_sources
191-
}
192-
193-
if (chip_build_test_static_libraries) {
194-
_target_type = "static_library"
195-
} else {
196-
_target_type = "source_set"
197-
}
198-
target(_target_type, "${_suite_name}.lib") {
199-
forward_variables_from(invoker, "*", [ "tests" ])
200-
201-
output_dir = "${root_out_dir}/lib"
202-
203-
if (!defined(invoker.public_deps)) {
204-
public_deps = []
205-
}
206-
207-
if (current_os != "zephyr" && current_os != "mbed") {
208-
# Depend on stdio logging, and have it take precedence over the default platform backend
209-
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
210-
}
211-
}
212-
if (chip_link_tests) {
213-
tests = []
214-
215-
if (defined(invoker.test_sources)) {
216-
foreach(_test, invoker.test_sources) {
217-
_test_name = string_replace(_test, ".cpp", "")
218-
219-
_driver_name = "${root_gen_dir}/${_test_name}.driver.cpp"
220-
221-
action("${_test_name}_generate_driver") {
222-
script = "${chip_root}/scripts/gen_test_driver.py"
223-
224-
inputs = [ _test ]
225-
outputs = [ _driver_name ]
226-
args = [
227-
"--input_file=" + rebase_path(_test, root_build_dir),
228-
"--output_file=" + rebase_path(_driver_name, root_build_dir),
229-
]
230-
}
231-
232-
chip_test(_test_name) {
233-
sources = [ _driver_name ]
234-
public_deps = [
235-
":${_suite_name}.lib",
236-
":${_test_name}_generate_driver",
237-
]
238-
}
239-
tests += [ _test_name ]
240-
}
241-
}
242-
243-
if (defined(invoker.tests)) {
244-
foreach(_test, invoker.tests) {
245-
chip_test(_test) {
246-
sources = [ "${_test}Driver.cpp" ]
247-
248-
public_deps = [ ":${_suite_name}.lib" ]
249-
}
250-
tests += [ _test ]
251-
}
252-
}
253-
254-
group(_suite_name) {
255-
deps = []
256-
foreach(_test, tests) {
257-
deps += [ ":${_test}" ]
258-
}
259-
}
260-
261-
if (chip_pw_run_tests) {
262-
group("${_suite_name}_run") {
263-
deps = []
264-
foreach(_test, tests) {
265-
deps += [ ":${_test}.run" ]
266-
}
267-
}
268-
}
269-
} else {
270-
group(_suite_name) {
271-
deps = [ ":${_suite_name}.lib" ]
272-
}
273-
}
274-
}

build/chip/fuzz_test.gni

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ declare_args() {
3636
#
3737
# public_deps = [
3838
# "${chip_root}/src/lib/foo", # add dependencies here
39-
# "${nlunit_test_root}:nlunit-test",
4039
# ]
4140
# }
4241
#

build_overrides/nlunit_test.gni

-18
This file was deleted.

examples/build_overrides/nlunit_test.gni

-18
This file was deleted.

scripts/gen_test_driver.py

-107
This file was deleted.

src/app/icd/server/tests/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import("//build_overrides/build.gni")
1616
import("//build_overrides/chip.gni")
17-
import("//build_overrides/nlunit_test.gni")
1817
import("//build_overrides/pigweed.gni")
1918
import("${chip_root}/build/chip/chip_test_suite.gni")
2019
import("${chip_root}/src/app/icd/icd.gni")

src/app/tests/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

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

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

src/app/tests/TestBindingTable.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <app/util/config.h>
2323
#include <lib/support/DefaultStorageKeyAllocator.h>
2424
#include <lib/support/TestPersistentStorageDelegate.h>
25-
#include <lib/support/UnitTestRegistration.h>
2625

2726
using chip::BindingTable;
2827

src/app/tests/TestInteractionModelEngine.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <lib/core/TLV.h>
3030
#include <lib/core/TLVDebug.h>
3131
#include <lib/core/TLVUtilities.h>
32-
#include <lib/support/UnitTestExtendedAssertions.h>
3332
#include <lib/support/tests/ExtraPwTestMacros.h>
3433
#include <messaging/ExchangeContext.h>
3534
#include <messaging/Flags.h>

src/app/tests/TestPendingResponseTrackerImpl.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
#include <algorithm>
19-
#include <nlunit-test.h>
2019
#include <vector>
2120

2221
#include <app/PendingResponseTrackerImpl.h>

src/app/util/mock/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ source_set("mock_ember") {
3333
"${chip_root}/src/app/common:attribute-type",
3434
"${chip_root}/src/lib/core",
3535
"${chip_root}/src/lib/support",
36-
"${chip_root}/src/lib/support:testing_nlunit",
3736
]
3837

3938
public_configs = [ ":mock_include" ]

src/app/util/mock/attribute-storage.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include <lib/core/TLVDebug.h>
4848
#include <lib/support/CodeUtils.h>
4949
#include <lib/support/DLLUtil.h>
50-
#include <lib/support/UnitTestRegistration.h>
5150
#include <lib/support/logging/CHIPLogging.h>
5251

5352
#include <app/util/af-types.h>

src/inet/tests/BUILD.gn

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

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

2019
import("${chip_root}/build/chip/chip_test_suite.gni")
@@ -58,7 +57,6 @@ static_library("helpers") {
5857
"${chip_root}/src/inet",
5958
"${chip_root}/src/lib/core",
6059
"${chip_root}/src/platform",
61-
"${nlunit_test_root}:nlunit-test",
6260
]
6361
}
6462

src/lib/dnssd/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import("//build_overrides/chip.gni")
16-
import("//build_overrides/nlunit_test.gni")
1716
import("${chip_root}/src/platform/device.gni")
1817

1918
source_set("constants") {

0 commit comments

Comments
 (0)