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

[Fix] Possible fix for matter-test-scripts issue #228: Remove PICS from RVC tests #34181

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5048552
Possible fix for mts issue #228:
j-ororke Jul 3, 2024
fd9f558
Restyled by autopep8
restyled-commits Jul 3, 2024
3881efe
Removed unused variable as no longer needed:
j-ororke Jul 3, 2024
f871894
Removed unused variable:
j-ororke Jul 3, 2024
a9b96f7
Reverted changes to self.is_ci check:
j-ororke Jul 4, 2024
4f912dd
Merge branch 'master' into remove_PICS_from_RVC_tests
j-ororke Jul 30, 2024
242a564
Updated RVC Clean and Run test modules:
j-ororke Aug 28, 2024
66f8e00
Restyled by autopep8
restyled-commits Aug 28, 2024
f55030c
Linting fixes in RVCCLEAN 2_2 and RVCRUN 1_2 modules
j-ororke Aug 28, 2024
2ed9e31
Merge branch 'master' into remove_PICS_from_RVC_tests
j-ororke Oct 22, 2024
e6ce20e
Merge branch 'master' into remove_PICS_from_RVC_tests
j-ororke Oct 24, 2024
d43154a
Updated RVC Clean and RVC Run test modules:
j-ororke Oct 24, 2024
8ef7176
Restyled by autopep8
restyled-commits Oct 24, 2024
d46ab09
Updating RVCRUNM_2 and RVCCLEANM_2 test modules:
j-ororke Nov 4, 2024
2f8c4bc
Restyled by autopep8
restyled-commits Nov 4, 2024
fd40db1
Merge branch 'master' into remove_PICS_from_RVC_tests
j-ororke Dec 2, 2024
53e2575
Merge branch 'master' into remove_PICS_from_RVC_tests
j-ororke Dec 18, 2024
26985ab
Updating TC_RVCCLEANM_2_1, RVCRUNM_2_1, and RVCRUNM_2_2 test modules:
j-ororke Dec 19, 2024
454ddd8
Updating TC_RVCCLEANM_2_1 and TC_RVCRUNM_2_2 test modules:
j-ororke Dec 19, 2024
221bc8c
Update TC_RVCRUNM_2_2 python test module:
j-ororke Dec 20, 2024
9c4e4e2
Updating TC_RVCRUNM_2_2 python test module:
j-ororke Dec 20, 2024
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
113 changes: 56 additions & 57 deletions src/python_testing/TC_RVCCLEANM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, *args):
self.supported_modes_dut = []

async def read_mod_attribute_expect_success(self, endpoint, attribute):
cluster = Clusters.Objects.RvcCleanMode
cluster = Clusters.RvcCleanMode
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)

def pics_TC_RVCCLEANM_1_2(self) -> list[str]:
Expand All @@ -62,60 +62,60 @@ def pics_TC_RVCCLEANM_1_2(self) -> list[str]:
async def test_TC_RVCCLEANM_1_2(self):
self.endpoint = self.matter_test_config.endpoint

attributes = Clusters.RvcCleanMode.Attributes
RVCClean_cluster = Clusters.RvcCleanMode
attributes = RVCClean_cluster.Attributes

self.print_step(1, "Commissioning, already done")

if self.check_pics("RVCCLEANM.S.A0000"):
self.print_step(2, "Read SupportedModes attribute")
supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes)

logging.info("SupportedModes: %s" % (supported_modes))

# Verify that the list has at least 2 and at most 255 entries
asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!")
asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!")

# Verify that each ModeOptionsStruct entry has a unique Mode field value
for m in supported_modes:
if m.mode in self.supported_modes_dut:
asserts.fail("SupportedModes must have unique mode values!")
else:
self.supported_modes_dut.append(m.mode)

# Verify that each ModeOptionsStruct entry has a unique Label field value
labels = []
for m in supported_modes:
if m.label in labels:
asserts.fail("SupportedModes must have unique mode label values!")
else:
labels.append(m.label)

# Verify that each ModeOptionsStruct entry's ModeTags field has:
for m in supported_modes:
# * at least one entry
if len(m.modeTags) == 0:
asserts.fail("SupportedModes must have at least one mode tag!")

at_least_one_common_or_clean_tag = False
for t in m.modeTags:
# * the values of the Value fields that are not larger than 16 bits
if t.value > 0xFFFF or t.value < 0:
asserts.fail("Mode tag values must not be larger than 16 bits!")

# * for each Value field: {isCommonOrDerivedOrMfgTagsVal}
is_mfg = (0x8000 <= t.value <= 0xBFFF)
if (t.value not in self.commonTags and
t.value not in self.cleanTags and
not is_mfg):
asserts.fail("Mode tag value is not a common tag, clean tag or vendor tag!")

# * for at least one Value field: {isCommonOrDerivedTagsVal}
if not is_mfg:
at_least_one_common_or_clean_tag = True

if not at_least_one_common_or_clean_tag:
asserts.fail("At least one mode tag must be a common tag or clean tag!")
self.print_step(2, "Read SupportedModes attribute")
supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes)

logging.info("SupportedModes: %s" % (supported_modes))

# Verify that the list has at least 2 and at most 255 entries
asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!")
asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!")

# Verify that each ModeOptionsStruct entry has a unique Mode field value
for m in supported_modes:
if m.mode in self.supported_modes_dut:
asserts.fail("SupportedModes must have unique mode values!")
else:
self.supported_modes_dut.append(m.mode)

# Verify that each ModeOptionsStruct entry has a unique Label field value
labels = []
for m in supported_modes:
if m.label in labels:
asserts.fail("SupportedModes must have unique mode label values!")
else:
labels.append(m.label)

