Uh oh!
There was an error while loading. Please reload this page.
Add tests for Bluetooth RFCOMM, HCI and SCO - #132023
Conversation
serhiy-storchaka
commented
Apr 2, 2025
!buildbot FreeBSD |
bedevere-bot
commented
Apr 2, 2025
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 909871a 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132023%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
serhiy-storchaka
commented
Apr 2, 2025
!buildbot BSD |
bedevere-bot
commented
Apr 2, 2025
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 94c9287 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132023%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
serhiy-storchaka
commented
Apr 2, 2025
@furkanonder, could you please test new tests on NetBSD? |
vstinner
commented
Apr 3, 2025
The problem is that tests are skipped on FreeBSD buildbots since they cannot create bluetooth sockets. Extract of FreeBSD 15
socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)I had the same problem on my FreeBSD VM to test my recent socket changes. I don't know why I cannot create bluetooth sockets. |
vstinner
commented
Apr 3, 2025
FreeBSD documentation on Bluetooth: https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-bluetooth |
vstinner
left a comment
There was a problem hiding this comment.
LGTM. I don't understand bluetooth, but I trust the CI: if tests pass, the new tests are correct :-) More tests is always a good thing for better code coverage.
serhiy-storchaka
commented
Apr 3, 2025
|
serhiy-storchaka
commented
Apr 3, 2025
!buildbot BSD |
bedevere-bot
commented
Apr 3, 2025
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 9266445 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132023%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
furkanonder
commented
Apr 3, 2025
I ran the tests on NetBSD, but all tests were skipped. I'm running NetBSD on a Proxmox virtualization environment. ╰─$ ./python-mtesttest_socket-mBasicBluetoothTest-v==CPython3.14.0a6+ (heads/test-socket-bluetooth:fc992e3a17a, Apr32025, 18:06:54) [GCC10.5.0]
==NetBSD-10.0-amd64-x86_64-64bit-ELFlittle-endian==Pythonbuild: debug==cwd:/home/blue/Desktop/cpython/build/test_python_worker_24709æ==CPUcount: 16==encodings: locale=UTF-8FS=utf-8==resources: alltestresourcesaredisabled, use-uoptiontounskiptestsUsingrandomseed: 34345567990:00:00loadavg: 0.25Run1testsequentiallyinasingleprocess0:00:00loadavg: 0.25 [1/1] test_sockettestBadHciAddr (test.test_socket.BasicBluetoothTest.testBadHciAddr) ... skipped'Bluetooth sockets required for this test.'testBadL2capAddr (test.test_socket.BasicBluetoothTest.testBadL2capAddr) ... skipped'Bluetooth sockets required for this test.'testBadRfcommAddr (test.test_socket.BasicBluetoothTest.testBadRfcommAddr) ... skipped'Bluetooth sockets required for this test.'testBadScoAddr (test.test_socket.BasicBluetoothTest.testBadScoAddr) ... skipped'Bluetooth sockets required for this test.'testBindBrEdrL2capSocket (test.test_socket.BasicBluetoothTest.testBindBrEdrL2capSocket) ... skipped'Bluetooth sockets required for this test.'testBindHciSocket (test.test_socket.BasicBluetoothTest.testBindHciSocket) ... skipped'Bluetooth sockets required for this test.'testBindLeAttL2capSocket (test.test_socket.BasicBluetoothTest.testBindLeAttL2capSocket) ... skipped'Bluetooth sockets required for this test.'testBindLePsmL2capSocket (test.test_socket.BasicBluetoothTest.testBindLePsmL2capSocket) ... skipped'Bluetooth sockets required for this test.'testBindRfcommSocket (test.test_socket.BasicBluetoothTest.testBindRfcommSocket) ... skipped'Bluetooth sockets required for this test.'testBindScoSocket (test.test_socket.BasicBluetoothTest.testBindScoSocket) ... skipped'Bluetooth sockets required for this test.'testBluetoothConstants (test.test_socket.BasicBluetoothTest.testBluetoothConstants) ... skipped'Bluetooth sockets required for this test.'testCreateHciSocket (test.test_socket.BasicBluetoothTest.testCreateHciSocket) ... skipped'Bluetooth sockets required for this test.'testCreateL2capSocket (test.test_socket.BasicBluetoothTest.testCreateL2capSocket) ... skipped'Bluetooth sockets required for this test.'testCreateRfcommSocket (test.test_socket.BasicBluetoothTest.testCreateRfcommSocket) ... skipped'Bluetooth sockets required for this test.'testCreateScoSocket (test.test_socket.BasicBluetoothTest.testCreateScoSocket) ... skipped'Bluetooth sockets required for this test.'----------------------------------------------------------------------Ran15testsin0.004sOK (skipped=15)
0:00:00loadavg: 0.25 [1/1] test_socketpassed==Testsresult: SUCCESS==1testOK.
Totalduration: 332msTotaltests: run=15 (filtered) skipped=15Totaltestfiles: run=1/1 (filtered)
Result: SUCCESS>>>importsysconfig>>>config_vars=sysconfig.get_config_vars()
>>>forkeyinconfig_vars:
... if'BLUETOOTH'inkey:
... print(f"{key}: {config_vars[key]}")
...
HAVE_BLUETOOTH_BLUETOOTH_H: 0HAVE_BLUETOOTH_H: 1 |
serhiy-storchaka
commented
Apr 4, 2025
Thanks, @furkanonder. It seems difficult to test Bluetooth on virtual machine. I'll only backport these tests to 3.13, so we will have more chance to fix them. |
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
GH-132071 is a backport of this pull request to the 3.13 branch. |
bedevere-bot
commented
Apr 4, 2025
|
bedevere-bot
commented
Apr 4, 2025
|
vstinner
commented
Apr 4, 2025
I can reproduce a failure on my Fedora laptop: |
bedevere-bot
commented
Apr 4, 2025
|
vstinner
commented
Apr 4, 2025
Ah, it's the same failure than on Fedora. |
bedevere-bot
commented
Apr 4, 2025
|
bedevere-bot
commented
Apr 4, 2025
|
bedevere-bot
commented
Apr 4, 2025
|
serhiy-storchaka
commented
Apr 4, 2025
What surprises me here is that it fails with different error codes: EINVAL and ENODEV. The structsockaddr_hci {
sa_family_thci_family;
unsigned shorthci_dev;
unsigned shorthci_channel;
};@vstinner, could you please add the following line and test it on your Fedora laptop? diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 6e44a7ebfd1..54ba6885564 100644
--- a/Modules/socketmodule.c+++ b/Modules/socketmodule.c@@ -2104,6 +2104,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
case BTPROTO_HCI:
{
struct sockaddr_hci *addr = &addrbuf->bt_hci;
+ memset(addr, 0, sizeof(struct sockaddr_hci));
#if defined(__NetBSD__) || defined(__DragonFly__)
const char *straddr;
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; |
bedevere-bot
commented
Apr 4, 2025
|
serhiy-storchaka
commented
Apr 4, 2025
It was a real bug (see #132075). |
hugovk
commented
Apr 5, 2025
After fixing #132075, https://buildbot.python.org/#/release_status For example: https://buildbot.python.org/#/builders/29/builds/8023
|
serhiy-storchaka
commented
Apr 5, 2025
bedevere-bot
commented
Apr 5, 2025
|
bedevere-bot
commented
Apr 5, 2025
|
bedevere-bot
commented
Apr 5, 2025
|
bedevere-bot
commented
Apr 5, 2025
|
… fails (pythonGH-132072) (cherry picked from commit ef70f02) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
bedevere-bot
commented
Apr 5, 2025
|
bedevere-bot
commented
Apr 5, 2025
|
bedevere-bot
commented
Apr 5, 2025
|
Test parsing and unparsing of address.
The tests expose some errors in implementation: the format of the returned address for HCI and SCO is not compatible with acceptable format.