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

deleted #37721

Closed
Closed

deleted #37721

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
2 changes: 1 addition & 1 deletion .github/workflows/examples-esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
name: ESP32_1

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif'
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32:94
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
BUILD_TYPE: esp32-qemu

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif'
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32-qemu:94
Expand Down
2 changes: 1 addition & 1 deletion src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ if (chip_build_tests) {
tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/tests" ]
}

if (chip_device_platform != "esp32" && chip_device_platform != "ameba") {
if (chip_device_platform != "ameba") {
tests += [ "${chip_root}/src/platform/tests" ]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ CHIP_ERROR GenericPlatformManagerImpl_FreeRTOS<ImplClass>::_InitChipStack(void)
mChipTimerActive = false;

// We support calling Shutdown followed by InitChipStack, because some tests
// do that. To keep things simple for existing consumers, we keep not
// destroying our lock and queue in shutdown, but rather check whether they
// already exist here before trying to create them.
// do that.

if (mChipStackLock == NULL)
{
Expand Down Expand Up @@ -245,7 +243,7 @@ void GenericPlatformManagerImpl_FreeRTOS<ImplClass>::_RunEventLoop(void)

BaseType_t eventReceived = pdFALSE;
{
// Unlock the CHIP stack, allowing other threads to enter CHIP while
// Unlock the CHIP stack, allowing other threads to enter CHIP while
// the event loop thread is sleeping.
StackUnlock unlock;
eventReceived = xQueueReceive(mChipEventQueue, &event, waitTime);
Expand Down Expand Up @@ -417,6 +415,16 @@ template <class ImplClass>
void GenericPlatformManagerImpl_FreeRTOS<ImplClass>::_Shutdown(void)
{
GenericPlatformManagerImpl<ImplClass>::_Shutdown();

if (mChipEventQueue != NULL) {
vQueueDelete(mChipEventQueue);
mChipEventQueue = NULL;
}

if (mChipStackLock != NULL) {
vSemaphoreDelete(mChipStackLock);
mChipStackLock = NULL;
}
}

template <class ImplClass>
Expand Down
5 changes: 5 additions & 0 deletions src/platform/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ if (chip_device_platform != "none" && chip_device_platform != "fake") {
"TestConfigurationMgr.cpp",
"TestPlatformTime.cpp",
]

if (chip_device_platform == "esp32") {
# On esp32-qemu SleepMillis can sometimes undersleep by as much as 10ms.
defines = [ "CONFIG_WIDER_SLEEP_MARGIN" ]
}
}

if (chip_enable_openthread) {
Expand Down
16 changes: 13 additions & 3 deletions src/platform/tests/TestPlatformMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ TEST_F(TestPlatformMgr, BasicEventLoopTask)
{
EXPECT_EQ(PlatformMgr().StartEventLoopTask(), CHIP_NO_ERROR);

// Sleep for a short time to allow the event loop to start.
// Without this some platforms (e.g. esp32-qemu) will error.
chip::test_utils::SleepMillis(10);

std::atomic<int> counterSync{ 2 };

// Verify that the event loop will not exit until we tell it to by
Expand Down Expand Up @@ -148,10 +152,10 @@ TEST_F(TestPlatformMgr, BasicRunEventLoop)

PlatformMgr().ScheduleWork(StopTheLoop);

EXPECT_FALSE(stopRan);
EXPECT_FALSE(stopRan);
PlatformMgr().RunEventLoop();
EXPECT_TRUE(stopRan);
EXPECT_EQ(stopResult, CHIP_NO_ERROR);
EXPECT_TRUE(stopRan);
EXPECT_EQ(stopResult, CHIP_NO_ERROR);

PlatformMgr().Shutdown();
}
Expand Down Expand Up @@ -207,9 +211,15 @@ TEST_F(TestPlatformMgr, RunEventLoopStopBeforeSleep)

TEST_F(TestPlatformMgr, TryLockChipStack)
{
EXPECT_EQ(PlatformMgr().InitChipStack(), CHIP_NO_ERROR);

bool locked = PlatformMgr().TryLockChipStack();
EXPECT_TRUE(locked);

if (locked)
PlatformMgr().UnlockChipStack();

PlatformMgr().Shutdown();
}

static int sEventRecieved = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/platform/tests/TestPlatformTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ using namespace chip::Logging;
using namespace chip::System;
using namespace chip::System::Clock::Literals;

#ifdef CONFIG_WIDER_SLEEP_MARGIN
// On esp32-qemu SleepMillis can sometimes undersleep by as much as 10ms.
constexpr Clock::Milliseconds64 kTestTimeMarginMs = 10_ms64;
#else
constexpr Clock::Milliseconds64 kTestTimeMarginMs = 2_ms64;
#endif
constexpr Clock::Microseconds64 kTestTimeMarginUs = 500_us64;

// =================================
Expand Down Expand Up @@ -108,6 +113,7 @@ TEST(TestDevice, GetMonotonicMilliseconds)
ChipLogValueX64(Tstart.count()), ChipLogValueX64(Tend.count()), ChipLogValueX64(Tdelta.count()),
ChipLogValueX64(Tdelay.count()));

//printf("+++x Tstart=%llu, Tend=%llu, Tdelta=%llu, (Tdelay=%llu - margin=%llu)=%llu\n", Tstart.count(), Tend.count(), Tdelta.count(), Tdelay.count(), margin.count(), (Tdelay - margin).count());
// verify that timers don't fire early
EXPECT_GT(Tdelta, (Tdelay - margin));
// verify they're not too late
Expand Down
1 change: 1 addition & 0 deletions src/test_driver/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ esp32_unit_test(NAME testMinimalMdnsCore LIBRARY MinimalMdnsCoreTests)
esp32_unit_test(NAME testMinimalMdnsRecords LIBRARY MinimalMdnsRecordsTests)
esp32_unit_test(NAME testMinimalMdnsResponders LIBRARY MinimalMdnsRespondersTests)
esp32_unit_test(NAME testMdns LIBRARY MdnsTests)
esp32_unit_test(NAME testPlatform LIBRARY PlatformTests)
esp32_unit_test(NAME testRetransmit LIBRARY RetransmitTests)
esp32_unit_test(NAME testSetupPayload LIBRARY SetupPayloadTests)
esp32_unit_test(NAME testSystemLayer LIBRARY SystemLayerTests)
Expand Down