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

Ble-WiFi commissioning test in CI #32889

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5f1fc49
Add qemu testing to CI
jlatusek Apr 4, 2024
d18e47c
Simple script to proxy messages between D-Bus buses
arkq Apr 2, 2024
b7fd335
Fix typing for old python
jlatusek Apr 3, 2024
553c84e
Fix D-Bus error forwarding
arkq Apr 4, 2024
7e1bc8c
Remove map file
jlatusek Apr 5, 2024
ae25b21
Restyled by isort
restyled-commits Apr 8, 2024
ad08cd2
Move BLE-WiFi testing requirements to other file
jlatusek Apr 9, 2024
88a573c
Use code-wifi pairing method
jlatusek May 14, 2024
5deffd0
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Jun 12, 2024
410a523
Add support for WiFi interface created by mac80211_hwsim driver
jlatusek Jun 12, 2024
f0763e3
Do not run test script when connected by ssh
jlatusek Jun 12, 2024
635042d
Add dry run suport
jlatusek Jun 13, 2024
fdc9a59
Make shutdown more gracefully
jlatusek Jun 13, 2024
fc93c24
Fix code-wifi pairing
jlatusek Jun 17, 2024
44bc1cb
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Jun 17, 2024
d8bb72c
Get wlan name from config
jlatusek Jun 17, 2024
2685ef2
Cleanup code
jlatusek Jun 17, 2024
6e05a6f
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Jun 17, 2024
8b9305e
Bump version file
jlatusek Jun 17, 2024
391f3b9
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Jun 18, 2024
6a1f93a
Use specific qemu img version
jlatusek Jun 18, 2024
bf02c8b
Update variable names, remove only one site of network interface
jlatusek Jun 18, 2024
a2bcbfc
Bump CI images versions
jlatusek Jun 18, 2024
cd83087
Bump CI images version
jlatusek Jun 18, 2024
d11a7c1
Upgrade pip
jlatusek Jun 18, 2024
99b4808
Update all python packages
jlatusek Jun 18, 2024
882ba5b
Remove bugprone-casting-through-void check from .clang-tidy
jlatusek Jun 19, 2024
8a97fb8
Merge remote-tracking branch 'upstream/master' into bump_CI_images
jlatusek Jun 20, 2024
6bf6bf3
Add manual constrainst to fix proto conflict issue
jlatusek Jun 20, 2024
c17dce5
Update telink requirements
jlatusek Jun 20, 2024
cfd4d91
Use version of python generated by script
jlatusek Jun 20, 2024
e3c969a
Update images to latest one
jlatusek Jun 21, 2024
958e508
Merge branch 'master' of https://github.com/project-chip/connectedhom…
jlatusek Jun 21, 2024
9d24ced
Update darwin version
jlatusek Jun 21, 2024
2831fb4
Update python version for macos
jlatusek Jun 23, 2024
3cbca97
Hardcode darwin python version
jlatusek Jun 24, 2024
d0c654d
Change darwin architecture
jlatusek Jun 24, 2024
1646412
Update bitarray
jlatusek Jun 24, 2024
0837128
Merge remote-tracking branch 'upstream/master' into bump_CI_images
jlatusek Jun 24, 2024
c000b55
Revert mac to old version but update python only
jlatusek Jun 24, 2024
88f8d6e
Update python version on macos
jlatusek Jun 24, 2024
372d435
Merge branch 'macos-python-update' into bump_CI_images
jlatusek Jun 24, 2024
1cedc8f
Update python version on macos
jlatusek Jun 24, 2024
d210082
Update system python
jlatusek Jun 24, 2024
d37d4a6
Update license
jlatusek Jun 24, 2024
0eacd5b
restyle
jlatusek Jun 24, 2024
caa2acc
Merge branch 'macos-python-update' into bump_CI_images
jlatusek Jun 24, 2024
2e0d4fc
Merge remote-tracking branch 'upstream/master' into bump_CI_images
jlatusek Jun 24, 2024
ba648c6
Merge branch 'bump_CI_images' into ubuntu-qemu
jlatusek Jun 26, 2024
1310792
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Jun 26, 2024
ea9fdac
Merge branch 'master' of https://github.com/project-chip/connectedhom…
jlatusek Aug 5, 2024
dbab8f0
Restore changes
jlatusek Aug 5, 2024
3fb707b
Restore original requirements
jlatusek Aug 5, 2024
66e5529
Add qemu-ubuntu config removed during merge
jlatusek Aug 7, 2024
8f6dc17
Merge branch 'master' of https://github.com/project-chip/connectedhom…
jlatusek Aug 7, 2024
27d2bf8
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Aug 21, 2024
40d4f8f
Restore submodules
jlatusek Aug 21, 2024
3a5c39d
Update qemu image
jlatusek Aug 21, 2024
13f2d73
Remove ble_wifi arg from shutdown namespace
jlatusek Aug 22, 2024
04b100b
Merge remote-tracking branch 'upstream/master' into ubuntu-qemu
jlatusek Aug 22, 2024
361b07f
Zap regenerate
jlatusek Aug 22, 2024
18d38f5
Fix script issue
jlatusek Aug 22, 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
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
InsertNewlineAtEOF: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

