Skip to content

Commit 67984aa

Browse files
Added StayActiveRequest scenarios to the yaml test
1 parent c54a103 commit 67984aa

File tree

3 files changed

+85
-24
lines changed

3 files changed

+85
-24
lines changed

src/app/icd/server/ICDManager.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ class ICDManager : public ICDListener
127127
#endif // CHIP_CONFIG_ENABLE_ICD_CIP
128128

129129
#ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST
130-
void SetTestFeatureMapValue(uint32_t featureMap)
131-
{
132-
mFeatureMap = featureMap;
133-
};
130+
void SetTestFeatureMapValue(uint32_t featureMap) { mFeatureMap = featureMap; };
134131
#endif
135132

136133
// Implementation of ICDListener functions.

src/app/tests/suites/TestIcdManagementCluster.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,82 @@ tests:
372372
value: 102
373373
response:
374374
error: NOT_FOUND
375+
376+
- label:
377+
"Wait for a little bit less than the active mode duration (10000ms)"
378+
cluster: "DelayCommands"
379+
command: "WaitForMs"
380+
arguments:
381+
values:
382+
- name: "ms"
383+
value: 9000
384+
385+
- label:
386+
"StayActive Scenario 1: Confirm the promised active duration is
387+
increased to a specific if a value less than 30000ms is requested and
388+
the device does not intend to stay active longer"
389+
command: "StayActiveRequest"
390+
arguments:
391+
values:
392+
- name: "StayActiveDuration"
393+
value: 20000
394+
response:
395+
values:
396+
- name: "PromisedActiveDuration"
397+
constraints:
398+
type: int32u
399+
minValue: 19500
400+
maxValue: 20500
401+
402+
- label:
403+
"Wait for a little bit less than the new promied active mode duration
404+
(20000ms)"
405+
cluster: "DelayCommands"
406+
command: "WaitForMs"
407+
arguments:
408+
values:
409+
- name: "ms"
410+
value: 19000
411+
412+
- label:
413+
"StayActive Scenario 2: Confirm the promised active duration is
414+
reduced to 30000ms if a value greater than 30000ms is requested"
415+
command: "StayActiveRequest"
416+
arguments:
417+
values:
418+
- name: "StayActiveDuration"
419+
value: 35000
420+
response:
421+
values:
422+
- name: "PromisedActiveDuration"
423+
constraints:
424+
type: int32u
425+
minValue: 29500
426+
maxValue: 30500
427+
428+
- label:
429+
"Wait for a 20000 less than the new promied active mode duration
430+
(30000ms)"
431+
cluster: "DelayCommands"
432+
command: "WaitForMs"
433+
arguments:
434+
values:
435+
- name: "ms"
436+
value: 10000
437+
438+
- label:
439+
"StayActive Scenario 3: confirm that the device ignores the request if
440+
the device intends to stay active longer than the requested duration
441+
we should have about 20000ms left here"
442+
command: "StayActiveRequest"
443+
arguments:
444+
values:
445+
- name: "StayActiveDuration"
446+
value: 10000
447+
response:
448+
values:
449+
- name: "PromisedActiveDuration"
450+
constraints:
451+
type: int32u
452+
minValue: 19500
453+
maxValue: 20500

src/system/SystemLayerImplSelect.h

+5-20
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,18 @@ class LayerImplSelect : public LayerSocketsLoop
8888
void EventLoopEnds() override {}
8989

9090
#if CHIP_SYSTEM_CONFIG_USE_DISPATCH
91-
void SetDispatchQueue(dispatch_queue_t dispatchQueue) override
92-
{
93-
mDispatchQueue = dispatchQueue;
94-
};
95-
dispatch_queue_t GetDispatchQueue() override
96-
{
97-
return mDispatchQueue;
98-
};
91+
void SetDispatchQueue(dispatch_queue_t dispatchQueue) override { mDispatchQueue = dispatchQueue; };
92+
dispatch_queue_t GetDispatchQueue() override { return mDispatchQueue; };
9993
void HandleTimerComplete(TimerList::Node * timer);
10094
#elif CHIP_SYSTEM_CONFIG_USE_LIBEV
101-
virtual void SetLibEvLoop(struct ev_loop * aLibEvLoopP) override
102-
{
103-
mLibEvLoopP = aLibEvLoopP;
104-
};
105-
virtual struct ev_loop * GetLibEvLoop() override
106-
{
107-
return mLibEvLoopP;
108-
};
95+
virtual void SetLibEvLoop(struct ev_loop * aLibEvLoopP) override { mLibEvLoopP = aLibEvLoopP; };
96+
virtual struct ev_loop * GetLibEvLoop() override { return mLibEvLoopP; };
10997
static void HandleLibEvTimer(EV_P_ struct ev_timer * t, int revents);
11098
static void HandleLibEvIoWatcher(EV_P_ struct ev_io * i, int revents);
11199
#endif // CHIP_SYSTEM_CONFIG_USE_DISPATCH/LIBEV
112100

113101
// Expose the result of WaitForEvents() for non-blocking socket implementations.
114-
bool IsSelectResultValid() const
115-
{
116-
return mSelectResult >= 0;
117-
}
102+
bool IsSelectResultValid() const { return mSelectResult >= 0; }
118103

119104
protected:
120105
static SocketEvents SocketEventsFromFDs(int socket, const fd_set & readfds, const fd_set & writefds, const fd_set & exceptfds);

0 commit comments

Comments
 (0)