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

Upmerge 2024 11 27 #21

Merged
merged 32 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1e6a737
zephyr: Update PTS workspace to match latest Qualification Studio files
sjanc Oct 15, 2024
c2c4e9c
doc/btp_hap: add HAS Client commands and events
mringwal Sep 12, 2024
bdb937d
pybtp/defs: add HAS Client commands and events
mringwal Sep 12, 2024
42b95b8
layers/hap: track HAUC discovery state
mringwal Sep 12, 2024
56e4776
layers/hap: store preset changed events
mringwal Sep 13, 2024
a9ba561
wid/hap.py: use CAP Unicast client to configure Streaming state
mringwal Sep 10, 2024
d488809
wid/hap: handle both HAS and IAS discovery in hdl_wid_20103
mringwal Sep 9, 2024
91a061f
wid/hap: add missing window handler
mringwal Sep 17, 2024
e563ce2
wid/hap: add wid handler for eatt
mringwal Sep 19, 2024
c0dd70b
doc/btp_hap: improve documentation
mringwal Oct 21, 2024
325aa97
Add PBP
mringwal Jul 8, 2024
ecca549
Added python venv to gitignore
Thalley Oct 22, 2024
0d872ee
Add .vscode to gitignore
Thalley Oct 22, 2024
9a1b435
Add tmp to gitignore
Thalley Oct 24, 2024
c233a51
wid: tmap: Use raw string for regex
sjanc Oct 24, 2024
7e33c05
zephyr: mesh: Fix missing MBTM and DFUM profiles
sjanc Oct 25, 2024
8c10e18
csip: Add CSIP/CL/SP/BV-07-C to list of tests for CSIP discovery
Thalley Nov 5, 2024
6a5f105
Redefine services as hex instead of decimal
Thalley Nov 5, 2024
057e5af
Log BTP headers as hex
Thalley Nov 5, 2024
3b80ee2
bot/zephyr: Use EXTRA_CONF_FILE instead of OVERLAY_CONFIG
sjanc Nov 5, 2024
fef6299
cap: Register TBS to have 2 CCIDs registered
Thalley Nov 6, 2024
ef21e64
doc: Define service IDs as hex
sjanc Nov 5, 2024
6499091
pybtp: Fix BTP_SERVICE_ID_PBP value
sjanc Nov 5, 2024
73837dd
errata: Add Request ID 147314 for CSIP and more
Thalley Nov 4, 2024
1ebfe16
server: Add workaround for PTS issue 145370
mkasenberg Oct 10, 2024
06d7c00
cron: Add retry to _restart_processes
mkasenberg Oct 28, 2024
65092c6
client: adjust exception logging
piotrnarajowski Nov 14, 2024
9ff0617
client: ignore retry param for MISSING WID ERROR
piotrnarajowski Nov 14, 2024
ca4acba
errata: Add list of CAP tests failing when PTS dongle crashes
Thalley Nov 8, 2024
0879a4e
zephyr: Fix cap.hdl_wid_312 to use cap unicast stop
Thalley Oct 10, 2024
8c0e82a
zephyr: boards: adapt 53/54h for sysbuild configs
AyturkDuzen Nov 21, 2024
f6b7006
zephyr: boards: make 5340_hci_ipc_* generic config
AyturkDuzen Nov 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
*~
*.pyc
*.log
tmp

*.xlsx
*.zip
*.db
*/client_secret.json
*/credentials.json
autopts/bot/config.py

venv
.venv

.vscode
2 changes: 1 addition & 1 deletion autopts/bot/zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def apply_config(self, args, config, value):

configs.append(name)

# The order is used in the -DOVERLAY_CONFIG="<overlay1>;<...>" option.
# The order is used in the -DEXTRA_CONF_FILE="<overlay1>;<...>" option.
overlays = ';'.join(configs)

