Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace nl-unit-test with pigweed for platform #33030

Merged
merged 6 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/platform/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("${chip_root}/src/platform/device.gni")

Expand All @@ -27,7 +26,7 @@ declare_args() {
if (chip_device_platform != "none" && chip_device_platform != "fake") {
import("${chip_root}/build/chip/chip_test_suite.gni")

chip_test_suite_using_nltest("tests") {
chip_test_suite("tests") {
output_name = "libPlatformTests"

test_sources = []
Expand All @@ -41,10 +40,8 @@ if (chip_device_platform != "none" && chip_device_platform != "fake") {
public_deps = [
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/platform",
"${chip_root}/src/system",
"${nlunit_test_root}:nlunit-test",
]

if (chip_mdns != "none" && chip_enable_dnssd_tests &&
Expand All @@ -67,6 +64,7 @@ if (chip_device_platform != "none" && chip_device_platform != "fake") {
if (chip_enable_openthread) {
# FIXME: TestThreadStackMgr requires ot-br-posix daemon to be running
# test_sources += [ "TestThreadStackMgr.cpp" ]
# configs = [ "//${chip_root}/third_party/ot-br-posix:dbus_config" ]
}

if (chip_enable_ble &&
Expand Down
11 changes: 3 additions & 8 deletions src/platform/tests/TestCHIPoBLEStackMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,23 @@

#include "platform/internal/CHIPDeviceLayerInternal.h"
#include <assert.h>
#include <gtest/gtest.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/UnitTestRegistration.h>
#include <memory>

#include "platform/PlatformManager.h"
#include "platform/internal/BLEManager.h"

void EventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg)
void EventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t)
{
(void) arg;
if (event->Type == chip::DeviceLayer::DeviceEventType::kCHIPoBLEConnectionEstablished)
{
ChipLogProgress(DeviceLayer, "Receive kCHIPoBLEConnectionEstablished");
// exit(0);
}
}

int TestCHIPoBLEStackManager()
TEST(TestCHIPoBLEStackManager, TestCHIPoBLEStackManager)
{
chip::Platform::MemoryInit();

Expand All @@ -54,7 +52,4 @@ int TestCHIPoBLEStackManager()
chip::DeviceLayer::PlatformMgrImpl().RunEventLoop();
ChipLogProgress(DeviceLayer, "RunEventLoop completed");
chip::Platform::MemoryShutdown();
return 0;
}

CHIP_REGISTER_TEST_SUITE(TestCHIPoBLEStackManager);
4 changes: 3 additions & 1 deletion src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "TestCHIPoBLEStackMgr.h"
#include <gtest/gtest.h>
#include <platform/CHIPDeviceConfig.h>
#include <stdlib.h>

Expand All @@ -24,7 +25,8 @@ int main(int argc, char * argv[])
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
if (argc == 2 && atoi(argv[1]) == 1)
{
return TestCHIPoBLEStackManager();
testing::InitGoogleTest(nullptr, nullptr);
return RUN_ALL_TESTS();
}
return 0;
#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
Expand Down
Loading
Loading