Mocked BLE-WiFi commissioning test (#39454)
* Add qemu testing to CI
* Use BlueZ and WpaSupplicant D-Bus mocks for testing
* Add help message for --ble-adapter chip-tool option
* Add BlueZoo to scripts Python requirements
* Add BLE-WiFi commissioning test to CI
* Fix comment issues
* Run Linux-specific code only on Linux
* Disable TSAN for BLE-WiFi CI test
* Add review suggestions
* Fix WPA supplicant AP association mock logic
* [Linux] Improve isolated test network management
* Restyled by isort
* Fix workflow syntax issue
* Apply comment suggestions
* [Linux] Fix SIGSEGV when returning error from call handler
The call handler needs to return TRUE (G_DBUS_METHOD_INVOCATION_HANDLED)
if the call was handed. Returning FALSE means that the call will be
handled internally by glib. In our scenario returning FALSE results in
handling call twice which leads to double-free.
* Wait for the BLE adapters to be ready
* Enable verbose output for CI debugging
* Enforce bluezoo >= 1.0.1
* Update constraints
* Remove debug log level from test command
---------
Co-authored-by: Jakub Latusek <j.latusek@samsung.com>
Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Andrei Litvin <andy314@gmail.com>
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index a29d08e..88e4c9f 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -48,7 +48,7 @@
strategy:
matrix:
- build_variant: [no-ble-no-shell-tsan-clang]
+ build_variant: [no-shell-tsan-clang]
chip_tool: [""]
env:
BUILD_VARIANT: ${{matrix.build_variant}}
@@ -358,6 +358,25 @@
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
"
+ - name: Run BLE-WiFi commissioning test
+ env:
+ # Disable TSAN bug reporting, as it reports tons of (hopefully) false positives.
+ # The reason for that is BlueZ and WPA supplicant integration which involves GIO
+ # globals (glib internals) that TSAN does not understand...
+ TSAN_OPTIONS: report_bugs=0
+ run: |
+ ./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_VARIANT}-${BUILD_VARIANT}/chip-tool \
+ run \
+ --iterations 1 \
+ --test-timeout-seconds 120 \
+ --all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
+ --ble-wifi \
+ "
+
- name: Run Tests using matter-repl (skip slow)
if: github.event_name == 'pull_request'
run: |
diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt
index fc3cdbc..b778451 100644
--- a/scripts/setup/constraints.txt
+++ b/scripts/setup/constraints.txt
@@ -257,7 +257,7 @@
# via
# -r requirements.all.txt
# mypy-protobuf
-typing-extensions==4.6.1
+typing-extensions==4.8.0
# via mypy
urllib3==1.26.14
# via requests
diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py
index 033cb04..1eb0814 100644
--- a/scripts/tests/chiptest/__init__.py
+++ b/scripts/tests/chiptest/__init__.py
@@ -18,13 +18,26 @@
import logging
import os
import subprocess
+import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Iterator, Set
-from . import linux, runner
+from . import runner
from .test_definition import ApplicationPaths, TestDefinition, TestTag, TestTarget
+__all__ = [
+ "TestTarget",
+ "TestDefinition",
+ "ApplicationPaths",
+ "linux",
+ "runner",
+]
+
+# If running on Linux platform load the Linux specific code.
+if sys.platform == "linux":
+ from . import linux
+
_DEFAULT_CHIP_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "..", ".."))
_YAML_TEST_SUITE_PATH = os.path.abspath(
@@ -420,13 +433,3 @@
for test in tests_with_command(chip_tool, is_manual=True):
yield test
-
-
-__all__ = [
- "TestTarget",
- "TestDefinition",
- "AllTests",
- "ApplicationPaths",
- "linux",
- "runner",
-]
diff --git a/scripts/tests/chiptest/linux.py b/scripts/tests/chiptest/linux.py
index 1ee8220..208b5c2 100644
--- a/scripts/tests/chiptest/linux.py
+++ b/scripts/tests/chiptest/linux.py
@@ -18,12 +18,17 @@
Handles linux-specific functionality for running test cases
"""
+import asyncio
import logging
import os
+import pathlib
import subprocess
import sys
+import threading
import time
+import sdbus
+
from .test_definition import ApplicationPaths
test_environ = os.environ.copy()
@@ -68,8 +73,8 @@
"ip netns add tool",
# Create links for switch to net connections
- "ip link add {app_link_name} type veth peer name eth-app-switch",
- "ip link add {tool_link_name} type veth peer name eth-tool-switch",
+ "ip link add {app_link_name} type veth peer name {app_link_name}-switch",
+ "ip link add {tool_link_name} type veth peer name {tool_link_name}-switch",
"ip link add eth-ci type veth peer name eth-ci-switch",
# Link the connections together
@@ -79,8 +84,8 @@
# Bridge all the connections together.
"ip link add name br1 type bridge",
"ip link set br1 up",
- "ip link set eth-app-switch master br1",
- "ip link set eth-tool-switch master br1",
+ "ip link set {app_link_name}-switch master br1",
+ "ip link set {tool_link_name}-switch master br1",
"ip link set eth-ci-switch master br1",
# Create link between virtual host 'tool' and the test runner
@@ -94,7 +99,7 @@
"ip netns exec app ip addr add 10.10.10.1/24 dev {app_link_name}",
"ip netns exec app ip link set dev {app_link_name} up",
"ip netns exec app ip link set dev lo up",
- "ip link set dev eth-app-switch up",
+ "ip link set dev {app_link_name}-switch up",
# Force IPv6 to use ULAs that we control.
"ip netns exec app ip -6 addr flush {app_link_name}",
"ip netns exec app ip -6 a add fd00:0:1:1::3/64 dev {app_link_name}",
@@ -106,7 +111,7 @@
"ip netns exec tool ip addr add 10.10.10.2/24 dev {tool_link_name}",
"ip netns exec tool ip link set dev {tool_link_name} up",
"ip netns exec tool ip link set dev lo up",
- "ip link set dev eth-tool-switch up",
+ "ip link set dev {tool_link_name}-switch up",
# Force IPv6 to use ULAs that we control.
"ip netns exec tool ip -6 addr flush {tool_link_name}",
"ip netns exec tool ip -6 a add fd00:0:1:1::2/64 dev {tool_link_name}",
@@ -122,8 +127,8 @@
"ip link delete br1",
"ip link delete eth-ci-switch",
- "ip link delete eth-tool-switch",
- "ip link delete eth-app-switch",
+ "ip link delete {tool_link_name}-switch",
+ "ip link delete {app_link_name}-switch",
"ip netns del tool",
"ip netns del app",
@@ -193,6 +198,187 @@
self.run(command)
+class DBusTestSystemBus(subprocess.Popen):
+ """Run a dbus-daemon in a subprocess as a test system bus."""
+
+ SOCKET = pathlib.Path(f"/tmp/chip-dbus-{os.getpid()}")
+ ADDRESS = f"unix:path={SOCKET}"
+
+ def __init__(self):
+ super().__init__(["dbus-daemon", "--session", "--print-address", "--address", self.ADDRESS],
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+ os.environ["DBUS_SYSTEM_BUS_ADDRESS"] = self.ADDRESS
+ # Wait for the bus to start (it will print the address to stdout).
+ self.stdout.readline()
+
+ def terminate(self):
+ super().terminate()
+ self.SOCKET.unlink(True)
+ self.wait()
+
+
+class BluetoothMock(subprocess.Popen):
+ """Run a BlueZ mock server in a subprocess."""
+
+ # The MAC addresses of the virtual Bluetooth adapters.
+ ADAPTERS = ["00:00:00:11:11:11", "00:00:00:22:22:22"]
+
+ def __forward_stderr(self):
+ for line in self.stderr:
+ if "adapter[1][00:00:00:22:22:22]" in line:
+ self.event.set()
+ logging.debug("%s", line.strip())
+
+ def __init__(self):
+ adapters = [f"--adapter={mac}" for mac in self.ADAPTERS]
+ super().__init__(["bluezoo", "--auto-enable"] + adapters,
+ stderr=subprocess.PIPE, text=True)
+ self.event = threading.Event()
+ threading.Thread(target=self.__forward_stderr, daemon=True).start()
+ # Wait for the adapters to be ready.
+ self.event.wait()
+
+ def terminate(self):
+ super().terminate()
+ self.wait()
+
+
+class WpaSupplicantMock(threading.Thread):
+ """Mock server for WpaSupplicant D-Bus API."""
+
+ class Wpa(sdbus.DbusInterfaceCommonAsync,
+ interface_name="fi.w1.wpa_supplicant1"):
+ path = "/fi/w1/wpa_supplicant1"
+
+ @sdbus.dbus_method_async("a{sv}", "o")
+ async def CreateInterface(self, args) -> str:
+ # Always return our pre-defined mock interface.
+ return WpaSupplicantMock.WpaInterface.path
+
+ @sdbus.dbus_method_async("s", "o")
+ async def GetInterface(self, name) -> str:
+ # Always return our pre-defined mock interface.
+ return WpaSupplicantMock.WpaInterface.path
+
+ class WpaInterface(sdbus.DbusInterfaceCommonAsync,
+ interface_name="fi.w1.wpa_supplicant1.Interface"):
+ path = "/fi/w1/wpa_supplicant1/Interfaces/1"
+ state = "disconnected"
+ current_network = "/"
+
+ def __init__(self, mock):
+ super().__init__()
+ self.mock = mock
+
+ @sdbus.dbus_method_async("s")
+ async def AutoScan(self, arg):
+ pass
+
+ @sdbus.dbus_method_async("a{sv}")
+ async def Scan(self, args):
+ pass
+
+ @sdbus.dbus_method_async("a{sv}", "o")
+ async def AddNetwork(self, args):
+ # Always return our pre-defined mock network.
+ return WpaSupplicantMock.WpaNetwork.path
+
+ @sdbus.dbus_method_async("o")
+ async def SelectNetwork(self, path):
+ async def associate():
+ # Mock AP association process.
+ await self.State.set_async("associating")
+ await self.State.set_async("associated")
+ self.mock.networking.setup_app_link_up()
+ await self.State.set_async("completed")
+ await self.CurrentNetwork.set_async(path)
+ asyncio.create_task(associate())
+
+ @sdbus.dbus_method_async("o")
+ async def RemoveNetwork(self, path):
+ await self.CurrentNetwork.set_async("/")
+
+ @sdbus.dbus_method_async()
+ async def RemoveAllNetworks(self):
+ await self.CurrentNetwork.set_async("/")
+
+ @sdbus.dbus_method_async()
+ async def Disconnect(self):
+ pass
+
+ @sdbus.dbus_method_async()
+ async def SaveConfig(self):
+ pass
+
+ @sdbus.dbus_property_async("s")
+ def State(self):
+ return self.state
+
+ @State.setter_private
+ def State_setter(self, value):
+ self.state = value
+
+ @sdbus.dbus_property_async("o")
+ def CurrentNetwork(self):
+ return self.current_network
+
+ @CurrentNetwork.setter_private
+ def CurrentNetwork_setter(self, value):
+ self.current_network = value
+
+ @sdbus.dbus_property_async("s")
+ def CurrentAuthMode(self):
+ return "WPA2-PSK"
+
+ class WpaNetwork(sdbus.DbusInterfaceCommonAsync,
+ interface_name="fi.w1.wpa_supplicant1.Network"):
+ path = "/fi/w1/wpa_supplicant1/Interfaces/1/Networks/1"
+ enabled = False
+
+ def __init__(self, mock):
+ super().__init__()
+ self.mock = mock
+
+ @sdbus.dbus_property_async("a{sv}")
+ def Properties(self):
+ return {"ssid": ("s", self.mock.ssid)}
+
+ @sdbus.dbus_property_async("b")
+ def Enabled(self):
+ return self.enabled
+
+ @Enabled.setter
+ def Enabled_setter(self, value):
+ self.enabled = value
+
+ async def startup(self):
+ # Attach to the system bus which in fact is our mock bus.
+ bus = sdbus.sd_bus_open_system()
+ sdbus.set_default_bus(bus)
+ # Acquire name on the system bus.
+ await bus.request_name_async("fi.w1.wpa_supplicant1", 0)
+ # Expose interfaces of our service.
+ self.wpa = WpaSupplicantMock.Wpa()
+ self.wpa.export_to_dbus(self.wpa.path)
+ self.iface = WpaSupplicantMock.WpaInterface(self)
+ self.iface.export_to_dbus(self.iface.path)
+ self.net = WpaSupplicantMock.WpaNetwork(self)
+ self.net.export_to_dbus(self.net.path)
+
+ def __init__(self, ssid: str, password: str, ns: IsolatedNetworkNamespace):
+ self.ssid = ssid
+ self.password = password
+ self.networking = ns
+ self.loop = asyncio.new_event_loop()
+ self.loop.run_until_complete(self.startup())
+ super().__init__(target=self.loop.run_forever)
+ self.start()
+
+ def terminate(self):
+ self.loop.call_soon_threadsafe(self.loop.stop)
+ self.join()
+
+
def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths:
"""
Returns a copy of paths with updated command arrays to invoke the
diff --git a/scripts/tests/chiptest/runner.py b/scripts/tests/chiptest/runner.py
index 852aa45..d8fe0be 100644
--- a/scripts/tests/chiptest/runner.py
+++ b/scripts/tests/chiptest/runner.py
@@ -26,7 +26,7 @@
class LogPipe(threading.Thread):
"""Create PTY-based PIPE for IPC.
- Python provides a built-in mechanism for creating comunication PIPEs for
+ Python provides a built-in mechanism for creating communication PIPEs for
subprocesses spawned with Popen(). However, created PIPEs will most likely
enable IO buffering in the spawned process. In order to trick such process
to flush its streams immediately, we are going to create a PIPE based on
diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py
index 925f9c6..da8ed19 100644
--- a/scripts/tests/chiptest/test_definition.py
+++ b/scripts/tests/chiptest/test_definition.py
@@ -26,11 +26,14 @@
from enum import Enum, auto
TEST_NODE_ID = '0x12344321'
+TEST_DISCRIMINATOR = '3840'
+TEST_PASSCODE = '20202021'
+TEST_SETUP_QR_CODE = 'MT:-24J042C00KA0648G00'
class App:
- def __init__(self, runner, command):
+ def __init__(self, runner, command: typing.List[str]):
self.process = None
self.outpipe = None
self.runner = runner
@@ -61,8 +64,7 @@
self.options = options
# Make sure to assign self.process before we do any operations that
# might fail, so attempts to kill us on failure actually work.
- self.process, self.outpipe, errpipe = self.__startServer(
- self.runner, self.command)
+ self.process, self.outpipe, _ = self.__startServer()
self.waitForAnyAdvertisement()
self.__updateSetUpCode()
with self.cv_stopped:
@@ -118,12 +120,12 @@
return code
# When the server is manually stopped, process waiting is
# overridden so the other processes that depends on the
- # accessory beeing alive does not stop.
+ # accessory being alive does not stop.
while self.stopped:
self.cv_stopped.wait()
- def __startServer(self, runner, command):
- app_cmd = command + ['--interface-id', str(-1)]
+ def __startServer(self):
+ app_cmd = self.command + ['--interface-id', str(-1)]
if not self.options:
logging.debug('Executing application under test with default args')
@@ -134,7 +136,7 @@
app_cmd = app_cmd + [key, value]
if key == '--KVS':
self.kvsPathSet.add(value)
- return runner.RunSubprocess(app_cmd, name='APP ', wait=False)
+ return self.runner.RunSubprocess(app_cmd, name='APP ', wait=False)
def __waitFor(self, waitForString, server_process, outpipe, timeoutInSeconds=10):
logging.debug('Waiting for %s' % waitForString)
@@ -348,7 +350,10 @@
return ", ".join([t.to_s() for t in self.tags])
def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
- timeout_seconds: typing.Optional[int], dry_run=False, test_runtime: TestRunTime = TestRunTime.CHIP_TOOL_PYTHON):
+ timeout_seconds: typing.Optional[int], dry_run=False,
+ test_runtime: TestRunTime = TestRunTime.CHIP_TOOL_PYTHON,
+ ble_controller_app: typing.Optional[int] = None,
+ ble_controller_tool: typing.Optional[int] = None):
"""
Executes the given test case using the provided runner for execution.
"""
@@ -388,23 +393,26 @@
"don't know which application to run")
if not dry_run:
- for path, key in paths.items_with_key():
+ for command, key in paths.items_with_key():
# Do not add chip-tool or matter-repl-yaml-tester-cmd to the register
- if path == paths.chip_tool or path == paths.matter_repl_yaml_tester_cmd or path == paths.chip_tool_with_python_cmd:
+ if (command == paths.chip_tool
+ or command == paths.matter_repl_yaml_tester_cmd
+ or command == paths.chip_tool_with_python_cmd):
continue
# Skip items where we don't actually have a path. This can
# happen if the relevant application does not exist. It's
# non-fatal as long as we are not trying to run any tests that
# need that application.
- if path[-1] is None:
+ if command[-1] is None:
continue
# For the app indicated by self.target, give it the 'default' key to add to the register
- if path == target_app:
+ if command == target_app:
key = 'default'
-
- app = App(runner, path)
+ if ble_controller_app is not None:
+ command += ["--ble-controller", str(ble_controller_app), "--wifi"]
+ app = App(runner, command)
# Add the App to the register immediately, so if it fails during
# start() we will be able to clean things up properly.
apps_register.add(key, app)
@@ -415,7 +423,7 @@
# It may sometimes be useful to run the same app multiple times depending
# on the implementation. So this code creates a duplicate entry but with a different
# key.
- app = App(runner, path)
+ app = App(runner, command)
apps_register.add(f'{key}#2', app)
app.factoryReset()
@@ -435,23 +443,31 @@
setupCode = app.setupCode
if test_runtime == TestRunTime.MATTER_REPL_PYTHON:
- matter_repl_yaml_tester_cmd = paths.matter_repl_yaml_tester_cmd
- python_cmd = matter_repl_yaml_tester_cmd + \
- ['--setup-code', setupCode] + ['--yaml-path', self.run_name] + ["--pics-file", pics_file]
+ python_cmd = (paths.matter_repl_yaml_tester_cmd
+ + ['--setup-code', setupCode]
+ + ['--yaml-path', self.run_name]
+ + ["--pics-file", pics_file])
if dry_run:
logging.info(" ".join(python_cmd))
else:
runner.RunSubprocess(python_cmd, name='MATTER_REPL_YAML_TESTER',
dependencies=[apps_register], timeout_seconds=timeout_seconds)
else:
- pairing_cmd = paths.chip_tool_with_python_cmd + ['pairing', 'code', TEST_NODE_ID, setupCode]
+ pairing_server_args = []
+ if ble_controller_tool is not None:
+ pairing_cmd = paths.chip_tool_with_python_cmd + [
+ "pairing", "code-wifi", TEST_NODE_ID, "MatterAP", "MatterAPPassword", TEST_SETUP_QR_CODE]
+ pairing_server_args = ["--ble-controller", str(ble_controller_tool)]
+ else:
+ pairing_cmd = paths.chip_tool_with_python_cmd + ['pairing', 'code', TEST_NODE_ID, setupCode]
if self.target == TestTarget.LIT_ICD and test_runtime == TestRunTime.CHIP_TOOL_PYTHON:
pairing_cmd += ['--icd-registration', 'true']
test_cmd = paths.chip_tool_with_python_cmd + ['tests', self.run_name] + ['--PICS', pics_file]
server_args = ['--server_path', paths.chip_tool[-1]] + \
['--server_arguments', 'interactive server' +
(' --interface-id -1' if test_runtime == TestRunTime.CHIP_TOOL_PYTHON else '') +
- (' ' if len(tool_storage_args) else '') + ' '.join(tool_storage_args)]
+ (' ' if len(tool_storage_args) else '') + ' '.join(tool_storage_args) +
+ (' ' if len(pairing_server_args) else '') + ' '.join(pairing_server_args)]
pairing_cmd += server_args
test_cmd += server_args
diff --git a/scripts/tests/requirements.txt b/scripts/tests/requirements.txt
index 215d44a..faa48f3 100644
--- a/scripts/tests/requirements.txt
+++ b/scripts/tests/requirements.txt
@@ -1,5 +1,6 @@
# Python requirements for scripts in this location
alive_progress
+bluezoo>=1.0.2; sys_platform == "linux"
click
colorama
coloredlogs
diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py
index 02a13d0..f01ea69 100755
--- a/scripts/tests/run_test_suite.py
+++ b/scripts/tests/run_test_suite.py
@@ -304,11 +304,17 @@
default=0,
show_default=True,
help='Number of tests that are expected to fail in each iteration. Overall test will pass if the number of failures matches this. Nonzero values require --keep-going')
+@click.option(
+ '--ble-wifi',
+ is_flag=True,
+ default=False,
+ show_default=True,
+ help='Use Bluetooth and WiFi mock servers to perform BLE-WiFi commissioning. This option is available on Linux platform only.')
@click.pass_context
def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app,
fabric_bridge_app, tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, network_manager_app,
energy_gateway_app, energy_management_app, closure_app, matter_repl_yaml_tester,
- chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures):
+ chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures, ble_wifi):
if expected_failures != 0 and not keep_going:
logging.exception(f"'--expected-failures {expected_failures}' used without '--keep-going'")
sys.exit(2)
@@ -368,6 +374,9 @@
else:
chip_tool_with_python = paths_finder.get('chiptool.py')
+ if ble_wifi and sys.platform != "linux":
+ raise click.BadOptionUsage("ble-wifi", "Option --ble-wifi is available on Linux platform only")
+
# Command execution requires an array
paths = chiptest.ApplicationPaths(
chip_tool=[context.obj.chip_tool],
@@ -389,9 +398,23 @@
chip_tool_with_python_cmd=['python3'] + [chip_tool_with_python],
)
+ ble_controller_app = None
+ ble_controller_tool = None
+
if sys.platform == 'linux':
ns = chiptest.linux.IsolatedNetworkNamespace(
+ # Do not bring up the app interface link automatically when doing BLE-WiFi commissioning.
+ setup_app_link_up=not ble_wifi,
+ # Change the app link name so the interface will be recognized as WiFi or Ethernet
+ # depending on the commissioning method used.
+ app_link_name='wlx-app' if ble_wifi else 'eth-app',
unshared=context.obj.in_unshare)
+ if ble_wifi:
+ bus = chiptest.linux.DBusTestSystemBus()
+ bluetooth = chiptest.linux.BluetoothMock()
+ wifi = chiptest.linux.WpaSupplicantMock("MatterAP", "MatterAPPassword", ns)
+ ble_controller_app = 0 # Bind app to the first BLE controller
+ ble_controller_tool = 1 # Bind tool to the second BLE controller
paths = chiptest.linux.PathsWithNetworkNamespaces(paths)
logging.info("Each test will be executed %d times" % iterations)
@@ -402,6 +425,10 @@
def cleanup():
apps_register.uninit()
if sys.platform == 'linux':
+ if ble_wifi:
+ wifi.terminate()
+ bluetooth.terminate()
+ bus.terminate()
ns.terminate()
for i in range(iterations):
@@ -426,7 +453,10 @@
logging.info('%-20s - Starting test' % (test.name))
test.Run(
runner, apps_register, paths, pics_file, test_timeout_seconds, context.obj.dry_run,
- test_runtime=context.obj.runtime)
+ test_runtime=context.obj.runtime,
+ ble_controller_app=ble_controller_app,
+ ble_controller_tool=ble_controller_tool,
+ )
if not context.obj.dry_run:
test_end = time.monotonic()
logging.info('%-30s - Completed in %0.2f seconds' %
diff --git a/src/platform/Linux/bluez/BluezObjectManager.cpp b/src/platform/Linux/bluez/BluezObjectManager.cpp
index c11e15c..6071ce9 100644
--- a/src/platform/Linux/bluez/BluezObjectManager.cpp
+++ b/src/platform/Linux/bluez/BluezObjectManager.cpp
@@ -274,9 +274,9 @@
GAutoPtr<GError> err;
mObjectManager.reset(g_dbus_object_manager_client_new_sync(
- mConnection.get(), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/",
- bluez_object_manager_client_get_proxy_type, nullptr /* unused user data in the proxy type func */,
- nullptr /* destroy notify */, nullptr /* cancellable */, &err.GetReceiver()));
+ mConnection.get(), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_SERVICE, "/", bluez_object_manager_client_get_proxy_type,
+ nullptr /* unused user data in the proxy type func */, nullptr /* destroy notify */, nullptr /* cancellable */,
+ &err.GetReceiver()));
VerifyOrReturnError(mObjectManager, CHIP_ERROR_INTERNAL,
ChipLogError(DeviceLayer, "FAIL: Get D-Bus object manager client: %s", err->message));
diff --git a/src/platform/Linux/bluez/Types.h b/src/platform/Linux/bluez/Types.h
index 3c1d60c..826d348 100644
--- a/src/platform/Linux/bluez/Types.h
+++ b/src/platform/Linux/bluez/Types.h
@@ -99,25 +99,8 @@
namespace DeviceLayer {
namespace Internal {
-#define BLUEZ_ADDRESS_SIZE 6 ///< BLE address size (in bytes)
+#define BLUEZ_SERVICE "org.bluez"
#define BLUEZ_PATH "/org/bluez"
-#define BLUEZ_INTERFACE "org.bluez"
-#define ADAPTER_INTERFACE BLUEZ_INTERFACE ".Adapter1"
-#define PROFILE_INTERFACE BLUEZ_INTERFACE ".GattManager1"
-#define ADVERTISING_MANAGER_INTERFACE BLUEZ_INTERFACE ".LEAdvertisingManager1"
-#define SERVICE_INTERFACE BLUEZ_INTERFACE ".GattService1"
-#define CHARACTERISTIC_INTERFACE BLUEZ_INTERFACE ".GattCharacteristic1"
-#define ADVERTISING_INTERFACE BLUEZ_INTERFACE ".LEAdvertisement1"
-#define DEVICE_INTERFACE BLUEZ_INTERFACE ".Device1"
-
-#define BLUEZ_ADV_TYPE_FLAGS 0x01
-#define BLUEZ_ADV_TYPE_SERVICE_DATA 0x16
-
-#define BLUEZ_ADV_FLAGS_LE_LIMITED (1 << 0)
-#define BLUEZ_ADV_FLAGS_LE_DISCOVERABLE (1 << 1)
-#define BLUEZ_ADV_FLAGS_EDR_UNSUPPORTED (1 << 2)
-#define BLUEZ_ADV_FLAGS_LE_EDR_CONTROLLER (1 << 3)
-#define BLUEZ_ADV_FLAGS_LE_EDR_HOST (1 << 4)
} // namespace Internal
} // namespace DeviceLayer