log("TTY path: %s" % args.tty_file)
Expand Down
11 changes: 7 additions & 4 deletions autopts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def run_test_cases(ptses, test_case_instances, args, stats, **kwargs):
if repeat_until_failed and status == 'PASS':
continue

if (status == 'PASS' and not args.stress_test) or \
if (status in ('PASS', 'MISSING WID ERROR') and not args.stress_test) or \
stats.run_count == retry_limit:
if stats.db:
stats.db.update_statistics(test_case, duration, status)
Expand Down Expand Up @@ -1361,9 +1361,12 @@ def sigint_handler(sig, frame):
signal.signal(signal.SIGINT, sigint_handler)

return self.main(args)
except BaseException as e: # Ctrl-C
if not isinstance(e, KeyboardInterrupt):
logging.exception(e)
except BaseException as e:
if not isinstance(e, KeyboardInterrupt): # Ctrl-C
if e.code != 0:
# Exit with traceback
logging.exception(e)

set_global_end()
self.cleanup()
raise
Expand Down
20 changes: 20 additions & 0 deletions autopts/ptscontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,26 @@ def run_test_case(self, project_name, test_case_name):
self._pts_logger.set_test_case_name(test_case_name)
self._pts_sender.reopen()

# Workaround for PTS issue 145370.
# PTS server can detect that the PTS dongle had been corrupted
# by calling GetPTSBluetoothAddress() before test case started.
address = None
for i in range(10):
try:
address = self._pts.GetPTSBluetoothAddress()
log(f"GetPTSBluetoothAddress(): {address}")
if address:
break
except Exception as e:
log(e)
finally:
# The dongle verification should take less than 100ms,
# but it might take longer on a slow VM.
time.sleep(float(os.environ.get('GLOBAL_DONGLE_INIT_DELAY')))

if not address:
raise Exception("Bluetooth address not available")

self._pts.RunTestCase(project_name, test_case_name)

err = self._pts_logger.get_test_case_status(timeout=30)
Expand Down
2 changes: 1 addition & 1 deletion autopts/ptsprojects/boards/nrf52_wsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):

cmd = ['west', 'build', '-p', 'auto', '-b', board]
if conf_file and conf_file != 'default' and conf_file != 'prj.conf':
cmd.extend(('--', '-DOVERLAY_CONFIG=\'{}\''.format(conf_file)))
cmd.extend(('--', '-DEXTRA_CONF_FILE=\'{}\''.format(conf_file)))

shell = True
if sys.platform == 'win32':
Expand Down
10 changes: 5 additions & 5 deletions autopts/ptsprojects/boards/nrf53.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):
check_call('rm -rf build/'.split(), cwd=tester_dir)
check_call('rm -rf build/'.split(), cwd=controller_dir)

bttester_overlay = 'nrf5340_hci_ipc.conf'
bttester_overlay = 'hci_ipc.conf'

if conf_file and conf_file != 'default' and conf_file != 'prj.conf':
bttester_overlay += f';{conf_file}'

cmd = ['west', 'build', '-b', board, '--', f'-DOVERLAY_CONFIG=\'{bttester_overlay}\'']
cmd = ['west', 'build', '--no-sysbuild', '-b', board, '--', f'-DEXTRA_CONF_FILE=\'{bttester_overlay}\'']
check_call(cmd, cwd=tester_dir)
check_call(['west', 'flash', '--skip-rebuild', '--recover', '-i', debugger_snr], cwd=tester_dir)

cmd = ['west', 'build', '-b', 'nrf5340dk/nrf5340/cpunet', '--',
f'-DOVERLAY_CONFIG=\'nrf5340_cpunet_iso-bt_ll_sw_split.conf;'
f'../../../tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf\'']
cmd = ['west', 'build', '--no-sysbuild', '-b', 'nrf5340dk/nrf5340/cpunet', '--',
f'-DEXTRA_CONF_FILE=\'nrf5340_cpunet_iso-bt_ll_sw_split.conf;'
f'../../../tests/bluetooth/tester/hci_ipc_cpunet.conf\'']
check_call(cmd, cwd=controller_dir)
check_call(['west', 'flash', '--skip-rebuild', '-i', debugger_snr], cwd=controller_dir)
4 changes: 2 additions & 2 deletions autopts/ptsprojects/boards/nrf53_appcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):