# Verify that each ModeOptionsStruct entry's ModeTags field has:
for m in supported_modes:
# * at least one entry
if len(m.modeTags) == 0:
asserts.fail("SupportedModes must have at least one mode tag!")

at_least_one_common_or_clean_tag = False
for t in m.modeTags:
# * the values of the Value fields that are not larger than 16 bits
if t.value > 0xFFFF or t.value < 0:
asserts.fail("Mode tag values must not be larger than 16 bits!")

# * for each Value field: {isCommonOrDerivedOrMfgTagsVal}
is_mfg = (0x8000 <= t.value <= 0xBFFF)
if (t.value not in self.commonTags and
t.value not in self.cleanTags and
not is_mfg):
asserts.fail("Mode tag value is not a common tag, clean tag or vendor tag!")

# * for at least one Value field: {isCommonOrDerivedTagsVal}
if not is_mfg:
at_least_one_common_or_clean_tag = True

if not at_least_one_common_or_clean_tag:
asserts.fail("At least one mode tag must be a common tag or clean tag!")

# Verify that at least one ModeOptionsStruct entry includes either the
# Vacuum(0x4001) mode tag or the Mop(0x4002)mode tag in the ModeTags field
Expand All @@ -129,12 +129,11 @@ async def test_TC_RVCCLEANM_1_2(self):
asserts.assert_true(has_vacuum_or_mop_mode_tag,
"At least one ModeOptionsStruct entry must include either the Vacuum or Mop mode tag")

if self.check_pics("RVCCLEANM.S.A0001"):
self.print_step(3, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(3, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (current_mode))
asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!")
logging.info("CurrentMode: %s" % (current_mode))
asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!")


if __name__ == "__main__":
Expand Down
27 changes: 18 additions & 9 deletions src/python_testing/TC_RVCCLEANM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,27 @@ async def test_TC_RVCCLEANM_2_1(self):
self.mode_ok = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_OK']
self.mode_fail = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_FAIL']
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
if self.is_ci:
app_pid = self.matter_test_config.app_pid
if app_pid == 0:
asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set")
app_pid = self.matter_test_config.app_pid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just leave this CI check in for now. The question of how to determine whether an app is running in the CI is fairly open, but this PICS code is kind of meta. The goal for these issues is to remove the PICS codes for things that are represented on the device already (clusters, features, attributes, commands etc). This one is fine.

if app_pid != 0:
cecille marked this conversation as resolved.
Show resolved Hide resolved
self.app_pipe = self.app_pipe + str(app_pid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is needed as write_to_app_pipe is used later without specifying the app_pipe_name. See here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hicklin,
You are correct that was definitely needed in there and not sure how I had deleted it.
However, I have returned it to the code now.


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")
asserts.assert_true(self.check_pics("RVCCLEANM.S.C00.Rsp"), "RVCCLEANM.S.C00.Rsp must be supported")
asserts.assert_true(self.check_pics("RVCCLEANM.S.C01.Tx"), "RVCCLEANM.S.C01.Tx must be supported")
RVCClean_cluster = Clusters.RvcCleanMode
attributes = RVCClean_cluster.Attributes

# Gathering Accepted and Generated Commands and associated ids
commands = RVCClean_cluster.Commands
RVCClean_accptcmd_list = attributes.AcceptedCommandList
RVCClean_gencmd_list = attributes.GeneratedCommandList
accepted_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_accptcmd_list)
generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_gencmd_list)
chg_mode_cmd_id = commands.ChangeToMode.command_id
chg_rsp_cmd_id = commands.ChangeToModeResponse.command_id

if chg_mode_cmd_id not in accepted_cmd_list:
asserts.fail("Change To Mode receiving commands needs to be supported")

attributes = Clusters.RvcCleanMode.Attributes
if chg_rsp_cmd_id not in generated_cmd_list:
asserts.fail("Change To Mode Response to transmit commands needs to be supported")

self.print_step(1, "Commissioning, already done")

Expand Down
14 changes: 5 additions & 9 deletions src/python_testing/TC_RVCCLEANM_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def print_instruction(self, step_number, instruction):
def pics_TC_RVCCLEANM_2_2(self) -> list[str]:
return ["RVCCLEANM.S"]

# Sends and out-of-band command to the rvc-app
# Sends an out-of-band command to the rvc-app
def write_to_app_pipe(self, command):
with open(self.app_pipe, "w") as app_pipe:
app_pipe.write(command + "\n")
Expand All @@ -92,16 +92,10 @@ def write_to_app_pipe(self, command):
async def test_TC_RVCCLEANM_2_2(self):
self.endpoint = self.matter_test_config.endpoint
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
if self.is_ci:
app_pid = self.matter_test_config.app_pid
if app_pid == 0:
asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set.c")
app_pid = self.matter_test_config.app_pid
if app_pid != 0:
self.app_pipe = self.app_pipe + str(app_pid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is needed as write_to_app_pipe is used later without specifying the app_pipe_name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, you are indeed correct that was definitely needed in there and not sure how I had deleted it.
However, I have returned it to the code now.


asserts.assert_true(self.check_pics("RVCCLEANM.S"), "RVCCLEANM.S must be supported")
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")

self.print_step(1, "Commissioning, already done")

# Ensure that the device is in the correct state
Expand All @@ -110,8 +104,10 @@ async def test_TC_RVCCLEANM_2_2(self):

self.print_step(
2, "Manually put the device in a state in which the RVC Run Mode cluster’s CurrentMode attribute is set to a mode without the Idle mode tag.")

if self.is_ci:
await self.send_run_change_to_mode_cmd(1)

else:
self.wait_for_user_input(
prompt_msg="Manually put the device in a state in which the RVC Run Mode cluster’s CurrentMode attribute is set to a mode without the Idle mode tag, and press Enter when done.")
Expand Down
Loading
Loading