Skip to content

Commit

Permalink
Removing NL Unit Infrastructure (project-chip#33943)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Alami-Amine authored Jun 18, 2024
1 parent 4cdce52 commit 947fef5
Show file tree
Hide file tree
Showing 35 changed files with 17 additions and 786 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/examples-mbed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ jobs:
rm -rf ./out
- name: Build unit tests
# Temporarily disable build due to running out of flash space
# Temporarily disabled build due to running out of flash space
# TODO Issue #33978: re-enable unit testing after split of unit tests is done
if: false
run: scripts/tests/mbed/mbed_unit_tests.sh -b=$APP_TARGET -p=$APP_PROFILE

Expand Down
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/mbedtls.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

import("//src/lwip/lwip.gni")
Expand Down Expand Up @@ -135,7 +134,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"${chip_root}/src/system",
"${chip_root}/src/transport",
"${nlassert_root}:nlassert",
"${nlunit_test_root}:nlunit-test",
]

if (enable_fuzz_test_targets) {
Expand Down
101 changes: 2 additions & 99 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ assert(chip_build_tests)
# ]
#
# test_sources = [
# "TestFoo.cpp", # Files are parsed for `CHIP_REGISTER_TEST_SUITE(...)`
# "TestBar.cpp", # and a driver is created automatically
# "TestFoo.cpp",
# "TestBar.cpp",
# ]
#
# public_deps = [
Expand Down Expand Up @@ -175,100 +175,3 @@ template("chip_test_suite") {
}
}
}

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

# Ensures that the common library has sources containing both common
# and individual unit tests.
if (!defined(invoker.sources)) {
invoker.sources = []
}

if (defined(invoker.test_sources)) {
invoker.sources += invoker.test_sources
}

if (chip_build_test_static_libraries) {
_target_type = "static_library"
} else {
_target_type = "source_set"
}
target(_target_type, "${_suite_name}.lib") {
forward_variables_from(invoker, "*", [ "tests" ])

output_dir = "${root_out_dir}/lib"

if (!defined(invoker.public_deps)) {
public_deps = []
}

if (current_os != "zephyr" && current_os != "mbed") {
# Depend on stdio logging, and have it take precedence over the default platform backend
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
}
}
if (chip_link_tests) {
tests = []

if (defined(invoker.test_sources)) {
foreach(_test, invoker.test_sources) {
_test_name = string_replace(_test, ".cpp", "")

_driver_name = "${root_gen_dir}/${_test_name}.driver.cpp"

action("${_test_name}_generate_driver") {
script = "${chip_root}/scripts/gen_test_driver.py"

inputs = [ _test ]
outputs = [ _driver_name ]
args = [
"--input_file=" + rebase_path(_test, root_build_dir),
"--output_file=" + rebase_path(_driver_name, root_build_dir),
]
}

chip_test(_test_name) {
sources = [ _driver_name ]
public_deps = [
":${_suite_name}.lib",
":${_test_name}_generate_driver",
]
}
tests += [ _test_name ]
}
}

if (defined(invoker.tests)) {
foreach(_test, invoker.tests) {
chip_test(_test) {
sources = [ "${_test}Driver.cpp" ]

public_deps = [ ":${_suite_name}.lib" ]
}
tests += [ _test ]
}
}

group(_suite_name) {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}" ]
}
}

if (chip_pw_run_tests) {
group("${_suite_name}_run") {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}.run" ]
}
}
}
} else {
group(_suite_name) {
deps = [ ":${_suite_name}.lib" ]
}
}
}
1 change: 0 additions & 1 deletion build/chip/fuzz_test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ declare_args() {
#
# public_deps = [
# "${chip_root}/src/lib/foo", # add dependencies here
# "${nlunit_test_root}:nlunit-test",
# ]
# }
#
Expand Down
18 changes: 0 additions & 18 deletions build_overrides/nlunit_test.gni

This file was deleted.

18 changes: 0 additions & 18 deletions examples/build_overrides/nlunit_test.gni

This file was deleted.

107 changes: 0 additions & 107 deletions scripts/gen_test_driver.py

This file was deleted.

1 change: 0 additions & 1 deletion src/app/icd/server/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/build/chip/chip_test_suite.gni")
import("${chip_root}/src/app/icd/icd.gni")
Expand Down
1 change: 0 additions & 1 deletion src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")
Expand Down
1 change: 0 additions & 1 deletion src/app/tests/TestBindingTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/util/config.h>
#include <lib/support/DefaultStorageKeyAllocator.h>
#include <lib/support/TestPersistentStorageDelegate.h>
#include <lib/support/UnitTestRegistration.h>

using chip::BindingTable;

Expand Down
1 change: 0 additions & 1 deletion src/app/tests/TestInteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <lib/core/TLV.h>
#include <lib/core/TLVDebug.h>
#include <lib/core/TLVUtilities.h>
#include <lib/support/UnitTestExtendedAssertions.h>
#include <lib/support/tests/ExtraPwTestMacros.h>
#include <messaging/ExchangeContext.h>
#include <messaging/Flags.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/tests/TestPendingResponseTrackerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

#include <algorithm>
#include <nlunit-test.h>
#include <vector>

#include <app/PendingResponseTrackerImpl.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/util/mock/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ source_set("mock_ember") {
"${chip_root}/src/app/common:attribute-type",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:testing_nlunit",
]

public_configs = [ ":mock_include" ]
Expand Down
1 change: 0 additions & 1 deletion src/app/util/mock/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <lib/core/TLVDebug.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/DLLUtil.h>
#include <lib/support/UnitTestRegistration.h>
#include <lib/support/logging/CHIPLogging.h>

#include <app/util/af-types.h>
Expand Down
2 changes: 0 additions & 2 deletions src/inet/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")
Expand Down Expand Up @@ -58,7 +57,6 @@ static_library("helpers") {
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
"${chip_root}/src/platform",
"${nlunit_test_root}:nlunit-test",
]
}

Expand Down
1 change: 0 additions & 1 deletion src/lib/dnssd/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")
import("${chip_root}/src/platform/device.gni")

source_set("constants") {
Expand Down
Loading

0 comments on commit 947fef5

Please sign in to comment.