Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Add tests for Bluetooth RFCOMM, HCI and SCO#132023
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add tests for Bluetooth RFCOMM, HCI and SCO#132023
Uh oh!
There was an error while loading.Please reload this page.
Conversation
!buildbot FreeBSD |
bedevere-bot commentedApr 2, 2025
🤖 New build scheduled with the buildbot fleet by@serhiy-storchaka for commit909871a 🤖 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:
|
!buildbot BSD |
bedevere-bot commentedApr 2, 2025
🤖 New build scheduled with the buildbot fleet by@serhiy-storchaka for commit94c9287 🤖 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, could you please test new tests on NetBSD? |
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. |
FreeBSD documentation on Bluetooth:https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-bluetooth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
|
!buildbot BSD |
bedevere-bot commentedApr 3, 2025
🤖 New build scheduled with the buildbot fleet by@serhiy-storchaka for commit9266445 🤖 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:
|
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 |
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. |
2ccd6aa intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
bedevere-bot commentedApr 4, 2025
|
bedevere-bot commentedApr 4, 2025
|
I can reproduce a failure on my Fedora laptop: |
bedevere-bot commentedApr 4, 2025
|
Ah, it's the same failure than on Fedora. |
bedevere-bot commentedApr 4, 2025
|
bedevere-bot commentedApr 4, 2025
|
bedevere-bot commentedApr 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.cindex 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 commentedApr 4, 2025
|
It was a real bug (see#132075). |
After fixing#132075, https://buildbot.python.org/#/release_status For example: https://buildbot.python.org/#/builders/29/builds/8023
|
bedevere-bot commentedApr 5, 2025
|
bedevere-bot commentedApr 5, 2025
|
bedevere-bot commentedApr 5, 2025
|
bedevere-bot commentedApr 5, 2025
|
… fails (pythonGH-132072)(cherry picked from commitef70f02)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
bedevere-bot commentedApr 5, 2025
|
bedevere-bot commentedApr 5, 2025
|
bedevere-bot commentedApr 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.