---
Language: ObjC
BasedOnStyle: WebKit
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,68 @@ jobs:
--target tizen-arm-tests-no-ble-no-thread \
build
"

qemu-linux:
name: ubuntu

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-linux-qemu:74
volumes:
- "/tmp/log_output:/tmp/test_logs"
# Required for using KVM
options: --privileged

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: linux

- name: Build Apps
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-chip-tool \
--target linux-x64-all-clusters \
build \
--copy-artifacts-to objdir-clone \
"
# There is no enough space for running the test withouth cleaning the environment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# There is no enough space for running the test withouth cleaning the environment
# There is not enough space for running the test without cleaning the environment

- name: Clean up
run: |
rm -rf out/*/obj
rm -rf out/*/lib
rm -rf out/*/*.map
rm -rf $PW_ENVIRONMENT_ROOT
git clean -fdx --exclude out
# Without all required apps paths provided as argument, script starts to search for them in the current directory and it takes a lot of time.
- name: Run ble commission test using the python parser sending commands to chip-tool
run: |
./scripts/run_in_vm.sh \
"scripts/run_in_build_env.sh 'pip3 install -r scripts/setup/requirements.ble-wifi-testing.txt' && \
./scripts/run_in_build_env.sh \
\"./scripts/tests/run_test_suite.py \
--runner chip_tool_python \
--target TestCommissionerNodeId \
--chip-tool ./out/linux-x64-chip-tool/chip-tool \
run \
--iterations 1 \
--test-timeout-seconds 120 \
--all-clusters-app ./out/linux-x64-all-clusters/chip-all-clusters-app \
--lock-app ./out/linux-x64-lock/chip-lock-app \
--ota-provider-app ./out/linux-x64-ota-provider/chip-ota-provider-app \
--ota-requestor-app ./out/linux-x64-ota-requestor/chip-ota-requestor-app \
--tv-app ./out/linux-x64-tv-app/chip-tv-app \
--bridge-app ./out/linux-x64-bridge/chip-bridge-app \
--lit-icd-app ./out/linux-x64-lit-icd/lit-icd-app \
--microwave-oven-app .out/linux-x64-microwave-oven/chip-microwave-oven-app \
--rvc-app .out/linux-x64-rvc/chip-rvc-app \
--ble-wifi \
\" \
"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ examples/*/esp32/dependencies.lock
# jupyter temporary files
.ipynb_checkpoints

