29
29
# --discriminator 1234
30
30
# --passcode 20202021
31
31
# --PICS src/app/tests/suites/certification/ci-pics-values
32
+ # --int-arg PIXIT.CGEN.FailsafeExpiryLengthSeconds:20
32
33
# --trace-to json:${TRACE_TEST_JSON}.json
33
34
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
34
35
# factory-reset: true
@@ -292,7 +293,8 @@ async def test_TC_CGEN_2_2(self):
292
293
293
294
# PIXIT.CGEN.FailsafeExpiryLengthSeconds:
294
295
# Timeout used in test steps to verify failsafe. Must be less than DUT MaxCumulativeFailsafeSeconds
295
- failsafe_expiration_seconds = 20
296
+ failsafe_expiration_seconds = self .matter_test_config .global_test_params ['PIXIT.CGEN.FailsafeExpiryLengthSeconds' ]
297
+ logger .info (f'Value of PIXIT.CGEN.FailsafeExpiryLengthSeconds: { failsafe_expiration_seconds } ' )
296
298
297
299
self .step (0 )
298
300
@@ -346,16 +348,13 @@ async def test_TC_CGEN_2_2(self):
346
348
logger .info (
347
349
f'Step 7: { run_type } - Bypassing failsafe expiration to avoid unnecessary delays in CI environment.' )
348
350
349
- # Expiration time set to 1 second to immediately expire the failsafe timer
350
- expiration_time_seconds = 1
351
-
352
351
# Force the failsafe timer to expire immediately for TH1, avoiding unnecessary delays in CI environments
353
352
resp = await self .set_failsafe_timer (
354
353
dev_ctrl = self .default_controller ,
355
354
node_id = self .dut_node_id ,
356
- expiration_time_seconds = expiration_time_seconds )
355
+ expiration_time_seconds = failsafe_expiration_seconds )
357
356
logger .info (
358
- f'Step #7 { run_type } - Failsafe timer expiration bypassed for TH1 by setting expiration time to { expiration_time_seconds } seconds. '
357
+ f'Step #7 { run_type } - Failsafe timer expiration bypassed for TH1 by setting expiration time to { failsafe_expiration_seconds } seconds. '
359
358
f'Test continues without the original wait.'
360
359
)
361
360
else :
@@ -647,6 +646,12 @@ async def test_TC_CGEN_2_2(self):
647
646
logger .info (f'Step #32: ArmFailSafeResponse with ErrorCode as OK({ resp .errorCode } )' )
648
647
649
648
self .step (33 )
649
+
650
+ # Set the failsafe expiration timeout to PIXIT.CGEN.FailsafeExpiryLengthSeconds seconds, must be less than maxFailsafe (max_fail_safe).
651
+ failsafe_timeout_less_than_max = failsafe_expiration_seconds
652
+ # Verify that failsafe_timeout_less_than_max is less than max_fail_safe
653
+ asserts .assert_less (failsafe_timeout_less_than_max , maxFailsafe )
654
+
650
655
if self .is_pics_sdk_ci_only :
651
656
# Step 33 - In CI environments avoiding the original wait time defined in PIXIT.CGEN.FailsafeExpiryLengthSeconds
652
657
# and speeding up test execution by setting the expiration time to 2 seconds.
@@ -655,24 +660,18 @@ async def test_TC_CGEN_2_2(self):
655
660
logger .info (
656
661
f'Step 33: { run_type } - Bypassing failsafe expiration to avoid unnecessary delays in CI environment.' )
657
662
658
- # Set the failsafe expiration timeout to 2 seconds, must be less than maxFailsafe (max_fail_safe).
659
- failsafe_timeout_less_than_max = 2
660
663
logger .info (
661
664
f'Step #33: { run_type } - Waiting for the failsafe timer '
662
665
f'(PIXIT.CGEN.FailsafeExpiryLengthSeconds --adjusted time for CI) to approach expiration, '
663
666
f'but not allowing it to fully expire. Waiting for: { failsafe_timeout_less_than_max } seconds.' )
664
-
665
667
# Wait PIXIT.CGEN.FailsafeExpiryLengthSeconds time with an additional 0.5-second buffer, not allowing the fully exire (max_fail_safe).
666
668
await asyncio .sleep (failsafe_timeout_less_than_max + .5 )
667
669
else :
668
670
run_type = "Cert Test"
669
671
670
- # Set the failsafe expiration timeout to PIXIT.CGEN.FailsafeExpiryLengthSecondsseconds, must be less than maxFailsafe (max_fail_safe).
671
- failsafe_timeout_less_than_max = failsafe_expiration_seconds
672
-
673
672
logger .info (
674
673
f'Step #33: { run_type } - Waiting for the failsafe timer '
675
- f'(PIXIT.CGEN.FailsafeExpiryLengthSeconds --adjusted time for CI ) to approach expiration, '
674
+ f'(PIXIT.CGEN.FailsafeExpiryLengthSeconds) to approach expiration, '
676
675
f'but not allowing it to fully expire. Waiting for: { failsafe_timeout_less_than_max } seconds.' )
677
676
# Wait PIXIT.CGEN.FailsafeExpiryLengthSeconds time with an additional 0.5-second buffer, not allowing the fully exire (max_fail_safe).
678
677
await asyncio .sleep (failsafe_timeout_less_than_max + .5 )
@@ -727,7 +726,7 @@ async def test_TC_CGEN_2_2(self):
727
726
# In CI environment, bypass the wait for the failsafe expiration to avoid unnecessary delays.
728
727
run_type = "CI Test"
729
728
logger .info (
730
- f'Step 38: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
729
+ f'Step # 38: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
731
730
else :
732
731
run_type = "Cert Test"
733
732
t_start = time .time ()
@@ -754,13 +753,14 @@ async def test_TC_CGEN_2_2(self):
754
753
"Unexpected number of entries in the TrustedRootCertificates table after update" )
755
754
756
755
self .step (41 )
757
- # Limit maxFailsafe to 20 seconds to prevent excessively long waits in tests (due maxFailsafe = 900 seconds).
756
+ # Limit maxFailsafe to PIXIT.CGEN.FailsafeExpiryLengthSeconds seconds to prevent excessively long waits in tests (due maxFailsafe = 900 seconds).
757
+ maxFailsafe_original = maxFailsafe
758
758
maxFailsafe = failsafe_expiration_seconds
759
759
if self .is_pics_sdk_ci_only :
760
760
# In CI environment, bypass the wait for the failsafe expiration to avoid unnecessary delays.
761
761
run_type = "CI Test"
762
762
logger .info (
763
- f'Step 41: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
763
+ f'Step # 41: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
764
764
else :
765
765
run_type = "Cert Test"
766
766
@@ -780,7 +780,7 @@ async def test_TC_CGEN_2_2(self):
780
780
)
781
781
782
782
self .step (42 )
783
- cmd = Clusters .GeneralCommissioning .Commands .ArmFailSafe (expiryLengthSeconds = maxFailsafe )
783
+ cmd = Clusters .GeneralCommissioning .Commands .ArmFailSafe (expiryLengthSeconds = maxFailsafe_original )
784
784
resp = await self .send_single_cmd (
785
785
dev_ctrl = self .default_controller ,
786
786
node_id = self .dut_node_id ,
@@ -798,18 +798,15 @@ async def test_TC_CGEN_2_2(self):
798
798
799
799
run_type = "CI Test"
800
800
logger .info (
801
- f'Step 43: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
802
-
803
- # Expiration time set to 1 second to immediately expire the failsafe timer
804
- expiration_time_seconds = 1
801
+ f'Step #43: { run_type } - Bypassing due to failsafe expiration workaround to avoid unnecessary delays in CI environment.' )
805
802
806
803
# Force the failsafe timer to expire immediately for TH1, avoiding unnecessary delays in CI environments
807
804
resp = await self .set_failsafe_timer (
808
805
dev_ctrl = self .default_controller ,
809
806
node_id = self .dut_node_id ,
810
- expiration_time_seconds = expiration_time_seconds )
807
+ expiration_time_seconds = failsafe_expiration_seconds )
811
808
logger .info (
812
- f'Step #43 { run_type } - Failsafe timer expiration bypassed for TH1 by setting expiration time to { expiration_time_seconds } seconds. '
809
+ f'Step #43 { run_type } - Failsafe timer expiration bypassed for TH1 by setting expiration time to { failsafe_expiration_seconds } seconds. '
813
810
f'Test continues without the original wait.'
814
811
)
815
812
else :
@@ -827,7 +824,7 @@ async def test_TC_CGEN_2_2(self):
827
824
# Checks if the elapsed time from start_time has met or exceeded maxFailsafe
828
825
# TH1 process can proceed
829
826
logger .info (
830
- f'Step #43: { run_type } - - MaxFailsafe is { maxFailsafe } . '
827
+ f'Step #43: { run_type } - MaxFailsafe is { maxFailsafe } . '
831
828
f'TH1 can proceed. Elapsed time: { elapsed_time :.2f} ms. '
832
829
f'The target time ({ maxFailsafe } seconds) has passed '
833
830
f'Confirmation that ArmFailSafe has not expired yet.'
0 commit comments