diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index 3c58a7e11795ea..8a2683c2317472 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -50,10 +50,14 @@ async def test_TC_RVCCLEANM_2_1(self): asserts.assert_true('PIXIT_MODEFAIL' in self.matter_test_config.global_test_params, "PIXIT_MODEFAIL must be included on the command line in " "the --int-arg flag as PIXIT_MODEFAIL:") + asserts.assert_true('pixit_can_test_mode_failure' in self.matter_test_config.global_test_params, + "PIXIT_CAN_TEST_MODE_FAILURE must be included on the command line in " + "the --bool-arg flag as PIXIT_CAN_TEST_MODE_FAILURE:") self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] self.modeok = self.matter_test_config.global_test_params['PIXIT_MODEOK'] self.modefail = self.matter_test_config.global_test_params['PIXIT_MODEFAIL'] + self.can_test_mode_failure = self.matter_test_config.global_test_params['pixit_can_test_mode_failure'] asserts.assert_true(self.check_pics("RVCCLEANM.S.A0000"), "RVCCLEANM.S.A0000 must be supported") asserts.assert_true(self.check_pics("RVCCLEANM.S.A0001"), "RVCCLEANM.S.A0001 must be supported") @@ -97,30 +101,32 @@ class CommonCodes(Enum): ret = await self.send_change_to_mode_cmd(newMode=old_current_mode) asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op") - self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) - input("Press Enter when done.\n") + if self.can_test_mode_failure is True: + self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) + input("Press Enter when done.\n") - self.print_step(6, "Read CurrentMode attribute") - old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + self.print_step(6, "Read CurrentMode attribute") + old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - logging.info("CurrentMode: %s" % (old_current_mode)) + logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) + self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) - ret = await self.send_change_to_mode_cmd(newMode=self.modefail) - st = ret.status - is_mfg_code = st in range(0x80, 0xC0) - is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcCleanCodes) or is_mfg_code - asserts.assert_true(is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) - st_text_len = len(ret.statusText) - asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) + ret = await self.send_change_to_mode_cmd(newMode=self.modefail) + st = ret.status + is_mfg_code = st in range(0x80, 0xC0) + is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcCleanCodes) or is_mfg_code + asserts.assert_true( + is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) + st_text_len = len(ret.statusText) + asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) - self.print_step(8, "Read CurrentMode attribute") - current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + self.print_step(8, "Read CurrentMode attribute") + current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - logging.info("CurrentMode: %s" % (current_mode)) + logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") + asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok)) input("Press Enter when done.\n") diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index bc9ff11da23db9..f9bd8937ae59bb 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -50,10 +50,14 @@ async def test_TC_RVCRUNM_2_1(self): asserts.assert_true('PIXIT_MODEFAIL' in self.matter_test_config.global_test_params, "PIXIT_MODEFAIL must be included on the command line in " "the --int-arg flag as PIXIT_MODEFAIL:") + asserts.assert_true('pixit_can_test_mode_failure' in self.matter_test_config.global_test_params, + "PIXIT_CAN_TEST_MODE_FAILURE must be included on the command line in " + "the --bool-arg flag as PIXIT_CAN_TEST_MODE_FAILURE:") self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] self.modeok = self.matter_test_config.global_test_params['PIXIT_MODEOK'] self.modefail = self.matter_test_config.global_test_params['PIXIT_MODEFAIL'] + self.can_test_mode_failure = self.matter_test_config.global_test_params['pixit_can_test_mode_failure'] asserts.assert_true(self.check_pics("RVCRUNM.S.A0000"), "RVCRUNM.S.A0000 must be supported") asserts.assert_true(self.check_pics("RVCRUNM.S.A0001"), "RVCRUNM.S.A0001 must be supported") @@ -97,30 +101,32 @@ class CommonCodes(Enum): ret = await self.send_change_to_mode_cmd(newMode=old_current_mode) asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op") - self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) - input("Press Enter when done.\n") + if self.can_test_mode_failure is True: + self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) + input("Press Enter when done.\n") - self.print_step(6, "Read CurrentMode attribute") - old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + self.print_step(6, "Read CurrentMode attribute") + old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - logging.info("CurrentMode: %s" % (old_current_mode)) + logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) + self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) - ret = await self.send_change_to_mode_cmd(newMode=self.modefail) - st = ret.status - is_mfg_code = st in range(0x80, 0xC0) - is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcRunCodes) or is_mfg_code - asserts.assert_true(is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) - st_text_len = len(ret.statusText) - asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) + ret = await self.send_change_to_mode_cmd(newMode=self.modefail) + st = ret.status + is_mfg_code = st in range(0x80, 0xC0) + is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcRunCodes) or is_mfg_code + asserts.assert_true( + is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) + st_text_len = len(ret.statusText) + asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) - self.print_step(8, "Read CurrentMode attribute") - current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + self.print_step(8, "Read CurrentMode attribute") + current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - logging.info("CurrentMode: %s" % (current_mode)) + logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") + asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok)) input("Press Enter when done.\n")