Skip to content

Commit

Permalink
adjusted files per build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abpoth committed Aug 21, 2023
1 parent 83aeeb1 commit efd154f
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 136 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,10 @@ jobs:
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_3_1.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_1_2.py" --script-args " --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_3_1.py" --script-args " --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_3_2.py" --script-args " --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DISHM_3_3.py" --script-args " --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
- name: Uploading core files
uses: actions/upload-artifact@v3
Expand Down
109 changes: 53 additions & 56 deletions src/python_testing/TC_DISHM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,68 +36,65 @@ async def read_mode_attribute_expect_success(self, endpoint, attribute):
@async_test_body
async def test_TC_DISHM_1_2(self):

asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params,
"PIXIT_ENDPOINT must be included on the command line in "
"the --int-arg flag as PIXIT_ENDPOINT:<endpoint>")
self.endpoint = self.user_params.get("endpoint", 1)

self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT']
asserts.assert_true(self.check_pics("DISHM.S.A0000"), "DISHM.S.A0000 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.A0001"), "DISHM.S.A0001 must be supported")

attributes = Clusters.DishwasherMode.Attributes

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

if self.check_pics("DISHM.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))

asserts.assert_greater_equal(len(supported_modes), 1, "SupportedModes must have at least one entries!")

supported_modes_dut = []
for m in supported_modes:
if m.mode in supported_modes_dut:
asserts.fail("SupportedModes must have unique mode values!")
else:
supported_modes_dut.append(m.mode)

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)

# common mode tags
commonTags = {0x0: 'Auto',
0x1: 'Quick',
0x2: 'Quiet',
0x3: 'LowNoise',
0x4: 'LowEnergy',
0x5: 'Vacation',
0x6: 'Min',
0x7: 'Max',
0x8: 'Night',
0x9: 'Day'}

runTags = [tag.value for tag in Clusters.DishwasherMode.Enums.ModeTag
if tag is not Clusters.DishwasherMode.Enums.ModeTag.kUnknownEnumValue]

for m in supported_modes:
for t in m.modeTags:
is_mfg = (0x8000 <= t.value and t.value <= 0xBFFF)
asserts.assert_true(t.value in commonTags.keys() or t.value in runTags or is_mfg,
"Found a SupportedModes entry with invalid mode tag value!")
if t.value == Clusters.DishwasherMode.Enums.ModeTag.kNormal:
normal_present = True
asserts.assert_true(normal_present, "The Supported Modes does not have an entry of Normal(0x4000)")

if self.check_pics("DISHM.S.A0001"):
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 supported_modes_dut, "CurrentMode is not a supported mode!")
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))

asserts.assert_greater_equal(len(supported_modes), 1, "SupportedModes must have at least one entries!")

supported_modes_dut = []
for m in supported_modes:
if m.mode in supported_modes_dut:
asserts.fail("SupportedModes must have unique mode values!")
else:
supported_modes_dut.append(m.mode)

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)

# common mode tags
commonTags = {0x0: 'Auto',
0x1: 'Quick',
0x2: 'Quiet',
0x3: 'LowNoise',
0x4: 'LowEnergy',
0x5: 'Vacation',
0x6: 'Min',
0x7: 'Max',
0x8: 'Night',
0x9: 'Day'}

runTags = [tag.value for tag in Clusters.DishwasherMode.Enums.ModeTag
if tag is not Clusters.DishwasherMode.Enums.ModeTag.kUnknownEnumValue]

for m in supported_modes:
for t in m.modeTags:
is_mfg = (0x8000 <= t.value and t.value <= 0xBFFF)
asserts.assert_true(t.value in commonTags.keys() or t.value in runTags or is_mfg,
"Found a SupportedModes entry with invalid mode tag value!")
if t.value == Clusters.DishwasherMode.Enums.ModeTag.kNormal:
normal_present = True
asserts.assert_true(normal_present, "The Supported Modes does not have an entry of Normal(0x4000)")

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 supported_modes_dut, "CurrentMode is not a supported mode!")

if self.check_pics("DISHM.S.A0003"):
self.print_step(4, "Read OnMode attribute")
Expand Down
48 changes: 24 additions & 24 deletions src/python_testing/TC_DISHM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ async def test_TC_DISHM_2_1(self):
asserts.assert_true(self.check_pics("DISHM.S.A0001"), "DISHM.S.A0001 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C00.Rsp"), "DISHM.S.C00.Rsp must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C01.Tx"), "DISHM.S.C01.Tx must be supported")
asserts.assert_true(self.check_pics("DISHM.S.M.CAN_TEST_MODE_FAILURE"), "DISHM.S.M.CAN_TEST_MODE_FAILURE must be supported")


attributes = Clusters.DishwasherMode.Attributes

self.print_step(1, "Commissioning, already done")
Expand Down Expand Up @@ -122,40 +121,41 @@ class CommonCodes(Enum):