check_call('rm -rf build/'.split(), cwd=tester_dir)

bttester_overlay = 'nrf5340_hci_ipc.conf'
bttester_overlay = 'hci_ipc.conf'

if conf_file and conf_file != 'default' and conf_file != 'prj.conf':
bttester_overlay += f';{conf_file}'

cmd = ['west', 'build', '-b', board, '--', f'-DOVERLAY_CONFIG=\'{bttester_overlay}\'']
cmd = ['west', 'build', '--no-sysbuild', '-b', board, '--', f'-DEXTRA_CONF_FILE=\'{bttester_overlay}\'']
check_call(cmd, cwd=tester_dir)
check_call(['west', 'flash', '--skip-rebuild', '--recover', '-i', debugger_snr], cwd=tester_dir)
10 changes: 5 additions & 5 deletions autopts/ptsprojects/boards/nrf53_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def build_and_flash_core(zephyr_wd, build_dir, board, debugger_snr, configs, rec
overlay = '-- -DCMAKE_C_FLAGS="-Werror"'
for conf in configs:
overlay += f' -D{conf}'
cmd = ['west', 'build', '-b', board]
cmd = ['west', 'build', '--no-sysbuild', '-b', board]
cmd.extend(overlay.split())
check_call(cmd, cwd=build_dir)

Expand Down Expand Up @@ -57,7 +57,7 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):

app_core_configs = []
if conf_file and conf_file != 'default' and conf_file != 'prj.conf':
app_core_configs = [f'OVERLAY_CONFIG=\'{conf_file}\'']
app_core_configs = [f'EXTRA_CONF_FILE=\'{conf_file}\'']

build_and_flash_core(zephyr_wd,
source_dir,
Expand All @@ -68,11 +68,11 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):

config_dir_net = os.getenv("AUTOPTS_SOURCE_DIR_NET")
if config_dir_net is None:
net_core_configs = [f'OVERLAY_CONFIG=\'nrf5340_cpunet_iso-bt_ll_sw_split.conf;'
f'../../../tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf\'']
net_core_configs = [f'EXTRA_CONF_FILE=\'nrf5340_cpunet_iso-bt_ll_sw_split.conf;'
f'../../../tests/bluetooth/tester/hci_ipc_cpunet.conf\'']
else:
conf_path = os.path.join(zephyr_wd, config_dir_net, 'hci_ipc.conf')
net_core_configs = [f'OVERLAY_CONFIG=\'{conf_path}\'']
net_core_configs = [f'EXTRA_CONF_FILE=\'{conf_path}\'']

build_and_flash_core(zephyr_wd,
os.path.join('samples', 'bluetooth', 'hci_ipc'),
Expand Down
4 changes: 2 additions & 2 deletions autopts/ptsprojects/boards/nrf54h.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):

check_call('rm -rf build/'.split(), cwd=tester_dir)

cmd = ['west', 'build', '-p', 'auto', '-b', board]
cmd = ['west', 'build', '--sysbuild', '-p', 'auto', '-b', board]
if conf_file and conf_file not in ['default', 'prj.conf']:
if 'audio' in conf_file:
conf_file += ';overlay-le-audio-ctlr.conf'
cmd.extend(('--', f'-DOVERLAY_CONFIG=\'{conf_file}\''))
cmd.extend(('--', f'-DEXTRA_CONF_FILE=\'{conf_file}\''))

