Skip to content

Commit

Permalink
[Cirque] use virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
FergusHuang committed Oct 20, 2024
1 parent 79c1cf5 commit bf8bb14
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ docs/html

# Python venv
.venv
cirque_venv

# Documentation
docs/_build
Expand Down
17 changes: 15 additions & 2 deletions scripts/tests/cirque_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,21 @@ function cirquetest_cachekeyhash() {
function cirquetest_bootstrap() {
set -ex

# Enter virtual environment if not already set. Create cirque_venv if one doesn't exist.
if [[ -z "$VIRTUAL_ENV" ]]; then
if [[ -d "$REPO_DIR"/cirque_venv ]]; then
. "$REPO_DIR"/cirque_venv/bin/activate
else
if ! command -v virtualenv &>/dev/null; then
pip install --break-system-packages virtualenv
fi
virtualenv cirque_venv
. "$REPO_DIR"/cirque_venv/bin/activate
fi
fi

cd "$REPO_DIR"/third_party/cirque/repo
pip3 install --break-system-packages pycodestyle==2.5.0 wheel
pip3 install pycodestyle==2.5.0 wheel paramiko

make NO_GRPC=1 install -j

Expand All @@ -128,7 +141,7 @@ function cirquetest_bootstrap() {
"$REPO_DIR"/integrations/docker/images/stage-2/chip-cirque-device-base/build.sh --build-arg OT_BR_POSIX_CHECKOUT="$OT_BR_POSIX_CHECKOUT"

__cirquetest_build_ot_lazy
pip3 install --break-system-packages -r requirements_nogrpc.txt
pip3 install -r requirements_nogrpc.txt

echo "OpenThread Version: $OPENTHREAD_CHECKOUT"
echo "ot-br-posix Version: $OT_BR_POSIX_CHECKOUT"
Expand Down
13 changes: 5 additions & 8 deletions src/test_driver/linux-cirque/CommissioningFailureOnReportTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 "
self.install_package(req_device_id, CHIP_REPO)

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, "cirque_venv/bin"),
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
13 changes: 5 additions & 8 deletions src/test_driver/linux-cirque/CommissioningFailureTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,11 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 {}".format(
self.install_package(req_device_id, CHIP_REPO)

command = "gdb -return-child-result -q -ex run -ex bt --args {}/python3 {} -t 150 -a {} --paa-trust-store-path {}".format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
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
25 changes: 14 additions & 11 deletions src/test_driver/linux-cirque/CommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 "
self.install_package(req_device_id, CHIP_REPO)

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, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_test.py"),
servers[0]['ip'],
Expand All @@ -152,8 +149,10 @@ 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 "
command = ("gdb -return-child-result -q -ex run -ex bt --args {}/python3 "
"{} -t 150 --paa-trust-store-path {} --discriminator {} --setup-payload {} --nodeid {} --discovery-type {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
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 All @@ -166,8 +165,10 @@ 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 "
command = ("gdb -return-child-result -q -ex run -ex bt --args {}/python3 "
"{} -t 150 --paa-trust-store-path {} --discriminator {} --setup-payload {} --nodeid {} --discovery-type {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
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 All @@ -180,8 +181,10 @@ 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 "
command = ("gdb -return-child-result -q -ex run -ex bt --args {}/python3 "
"{} -t 150 --paa-trust-store-path {} --discriminator {} --setup-payload {} --nodeid {} --discovery-type {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
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
11 changes: 4 additions & 7 deletions src/test_driver/linux-cirque/CommissioningWindowTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))
self.install_package(req_device_id, CHIP_REPO)

command = ("gdb -return-child-result -q -ex run -ex bt "
"--args python3 {} -t 150 --address {} --paa-trust-store-path {}").format(
"--args {}/python3 {} -t 150 --address {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_window_test.py"),
servers[0]['ip'],
Expand Down
13 changes: 5 additions & 8 deletions src/test_driver/linux-cirque/FailsafeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,11 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 {}".format(
self.install_package(req_device_id, CHIP_REPO)

command = "gdb -return-child-result -q -ex run -ex bt --args {}/python3 {} -t 150 -a {} --paa-trust-store-path {}".format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/failsafe_tests.py"),
ethernet_ip,
Expand Down
11 changes: 4 additions & 7 deletions src/test_driver/linux-cirque/IcdWaitForActiveTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))
self.install_package(req_device_id, CHIP_REPO)

command = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 300 -a {} --paa-trust-store-path {}").format(
"--args {}/python3 {} -t 300 -a {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/icd_wait_for_device_test.py"), ethernet_ip,
os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS))
Expand Down
11 changes: 4 additions & 7 deletions src/test_driver/linux-cirque/MobileDeviceTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))
self.install_package(req_device_id, CHIP_REPO)

command = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 300 -a {} --paa-trust-store-path {}").format(
"--args {}/python3 {} -t 300 -a {} --paa-trust-store-path {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
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
17 changes: 8 additions & 9 deletions src/test_driver/linux-cirque/PythonCommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,11 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 -d {} --paa-trust-store-path {} --nodeid {}".format(
self.install_package(req_device_id, CHIP_REPO)

command = "gdb -return-child-result -q -ex run -ex bt --args {}/python3 {} -t 150 -d {} --paa-trust-store-path {} --nodeid {}".format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/python_commissioning_flow_test.py"),
TEST_DISCRIMINATOR,
Expand All @@ -122,7 +119,9 @@ 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 -d {} --paa-trust-store-path {} --nodeid {} --bad-cert-issuer".format(
command = "gdb -return-child-result -q -ex run -ex bt --args {}/python3 {} -t 150 -d {} --paa-trust-store-path {} --nodeid {} --bad-cert-issuer".format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/python_commissioning_flow_test.py"),
TEST_DISCRIMINATOR2,
Expand Down
13 changes: 5 additions & 8 deletions src/test_driver/linux-cirque/SplitCommissioningTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,12 @@ def run_controller_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".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 "
self.install_package(req_device_id, CHIP_REPO)

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, "cirque_venv/bin"),
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,12 @@ def run_subscription_resumption_capacity_test(self):
self.reset_thread_devices(server_ids)

for req_device_id in req_ids:
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))
self.install_package(req_device_id, CHIP_REPO)

command1 = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 300 -a {} --paa-trust-store-path {} --subscription-capacity {}").format(
"--args {}/python3 {} -t 300 -a {} --paa-trust-store-path {} --subscription-capacity {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(CHIP_REPO, "src/controller/python/test/test_scripts",
"subscription_resumption_capacity_test_ctrl1.py"),
ethernet_ip, os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS),
Expand All @@ -144,8 +141,10 @@ def run_subscription_resumption_capacity_test(self):
"Test failed: non-zero return code")

command2 = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 300 -a {} --paa-trust-store-path {} --remote-server-app {} "
"--args {}/python3 {} -t 300 -a {} --paa-trust-store-path {} --remote-server-app {} "
"--subscription-capacity {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(CHIP_REPO, "src/controller/python/test/test_scripts",
"subscription_resumption_capacity_test_ctrl2.py"),
ethernet_ip, os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS),
Expand Down
11 changes: 4 additions & 7 deletions src/test_driver/linux-cirque/SubscriptionResumptionTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,12 @@ def run_subscription_resumption_test(self):

req_device_id = req_ids[0]

self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl")))
self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join(
CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl")))
self.install_package(req_device_id, CHIP_REPO)

command = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" "
"--args python3 {} -t 300 -a {} --paa-trust-store-path {} --remote-server-app {}").format(
"--args {}/python3 {} -t 300 -a {} --paa-trust-store-path {} --remote-server-app {}").format(
os.path.join(
CHIP_REPO, "cirque_venv/bin"),
os.path.join(
CHIP_REPO, "src/controller/python/test/test_scripts/subscription_resumption_test.py"), ethernet_ip,
os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), TEST_END_DEVICE_APP)
Expand Down
Loading

0 comments on commit bf8bb14

Please sign in to comment.