/runner.sh
/runner_status
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ RUN mkdir -p /tmp/workdir/linux \
# Download Ubuntu image for QEMU
&& curl https://cloud-images.ubuntu.com/minimal/releases/noble/release/ubuntu-24.04-minimal-cloudimg-amd64.img \
-o /tmp/workdir/ubuntu-24.04-minimal-cloudimg-amd64.img
# Prepare ubuntu image
# Prepare ubuntu image
RUN qemu-img create -f qcow2 -o preallocation=off $UBUNTU_QEMU_IMG 10G \
&& virt-resize --expand /dev/sda1 /tmp/workdir/ubuntu-24.04-minimal-cloudimg-amd64.img $UBUNTU_QEMU_IMG \
&& guestfish -a $UBUNTU_QEMU_IMG \
Expand Down Expand Up @@ -209,13 +209,14 @@ RUN qemu-img create -f qcow2 -o preallocation=off $UBUNTU_QEMU_IMG 10G \
-append 'console=ttyS0 root=/dev/vda4' \
-netdev user,id=network0 \
-device e1000,netdev=network0,mac=52:54:00:12:34:56 \
-virtfs "local,path=/tmp,mount_tag=host0,security_model=passthrough,id=host0" \
# tmp folder is mounted only to preserve error during boot
-virtfs "local,path=/tmp,mount_tag=host0,security_model=passthrough,id=host0" \
# tmp folder is mounted only to preserve error during boot
&& mkdir -p /chip \
&& rm -rf /opt/ubuntu-qemu/rootfs \
&& echo -n \
"#!/bin/bash\n" \
"grep -q 'rootshell' /proc/cmdline && exit\n" \
"[[ -n \$SSH_CONNECTION ]] && exit \n" \
"if [[ -x /chip/runner.sh ]]; then\n" \
" echo '### RUNNER START ###'\n" \
" cd /chip\n" \
Expand All @@ -227,7 +228,7 @@ RUN qemu-img create -f qcow2 -o preallocation=off $UBUNTU_QEMU_IMG 10G \
" read -r -t 5 -p 'Press ENTER to access root shell...' && exit || echo ' timeout.'\n" \
"fi\n" \
"echo 'Shutting down emulated system...'\n" \
"echo o > /proc/sysrq-trigger\n" \
"systemctl poweroff\n" \
| guestfish --rw -a $UBUNTU_QEMU_IMG -m /dev/sda4:/ upload - /launcher.sh : chmod 0755 /launcher.sh \
&& virt-sparsify --compress ${UBUNTU_QEMU_IMG} ${UBUNTU_QEMU_IMG}.compressed \
&& mv ${UBUNTU_QEMU_IMG}.compressed ${UBUNTU_QEMU_IMG} \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

KERNEL="/opt/ubuntu-qemu/bzImage"
IMG="/opt/ubuntu-qemu/ubuntu-20.04.img"
IMG="/opt/ubuntu-qemu/ubuntu-24.04.img"
ADDITIONAL_ARGS=()
PROJECT_PATH="$(realpath "$(dirname "$0")/../../../../..")"

Expand All @@ -23,7 +23,7 @@ fi
-device virtio-blk-pci,drive=virtio-blk1 \
-drive file="$IMG",id=virtio-blk1,if=none,format=qcow2,readonly=off \
-kernel "$KERNEL" \
-append 'console=ttyS0 mac80211_hwsim.radios=2 root=/dev/vda3' \
-append 'console=ttyS0 mac80211_hwsim.radios=2 root=/dev/vda4' \
-netdev user,id=network0,hostfwd=tcp::2222-:22 \
-device e1000,netdev=network0,mac=52:54:00:12:34:56 \
-virtfs "local,path=$PROJECT_PATH,mount_tag=host0,security_model=passthrough,id=host0" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
_PORT = 9000

if sys.platform == 'linux':
_IP = '10.10.10.5'
_IP = "10.10.12.5"


def _make_url():
Expand Down
36 changes: 36 additions & 0 deletions scripts/run_in_vm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This script executes the command given as an argument after
# activating the given python virtual environment
set -e

PROJECT_PATH=$(dirname "$(dirname "$(realpath "$0")")")

echo "$@" >"$PROJECT_PATH/runner.sh"
chmod +x "$PROJECT_PATH/runner.sh"

echo "CMD:"
cat "$PROJECT_PATH/runner.sh"

"$PROJECT_PATH/integrations/docker/images/stage-2/chip-build-linux-qemu/run-img.sh"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty specific for a "run_in_vm" script. The script needs a better name.


if [ -f "$PROJECT_PATH/runner_status" ]; then
exit "$(cat "$PROJECT_PATH/runner_status")"
else
exit 1
fi
1 change: 1 addition & 0 deletions scripts/setup/requirements.ble-wifi-testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PyGObject
2 changes: 1 addition & 1 deletion scripts/tests/chiptest/accessories.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
PORT = 9000

if sys.platform == 'linux':
IP = '10.10.10.5'
IP = "10.10.12.5"


class AppsRegister:
Expand Down
Loading
Loading