From a77e01cbd6f0066a5605e81ebd8d38f2b9d953c9 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 1 Feb 2024 13:52:29 -0500 Subject: [PATCH] Remove a lot of nlio dependencies, enable TestUDP (#31802) * Enable TestUDP and remove nlbyteorder include * Drop some nlio dependencies ... I am not sure they are needed * Drop a lot of nlio dependencies all over the place * Split out chipencoding as a standalone * Restyle --- BUILD.gn | 2 -- src/inet/BUILD.gn | 2 -- src/lib/core/BUILD.gn | 7 +++++-- src/lib/support/BUILD.gn | 3 +-- src/messaging/tests/BUILD.gn | 3 --- src/platform/BUILD.gn | 1 - src/platform/Linux/ThreadStackManagerImpl.cpp | 4 ---- src/platform/webos/ThreadStackManagerImpl.cpp | 4 ---- src/protocols/bdx/tests/BUILD.gn | 2 -- src/protocols/secure_channel/tests/BUILD.gn | 2 -- src/protocols/user_directed_commissioning/tests/BUILD.gn | 2 -- src/transport/BUILD.gn | 2 -- src/transport/raw/tests/BUILD.gn | 3 +-- src/transport/raw/tests/TestTCP.cpp | 1 - src/transport/raw/tests/TestUDP.cpp | 3 +-- src/transport/retransmit/tests/BUILD.gn | 2 -- src/transport/tests/BUILD.gn | 2 -- 17 files changed, 8 insertions(+), 37 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index b51ab7238414e9..89861ea79af5d0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -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/nlio.gni") import("//build_overrides/nlunit_test.gni") import("//build_overrides/pigweed.gni") @@ -136,7 +135,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "${chip_root}/src/system", "${chip_root}/src/transport", "${nlassert_root}:nlassert", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/inet/BUILD.gn b/src/inet/BUILD.gn index 37213302a74be9..09a6e569d5b1e0 100644 --- a/src/inet/BUILD.gn +++ b/src/inet/BUILD.gn @@ -16,7 +16,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("//build_overrides/nlassert.gni") import("//build_overrides/nlfaultinjection.gni") -import("//build_overrides/nlio.gni") import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/build/chip/tests.gni") @@ -104,7 +103,6 @@ static_library("inet") { "${chip_root}/src/lib/support", "${chip_root}/src/platform:platform_config_header", "${chip_root}/src/system", - "${nlio_root}:nlio", ] if (chip_system_config_use_lwip) { diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index e4bf67e65b04c9..eb66f46fd8aa8d 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -104,6 +104,11 @@ source_set("error") { ] } +source_set("encoding") { + sources = [ "CHIPEncoding.h" ] + public_deps = [ "${nlio_root}:nlio" ] +} + source_set("types") { sources = [ "CHIPSafeCasts.h", @@ -128,7 +133,6 @@ static_library("core") { "CASEAuthTag.h", "CHIPCallback.h", "CHIPCore.h", - "CHIPEncoding.h", "CHIPKeyIds.cpp", "CHIPKeyIds.h", "CHIPPersistentStorageDelegate.h", @@ -172,7 +176,6 @@ static_library("core") { "${chip_root}/src/inet", "${chip_root}/src/lib/support", "${chip_root}/src/system", - "${nlio_root}:nlio", ] allow_circular_includes_from = [ diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 0ead05ccfc55f1..410f3beaf21141 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -16,7 +16,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("//build_overrides/nlassert.gni") import("//build_overrides/nlfaultinjection.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("//build_overrides/pigweed.gni") @@ -256,12 +255,12 @@ static_library("support") { ":verifymacros", ":verifymacros_no_logging", "${chip_root}/src/lib/core:chip_config_header", + "${chip_root}/src/lib/core:encoding", "${chip_root}/src/lib/core:error", "${chip_root}/src/lib/core:types", "${chip_root}/src/platform:platform_config_header", "${chip_root}/src/system:system_config_header", "${nlassert_root}:nlassert", - "${nlio_root}:nlio", ] # These are needed because we include CHIPCore.h, which uses config diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index d2d3ebbd8bafb9..b3f41b6bb08457 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -37,7 +36,6 @@ static_library("helpers") { "${chip_root}/src/protocols", "${chip_root}/src/transport", "${chip_root}/src/transport/tests:helpers", - "${nlio_root}:nlio", ] } @@ -78,7 +76,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/protocols", "${chip_root}/src/transport", "${chip_root}/src/transport/raw/tests:helpers", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 1a86faba89922c..c6b1aae23ee40f 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/linux/pkg_config.gni") diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 20bfe905144b8f..a8f6c23f1e5a24 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -28,10 +28,6 @@ #include -#include -#include -#include - using namespace ::chip::app; using namespace ::chip::app::Clusters; using namespace chip::DeviceLayer::NetworkCommissioning; diff --git a/src/platform/webos/ThreadStackManagerImpl.cpp b/src/platform/webos/ThreadStackManagerImpl.cpp index 79ad2e408857fb..3022519eb45fff 100644 --- a/src/platform/webos/ThreadStackManagerImpl.cpp +++ b/src/platform/webos/ThreadStackManagerImpl.cpp @@ -27,10 +27,6 @@ #include -#include -#include -#include - using namespace ::chip::app; using namespace ::chip::app::Clusters; using namespace chip::DeviceLayer::NetworkCommissioning; diff --git a/src/protocols/bdx/tests/BUILD.gn b/src/protocols/bdx/tests/BUILD.gn index 7a518a3f78a7ac..59d5f01d35a9c1 100644 --- a/src/protocols/bdx/tests/BUILD.gn +++ b/src/protocols/bdx/tests/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -33,7 +32,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols/bdx", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index fe3cafe7f0d4fb..b77fb6976734c6 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -1,6 +1,5 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") @@ -35,7 +34,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/protocols", "${chip_root}/src/protocols/secure_channel", "${chip_root}/src/transport/raw/tests:helpers", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/protocols/user_directed_commissioning/tests/BUILD.gn b/src/protocols/user_directed_commissioning/tests/BUILD.gn index dc33a2cf9d23a7..f536273f2e28ce 100644 --- a/src/protocols/user_directed_commissioning/tests/BUILD.gn +++ b/src/protocols/user_directed_commissioning/tests/BUILD.gn @@ -12,7 +12,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -27,7 +26,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/transport/BUILD.gn b/src/transport/BUILD.gn index 33a8f05f8c64df..5d1a9c9d3becc0 100644 --- a/src/transport/BUILD.gn +++ b/src/transport/BUILD.gn @@ -13,7 +13,6 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/src/ble/ble.gni") import("${chip_root}/src/lib/core/core.gni") @@ -68,7 +67,6 @@ static_library("transport") { "${chip_root}/src/tracing", "${chip_root}/src/tracing:macros", "${chip_root}/src/transport/raw", - "${nlio_root}:nlio", ] if (chip_enable_transport_trace) { diff --git a/src/transport/raw/tests/BUILD.gn b/src/transport/raw/tests/BUILD.gn index 1767b113d07ce3..8adcb9beb7eeee 100644 --- a/src/transport/raw/tests/BUILD.gn +++ b/src/transport/raw/tests/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -43,6 +42,7 @@ chip_test_suite_using_nltest("tests") { "TestMessageHeader.cpp", "TestPeerAddress.cpp", "TestTCP.cpp", + "TestUDP.cpp", ] public_deps = [ @@ -54,7 +54,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/transport", "${chip_root}/src/transport/raw", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index 62b03f4e3feb03..620e97ca4325b3 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include diff --git a/src/transport/raw/tests/TestUDP.cpp b/src/transport/raw/tests/TestUDP.cpp index bff5e9efa1de00..b26d23277d5844 100644 --- a/src/transport/raw/tests/TestUDP.cpp +++ b/src/transport/raw/tests/TestUDP.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -196,7 +195,7 @@ static nlTestSuite sSuite = */ static int Initialize(void * aContext) { - CHIP_ERROR err = reinterpret_cast(aContext)->Init(&sSuite); + CHIP_ERROR err = reinterpret_cast(aContext)->Init(); return (err == CHIP_NO_ERROR) ? SUCCESS : FAILURE; } diff --git a/src/transport/retransmit/tests/BUILD.gn b/src/transport/retransmit/tests/BUILD.gn index 0b75a5b4d4a931..fb08fa08f48a1d 100644 --- a/src/transport/retransmit/tests/BUILD.gn +++ b/src/transport/retransmit/tests/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -32,7 +31,6 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/transport/retransmit", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/transport/tests/BUILD.gn b/src/transport/tests/BUILD.gn index f982134d5b84a1..6f454f4502e0c0 100644 --- a/src/transport/tests/BUILD.gn +++ b/src/transport/tests/BUILD.gn @@ -14,7 +14,6 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlio.gni") import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") @@ -59,7 +58,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/protocols", "${chip_root}/src/transport", "${chip_root}/src/transport/tests:helpers", - "${nlio_root}:nlio", "${nlunit_test_root}:nlunit-test", ] }