Skip to content

Commit

Permalink
[ linux cirque ] Add flake8 to workflow and fix python files (part #2…
Browse files Browse the repository at this point in the history
…5193) (#25245)

* [linux-cirque] Add flake8 to workflow and fix python files in linux cirque test

* rebase

* Restyled by autopep8

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Arkadiusz Bokowy <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Feb 1, 2024
1 parent 999071b commit 3121321
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 56 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ exclude = third_party
# TODO: Remove the paths below when all bugs are fixed
src/tools/chip-cert/*
src/test_driver/mbed/*
src/test_driver/linux-cirque/*
build/chip/java/tests/*
build/chip/linux/*
build/config/linux/*
Expand Down
12 changes: 7 additions & 5 deletions src/test_driver/linux-cirque/CommissioningFailureOnReportTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -83,8 +81,11 @@ def run_controller_test(self):
if device['type'] == 'MobileDevice']

for server in server_ids:
self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))
self.execute_device_cmd(
server,
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"bt 25\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))

self.reset_thread_devices(server_ids)

Expand All @@ -97,7 +98,8 @@ def run_controller_test(self):
self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))

command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {} --paa-trust-store-path {} --fail-on-report".format(
command = ("gdb -return-child-result -q -ex run -ex bt --args python3 "
"{} -t 150 -a {} --paa-trust-store-path {} --fail-on-report").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_failure_test.py"),
ethernet_ip, os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS))
Expand Down
9 changes: 5 additions & 4 deletions src/test_driver/linux-cirque/CommissioningFailureTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -83,8 +81,11 @@ def run_controller_test(self):
if device['type'] == 'MobileDevice']

for server in server_ids:
self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))
self.execute_device_cmd(
server,
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"bt 25\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))

self.reset_thread_devices(server_ids)

Expand Down
15 changes: 9 additions & 6 deletions src/test_driver/linux-cirque/CommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -99,8 +97,11 @@ def run_controller_test(self):
servers[1]['nodeid'] = 2

for server in servers:
self.execute_device_cmd(server['id'], "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), server['discriminator']))
self.execute_device_cmd(
server['id'],
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"bt 25\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), server['discriminator']))

self.reset_thread_devices([server['id'] for server in servers])

Expand All @@ -113,7 +114,8 @@ def run_controller_test(self):
self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))

command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {} --paa-trust-store-path {} --discriminator {} --nodeid {}".format(
command = ("gdb -return-child-result -q -ex run -ex bt --args python3 "
"{} -t 150 -a {} --paa-trust-store-path {} --discriminator {} --nodeid {}").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_test.py"),
servers[0]['ip'],
Expand All @@ -125,7 +127,8 @@ def run_controller_test(self):
self.assertEqual(ret['return_code'], '0',
"Test failed: non-zero return code")

command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --paa-trust-store-path {} --discriminator {} --setup-payload {} --nodeid {}".format(
command = ("gdb -return-child-result -q -ex run -ex bt --args python3 "
"{} -t 150 --paa-trust-store-path {} --discriminator {} --setup-payload {} --nodeid {}").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_test.py"),
os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS),
Expand Down
9 changes: 5 additions & 4 deletions src/test_driver/linux-cirque/CommissioningWindowTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -88,7 +86,9 @@ def run_controller_test(self):
servers[0]['nodeid'] = 1

for server in servers:
self.execute_device_cmd(server['id'], "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format(
self.execute_device_cmd(server['id'],
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"bt 25\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), server['discriminator']))

self.reset_thread_devices([server['id'] for server in servers])
Expand All @@ -102,7 +102,8 @@ def run_controller_test(self):
self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))

command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --address {} --paa-trust-store-path {}".format(
command = ("gdb -return-child-result -q -ex run -ex bt "
"--args python3 {} -t 150 --address {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_window_test.py"),
servers[0]['ip'],
Expand Down
7 changes: 4 additions & 3 deletions src/test_driver/linux-cirque/EchoOverTcpTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import logging
import os
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -83,8 +82,10 @@ def run_data_model_test(self):
req_device_id = req_ids[0]

for id in resp_ids:
self.execute_device_cmd(id, "CHIPCirqueDaemon.py -- run gdb -batch -return-child-result -q -ex run -ex bt --args {}".format(
os.path.join(CHIP_REPO, "out/debug/linux_x64_gcc/chip-echo-responder --tcp")))
self.execute_device_cmd(
id,
"CHIPCirqueDaemon.py -- run gdb -batch -return-child-result -q -ex run -ex bt --args {}".format(
os.path.join(CHIP_REPO, "out/debug/linux_x64_gcc/chip-echo-responder --tcp")))

command = "gdb -return-child-result -q -ex run -ex bt --args " + \
os.path.join(
Expand Down
1 change: 0 additions & 1 deletion src/test_driver/linux-cirque/EchoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import logging
import os
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down
9 changes: 5 additions & 4 deletions src/test_driver/linux-cirque/FailsafeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -83,8 +81,11 @@ def run_controller_test(self):
if device['type'] == 'MobileDevice']

for server in server_ids:
self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))
self.execute_device_cmd(
server,
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"bt 25\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))

self.reset_thread_devices(server_ids)

Expand Down
1 change: 0 additions & 1 deletion src/test_driver/linux-cirque/InteractionModelTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import logging
import os
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down
2 changes: 1 addition & 1 deletion src/test_driver/linux-cirque/ManualTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import sys
import time
from optparse import OptionParser, OptionValueError
from optparse import OptionParser

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down
12 changes: 7 additions & 5 deletions src/test_driver/linux-cirque/MobileDeviceTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -83,8 +81,11 @@ def run_controller_test(self):
if device['type'] == 'MobileDevice']

for server in server_ids:
self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -batch -return-child-result -q -ex \"set pagination off\" -ex run -ex \"thread apply all bt\" --args {} --thread --discriminator {}".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))
self.execute_device_cmd(
server,
("CHIPCirqueDaemon.py -- run gdb -batch -return-child-result -q -ex \"set pagination off\" "
"-ex run -ex \"thread apply all bt\" --args {} --thread --discriminator {}").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR))

self.reset_thread_devices(server_ids)

Expand All @@ -97,7 +98,8 @@ def run_controller_test(self):
self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))

command = "gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" --args python3 {} -t 240 -a {} --paa-trust-store-path {}".format(
command = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 240 -a {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/mobile-device-test.py"), ethernet_ip,
os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS))
Expand Down
7 changes: 5 additions & 2 deletions src/test_driver/linux-cirque/OnOffClusterTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ def run_data_model_test(self):
for device_id in server_ids:
self.logger.info("checking device log for {}".format(
self.get_device_pretty_id(device_id)))
self.assertTrue(self.sequenceMatch(self.get_device_log(device_id).decode('utf-8'), ["Thread initialized.", "LightingManager::InitiateAction(ON_ACTION)", "LightingManager::InitiateAction(OFF_ACTION)"]),
"Datamodel test failed: cannot find matching string from device {}".format(device_id))
self.assertTrue(self.sequenceMatch(self.get_device_log(device_id).decode('utf-8'), [
"Thread initialized.",
"LightingManager::InitiateAction(ON_ACTION)",
"LightingManager::InitiateAction(OFF_ACTION)"
]), "Datamodel test failed: cannot find matching string from device {}".format(device_id))


if __name__ == "__main__":
Expand Down
2 changes: 0 additions & 2 deletions src/test_driver/linux-cirque/PythonCommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down
11 changes: 6 additions & 5 deletions src/test_driver/linux-cirque/SplitCommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import logging
import os
import pprint
import sys
import time

from helper.CHIPTestBase import CHIPVirtualHome

Expand Down Expand Up @@ -91,8 +89,10 @@ def run_controller_test(self):
if device['type'] == 'MobileDevice']

for server in server_ids:
self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread".format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app")))
self.execute_device_cmd(server,
("CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex "
"\"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread").format(
os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app")))

self.reset_thread_devices(server_ids)

Expand All @@ -105,7 +105,8 @@ def run_controller_test(self):
self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))

command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --address1 {} --address2 {} --paa-trust-store-path {}".format(
command = ("gdb -return-child-result -q -ex run -ex bt --args python3 "
"{} -t 150 --address1 {} --address2 {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/split_commissioning_test.py"),
ethernet_ips[0], ethernet_ips[1], os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS))
Expand Down
Loading

0 comments on commit 3121321

Please sign in to comment.