asserts.assert_true(current_mode == old_current_mode_dut, "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")
if self.modeok is True:
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")

self.print_step(10, "Read CurrentMode attribute")
old_current_mode_dut = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(10, "Read CurrentMode attribute")
old_current_mode_dut = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (old_current_mode_dut))
logging.info("CurrentMode: %s" % (old_current_mode_dut))

self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.modeok))
self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.modeok))

ret = await self.send_change_to_mode_cmd(newMode=self.modeok)
asserts.assert_true(ret.status == CommonCodes.SUCCESS.value,
"Changing to mode %d must succeed due to the current state of the device" % (self.modeok))
ret = await self.send_change_to_mode_cmd(newMode=self.modeok)
asserts.assert_true(ret.status == CommonCodes.SUCCESS.value,
"Changing to mode %d must succeed due to the current state of the device" % (self.modeok))

self.print_step(12, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(12, "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 == self.modeok,
"CurrentMode doesn't match the argument of the successful ChangeToMode command!")
asserts.assert_true(current_mode == self.modeok,
"CurrentMode doesn't match the argument of the successful ChangeToMode command!")

self.print_step(13, "Send ChangeToMode command with NewMode set to %d" % (invalid_mode_th))
self.print_step(13, "Send ChangeToMode command with NewMode set to %d" % (invalid_mode_th))

ret = await self.send_change_to_mode_cmd(newMode=invalid_mode_th)
asserts.assert_true(ret.status == CommonCodes.UNSUPPORTED_MODE.value,
"Attempt to change to invalid mode %d didn't fail as expected" % (invalid_mode_th))
ret = await self.send_change_to_mode_cmd(newMode=invalid_mode_th)
asserts.assert_true(ret.status == CommonCodes.UNSUPPORTED_MODE.value,
"Attempt to change to invalid mode %d didn't fail as expected" % (invalid_mode_th))

self.print_step(14, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(14, "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 == self.modeok, "CurrentMode changed after failed ChangeToMode command!")
asserts.assert_true(current_mode == self.modeok, "CurrentMode changed after failed ChangeToMode command!")


if __name__ == "__main__":
Expand Down
12 changes: 5 additions & 7 deletions src/python_testing/TC_DISHM_3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import logging
import random

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
Expand Down Expand Up @@ -58,18 +57,17 @@ async def send_off_command(self) -> Clusters.Objects.OnOff.Commands.Off:
@async_test_body
async def test_TC_DISHM_3_1(self):

asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params,
"PIXIT_ENDPOINT must be included on the command line in "
"the --int-arg flag as PIXIT_ENDPOINT:<endpoint>")

self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT']
self.endpoint = self.user_params.get("endpoint", 1)

asserts.assert_true(self.check_pics("DISHM.S.A0000"), "DISHM.S.A0000 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.A0001"), "DISHM.S.A0001 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.A0002"), "DISHM.S.A0002 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C00.Rsp"), "DISHM.S.C00.Rsp must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C01.Tx"), "DISHM.S.C01.Tx must be supported")

if not self.check_pics("DISHM.S.A0003"):
logging.info("Test skipped because PICS DISHM.S.A0003 (OnMode) is not set")
return

attributes = Clusters.DishwasherMode.Attributes

from enum import Enum
Expand Down
20 changes: 5 additions & 15 deletions src/python_testing/TC_DISHM_3_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

import logging
import random

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
Expand Down Expand Up @@ -52,10 +51,13 @@ async def test_TC_DISHM_3_2(self):

asserts.assert_true(self.check_pics("DISHM.S.A0000"), "DISHM.S.A0000 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.A0001"), "DISHM.S.A0001 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.A0002"), "DISHM.S.A0002 must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C00.Rsp"), "DISHM.S.C00.Rsp must be supported")
asserts.assert_true(self.check_pics("DISHM.S.C01.Tx"), "DISHM.S.C01.Tx must be supported")

if not self.check_pics("DISHM.S.A0002"):
logging.info("Test skipped because PICS DISHM.S.A0002 (StartupMode) is not set")
return

attributes = Clusters.DishwasherMode.Attributes

from enum import Enum
Expand All @@ -72,20 +74,8 @@ class CommonCodes(Enum):
startup_mode_dut = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.StartUpMode)

logging.info("StartUpMode: %s" % (startup_mode_dut))
if startup_mode_dut == NullValue:
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))

asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least two entries!")

modes = [m.mode for m in supported_modes]
startup_mode_dut = random.choice(modes)

self.print_step(2, "Write the value %s to StartUpMode" % (startup_mode_dut))

await self.write_start_up_mode(newMode=startup_mode_dut)
asserts.assert_false(startup_mode_dut == NullValue, "Startup mode value should be an integer value")

self.print_step(3, "Read CurrentMode attribute")

Expand Down
Loading

0 comments on commit efd154f

Please sign in to comment.