check_call(cmd, cwd=tester_dir)
check_call(['west', 'flash', '--skip-rebuild',
Expand Down
2 changes: 1 addition & 1 deletion autopts/ptsprojects/boards/nrf5x.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def build_and_flash(zephyr_wd, board, debugger_snr, conf_file=None, *args):
if conf_file and conf_file not in ['default', 'prj.conf']:
if 'audio' in conf_file:
conf_file += ';overlay-le-audio-ctlr.conf'
cmd.extend(('--', f'-DOVERLAY_CONFIG=\'{conf_file}\''))
cmd.extend(('--', f'-DEXTRA_CONF_FILE=\'{conf_file}\''))

check_call(cmd, cwd=tester_dir)
check_call(['west', 'flash', '--skip-rebuild', '--recover',
Expand Down
1 change: 1 addition & 0 deletions autopts/ptsprojects/stack/layers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
from .gtbs import *
from .tmap import *
from .ots import *
from .pbp import *
# GENERATOR append 1
11 changes: 11 additions & 0 deletions autopts/ptsprojects/stack/layers/hap.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ def __init__(self):
self.hearing_aid_features_handle = None
self.hearing_aid_control_point_handle = None
self.active_preset_index_handle = None
self.discover_started = False
self.discovery_completed = False

def __init__(self):
self.peers = {}
self.event_queues = {
defs.HAP_EV_IAC_DISCOVERY_COMPLETE: [],
defs.HAP_EV_HAUC_DISCOVERY_COMPLETE: [],
defs.HAP_EV_PRESET_CHANGED: [],
}
self.event_handlers = {
defs.HAP_EV_HAUC_DISCOVERY_COMPLETE: self._ev_hauc_discovery_complete,
Expand Down Expand Up @@ -73,3 +76,11 @@ def _ev_hauc_discovery_complete(self, addr_type, addr, status,
peer.hearing_aid_features_handle = hearing_aid_features_handle
peer.hearing_aid_control_point_handle = hearing_aid_control_point_handle
peer.active_preset_index_handle = active_preset_index_handle
peer.discovery_completed = (status == defs.BTP_STATUS_SUCCESS)

def wait_preset_changed_ev(self, addr_type, addr, timeout, change_id, remove=True):
return wait_for_queue_event(
self.event_queues[defs.HAP_EV_PRESET_CHANGED],
lambda _addr_type, _addr, _change_id, *_:
(addr_type, addr, change_id) == (_addr_type, _addr, _change_id),
timeout, remove)
33 changes: 33 additions & 0 deletions autopts/ptsprojects/stack/layers/pbp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# auto-pts - The Bluetooth PTS Automation Framework
#
# Copyright (c) 2024, BlueKitchen GmbH.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#

from autopts.ptsprojects.stack.common import wait_for_queue_event
from autopts.pybtp import defs


class PBP:
def __init__(self):
self.event_queues = {
defs.PBP_EV_PUBLIC_BROADCAST_ANNOUNCEMENT_FOUND: [],
}

def event_received(self, event_type, event_data):
self.event_queues[event_type].append(event_data)

def wait_public_broadcast_event_found_ev(self, addr_type, addr, broadcast_name, timeout, remove=True):
return wait_for_queue_event(
self.event_queues[defs.PBP_EV_PUBLIC_BROADCAST_ANNOUNCEMENT_FOUND],
lambda ev: (addr_type, addr, broadcast_name) == (ev['addr_type'], ev['addr'], ev['broadcast_name']),
timeout, remove)
8 changes: 8 additions & 0 deletions autopts/ptsprojects/stack/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"TBS": 1 << defs.BTP_SERVICE_ID_TBS,
"TMAP": 1 << defs.BTP_SERVICE_ID_TMAP,
"OTS": 1 << defs.BTP_SERVICE_ID_OTS,
"PBP": 1 << defs.BTP_SERVICE_ID_PBP,
# GENERATOR append 1
}

Expand Down Expand Up @@ -87,6 +88,7 @@ def __init__(self):
self.gtbs = None
self.tmap = None
self.ots = None
self.pbp = None
# GENERATOR append 2

def is_svc_supported(self, svc):
Expand Down Expand Up @@ -186,6 +188,9 @@ def tmap_init(self):
def ots_init(self):
self.ots = OTS()

def pbp_init(self):
self.pbp = PBP()

# GENERATOR append 3

def cleanup(self):
Expand Down Expand Up @@ -267,6 +272,9 @@ def cleanup(self):
if self.ots:
self.ots_init()

if self.pbp:
self.pbp_init()

# GENERATOR append 4


Expand Down
3 changes: 2 additions & 1 deletion autopts/ptsprojects/zephyr/cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ def set_addr(addr):
TestFunc(stack.aics_init),
TestFunc(btp.core_reg_svc_vocs),
TestFunc(stack.vocs_init),
# Enable GMCS to have a second CCID in Zephyr stack
# Enable GMCS and TBS to have 2 CCIDs in Zephyr stack which is required by some tests
TestFunc(btp.core_reg_svc_gmcs),
TestFunc(btp.core_reg_svc_tbs),
TestFunc(stack.gmcs_init),
# Enable CSIP to have access to Start Ordered Access
# procedure BTP command
Expand Down
1 change: 1 addition & 0 deletions autopts/pybtp/btp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@
from autopts.pybtp.btp.tbs import *
from autopts.pybtp.btp.tmap import *
from autopts.pybtp.btp.ots import *
from autopts.pybtp.btp.pbp import *
# GENERATOR append 1
11 changes: 11 additions & 0 deletions autopts/pybtp/btp/btp.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def read_supp_svcs():
defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_TMAP),
"ots_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE,
defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_OTS),
"pbp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE,
defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_PBP),
# GENERATOR append 4
"read_supp_cmds": (defs.BTP_SERVICE_ID_CORE,
defs.CORE_READ_SUPPORTED_COMMANDS,
Expand Down Expand Up @@ -704,6 +706,13 @@ def core_reg_svc_ots():
iutctl.btp_socket.send_wait_rsp(*CORE['ots_reg'])


def core_reg_svc_pbp():
logging.debug("%s", core_reg_svc_pbp.__name__)

iutctl = get_iut()
iutctl.btp_socket.send_wait_rsp(*CORE['pbp_reg'])


# GENERATOR append 1

def core_reg_svc_rsp_succ():
Expand Down Expand Up @@ -805,6 +814,7 @@ def init(get_iut_method):
from .tbs import TBS_EV
from .tmap import TMAP_EV
from .ots import OTS_EV
from .pbp import PBP_EV
# GENERATOR append 2

from autopts.pybtp.iutctl_common import set_event_handler
Expand Down Expand Up @@ -844,6 +854,7 @@ def event_handler(hdr, data):
defs.BTP_SERVICE_ID_TBS: (TBS_EV, stack.tbs),
defs.BTP_SERVICE_ID_TMAP: (TMAP_EV, stack.tmap),
defs.BTP_SERVICE_ID_OTS: (OTS_EV, stack.ots),
defs.BTP_SERVICE_ID_PBP: (PBP_EV, stack.pbp),
# GENERATOR append 3
}

Expand Down
10 changes: 9 additions & 1 deletion autopts/pybtp/btp/cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,19 @@ def cap_unicast_audio_update(metadata_tuple):
cap_command_rsp_succ()


def cap_unicast_audio_stop(cig_id):
BTP_CAP_UNICAST_AUDIO_STOP_FLAG_RELEASE = 0b00000001

def cap_unicast_audio_stop(cig_id, release):
logging.debug(f"{cap_unicast_audio_stop.__name__}")

data = struct.pack('B', cig_id)

flags = 0x00
if release:
flags |= BTP_CAP_UNICAST_AUDIO_STOP_FLAG_RELEASE

data += struct.pack('?', flags)

iutctl = get_iut()
iutctl.btp_socket.send(*CAP['unicast_audio_stop'], data=data)

Expand Down
Loading