summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* iso-tester: Test BT_DEFER_SETUP works with getsockoptLuiz Augusto von Dentz2022-08-041-0/+13
| | | | | This attempts to test BT_DEFER_SETUP is properly set when the test has defer flag set.
* iso-test: Add ISO 48_2_1 Defer SendLuiz Augusto von Dentz2022-07-281-0/+11
| | | | | This adds ISO 48_2_1 Defer Send test which enables just output instead of both.
* isotest: Add documentationLuiz Augusto von Dentz2022-07-221-0/+202
| | | | | This adds isotest.rst which documents the modes and options of isotest(1) and is then converted isotest.1 manpage.
* tools: Add isotest toolLuiz Augusto von Dentz2022-07-221-0/+1217
| | | | This adds isotest tool which can be used to test ISO sockets.
* tools: Add iso-testerLuiz Augusto von Dentz2022-07-222-2/+1705
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds iso-tester which tests BTPROTO_ISO socket: Basic Framework - Success Basic ISO Socket - Success Basic ISO Get Socket Option - Success Basic ISO Set Socket Option - Success ISO QoS 8_1_1 - Success ISO QoS 8_2_1 - Success ISO QoS 16_1_1 - Success ISO QoS 16_2_1 - Success ISO QoS 16_2_1 CIG 0x01 - Success ISO QoS 16_2_1 CIG 0x01 CIS 0x01 - Success ISO QoS 24_1_1 - Success ISO QoS 24_2_1 - Success ISO QoS 32_1_1 - Success ISO QoS 32_2_1 - Success ISO QoS 44_1_1 - Success ISO QoS 44_2_1 - Success ISO QoS 48_1_1 - Success ISO QoS 48_2_1 - Success ISO QoS 48_3_1 - Success ISO QoS 48_4_1 - Success ISO QoS 48_5_1 - Success ISO QoS 48_6_1 - Success ISO QoS 8_1_2 - Success ISO QoS 8_2_2 - Success ISO QoS 16_1_2 - Success ISO QoS 16_2_2 - Success ISO QoS 24_1_2 - Success ISO QoS 24_2_2 - Success ISO QoS 32_1_2 - Success ISO QoS 32_2_2 - Success ISO QoS 44_1_2 - Success ISO QoS 44_2_2 - Success ISO QoS 48_1_2 - Success ISO QoS 48_2_2 - Success ISO QoS 48_3_2 - Success ISO QoS 48_4_2 - Success ISO QoS 48_5_2 - Success ISO QoS 48_6_2 - Success ISO QoS - Invalid ISO Connect2 CIG 0x01 - Success ISO Send - Success ISO Receive - Success ISO Defer - Success ISO Defer Send - Success ISO Defer Receive - Success ISO Defer Reject - Success ISO Send and Receive - Success ISO Broadcaster - Success ISO Broadcaster BIG 0x01 - Success ISO Broadcaster BIG 0x01 BIS 0x01 - Success ISO Broadcaster Receiver - Success
* btio: Add support for ISO socketsLuiz Augusto von Dentz2022-07-221-0/+110
| | | | This adds support to create objects that map to ISO sockets.
* mgmt-tester: Fix Read Exp Feature testsLuiz Augusto von Dentz2022-07-221-3/+11
| | | | This adds ISO Socket UUID as response to Read Exp Feature.
* tools/test-runner: Fix errors reported by scan-buildTedd Ho-Jeong An2022-07-011-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the errors reported by the scan-build. tools/test-runner.c:315:2: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] execve(argv[0], argv, qemu_envp); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/test-runner.c:554:6: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] if (chdir(home + 5) < 0) { ^~~~~~~~~~~~~~~ tools/test-runner.c:638:6: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] if (chdir(home + 5) < 0) { ^~~~~~~~~~~~~~~ tools/test-runner.c:695:6: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] if (chdir(home + 5) < 0) { ^~~~~~~~~~~~~~~ tools/test-runner.c:984:3: warning: Value stored to 'serial_fd' is never read [deadcode.DeadStores] serial_fd = -1; ^ ~~
* tools/btmgmt: Fix errors reported by scan-buildTedd Ho-Jeong An2022-07-011-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the errors reported by the scan-build. tools/btmgmt.c:2699:2: warning: Value stored to 'argc' is never read [deadcode.DeadStores] argc -= optind; ^ ~~~~~~ tools/btmgmt.c:2859:2: warning: Value stored to 'argc' is never read [deadcode.DeadStores] argc -= optind; ^ ~~~~~~ tools/btmgmt.c:2860:2: warning: Value stored to 'argv' is never read [deadcode.DeadStores] argv += optind; ^ ~~~~~~ tools/btmgmt.c:2934:2: warning: Value stored to 'argc' is never read [deadcode.DeadStores] argc -= optind; ^ ~~~~~~ tools/btmgmt.c:2935:2: warning: Value stored to 'argv' is never read [deadcode.DeadStores] argv += optind; ^ ~~~~~~ tools/btmgmt.c:3000:2: warning: Value stored to 'argc' is never read [deadcode.DeadStores] argc -= optind; ^ ~~~~~~ tools/btmgmt.c:3001:2: warning: Value stored to 'argv' is never read [deadcode.DeadStores] argv += optind; ^ ~~~~~~ tools/btmgmt.c:3261:11: warning: Value stored to 'index' during its initialization is never read [deadcode.DeadStores] uint16_t index = mgmt_index; ^~~~~ ~~~~~~~~~~ tools/btmgmt.c:3450:2: warning: Value stored to 'argc' is never read [deadcode.DeadStores] argc -= optind; ^ ~~~~~~ tools/btmgmt.c:3451:2: warning: Value stored to 'argv' is never read [deadcode.DeadStores] argv += optind; ^ ~~~~~~ tools/btmgmt.c:4822:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker] memcpy(cp->data + uuid_bytes, adv_data, adv_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/btmgmt.c:4823:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker] memcpy(cp->data + uuid_bytes + adv_len, scan_rsp, scan_rsp_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/btmgmt.c:5244:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker] memcpy(cp->data + uuid_bytes, adv_data, adv_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/btmgmt.c:5245:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker] memcpy(cp->data + uuid_bytes + adv_len, scan_rsp, scan_rsp_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* mgmt-tester: Fix null dereference issue reported by scan-buildTedd Ho-Jeong An2022-06-231-0/+2
| | | | | | | | | | | This patch fixes the null dereference reported by the scan-build. tools/mgmt-tester.c:12025:28: warning: Access to field 'cap_len' results in a dereference of a null pointer (loaded from variable 'rp') [core.NullDereference] if (sizeof(rp->cap_len) + rp->cap_len != length) { ^~~~~~~~~~~
* tools/mgmt-tester: Add test case for scan response data is not updatingTedd Ho-Jeong An2022-06-211-1/+84
| | | | | | | | | | | | This patch adds a test case to test if the scan response data is updated when the following scenarios are performed. 1. Add Extended Advertising Parameters Command 2. Add Extended Advertising Data Command w/ Scan Resp Data 3. Remove Advertising Command 4. Add Extended Advertising Parameters Command 5. Add Extended Advertising Data Command w/ Scan Resp Data 6. Host should set Scan Resp Data
* test-runner: Fix issues found by coverityFrédéric Danis2022-06-171-3/+13
|
* tools/btmgmt: Add support Add Ext Adv commandTedd Ho-Jeong An2022-06-171-0/+377
| | | | | | This patch adds new command to support the following MGMT API: Add Extended Advertising Parameters Command Add Extended Advertising Data Command
* mgmt-tester: Fix regression with tests failing to setupLuiz Augusto von Dentz2022-06-131-5/+0
| | | | | | | | | This fixes the regression introduced by ab31e2f7e828df3d971cba6f12859edc69f149d5 which causes tests using add_advertising_mgmt_cmd_arr: Add Advertising - Success (Name+data+appear) Timed out Add Ext Advertising - Success (Name+data+appear) Timed out
* test-runner: Add udevd and trigger eventsFrédéric Danis2022-06-131-3/+80
| | | | | Kernel events should have been managed so the audio card is accessible from PipeWire
* test-runner: Add audio card supportFrédéric Danis2022-06-131-1/+22
| | | | | With this commit audio daemons can detect an audio card with output and input, allowing to test interaction between BlueZ and the audio daemon.
* test-runner: Add DBus session supportFrédéric Danis2022-06-131-12/+85
| | | | Audio daemons requests access to DBus session to start
* btproxy: Allow to select multiple BT controllersFrédéric Danis2022-06-131-16/+25
| | | | | | | | | | | | | When running on a computer with a real Bluetooth controller (e.g. hci0) and multiple emulators (e.g. hci1 and hci2) it isn't possible to use the emulators with 2 test-runner vms. If btproxy is started without index parameter the first test-runner will use hci0, and btprox can't be started with multiple index parameters (e.g. -i1 -i2). This patch keeps the old beahvior when used without -i option, in this case it will try to use the first controller available. It also allows to select multiple controllers to be used by btproxy.
* mgmt-tester: Fix build errorLuiz Augusto von Dentz2022-06-021-21/+9
| | | | | | | | | | | | | This fixes the following build error: CC tools/mgmt-tester.o tools/mgmt-tester.c: In function ‘setup_command_generic’: tools/mgmt-tester.c:7503:16: error: the comparison will always evaluate as ‘true’ for the pointer operand in ‘(const struct setup_mgmt_cmd *)test->setup_mgmt_cmd_arr + (sizetype)(i * 24)’ must not be NULL [-Werror=address] 7503 | for (; test->setup_mgmt_cmd_arr + i; ++i) { | ^~~~
* test-runner: Fix not waiting for system_bus_socketLuiz Augusto von Dentz2022-06-021-3/+3
| | | | | This makes test-runner wait for system_bus_socket to be available before continuing otherwise the likes of bluetoothd would likely fail to start.
* mesh-gatt: Fix use_after_freeGopal Tiwari2022-05-311-1/+2
| | | | | | | | | | | Following scenario happens when prov is false and we have double free as mentioned in the below bluez-5.64/tools/mesh-gatt/prov-db.c:847: freed_arg: "g_free" frees "in_str". bluez-5.64/tools/mesh-gatt/prov-db.c:867: double_free: Calling "g_free" frees pointer "in_str" which has already been freed.
* meshctl: Fix possible use_after_freeGopal Tiwari2022-05-311-1/+0
| | | | | | | | | Reported by coverity tool as follows : bluez-5.64/tools/meshctl.c:1968: freed_arg: "g_free" frees "mesh_dir". bluez-5.64/tools/meshctl.c:2018: double_free: Calling "g_free" frees pointer "mesh_dir" which has already been freed.
* obex-client: Fix leaked_handleGopal Tiwari2022-05-311-0/+1
| | | | | | | | While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/obex-client-tool.c:315: leaked_handle: Handle variable "sk" going out of scope leaks the handle.
* mesh/mesh-db: Fix resource leaksGopal Tiwari2022-05-311-0/+2
| | | | | | | | | | | While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_handle: Handle variable "fd" going out of scope leaks the handle. bluez-5.64/tools/mesh/mesh-db.c:2388: leaked_storage: Variable "str" going out of scope leaks the storage it points to.
* l2cap-tester: Fix leaked_handleGopal Tiwari2022-05-311-0/+1
| | | | | | | | While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/l2cap-tester.c:1712: leaked_handle: Handle variable "new_sk" going out of scope leaks the handle.
* create-image: Fix leaked_handleGopal Tiwari2022-05-311-4/+3
| | | | | | | | While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/create-image.c:124: leaked_storage: Variable "map" going out of scope leaks the storage it points to.
* cltest: Fix leaked_handleGopal Tiwari2022-05-311-0/+1
| | | | | | | | While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/cltest.c:75: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
* tools: Fix handle leak in rfcommIldar Kamaletdinov2022-05-091-0/+4
| | | | | | | Some branches of execution can make handle (socket) leakage. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* tools: Fix memory leaks in btgatt-server/clientIldar Kamaletdinov2022-05-092-2/+9
| | | | | | | | According to man buffer allocated by getline() should be freed by the user program even if getline() failed. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* tools: Fix memory leak in hciconfigIldar Kamaletdinov2022-05-091-1/+5
| | | | | | | | printf() was using function that return dynamic allocated memory as a parameter. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* test-runner: Add dedicated option to start D-BusLuiz Augusto von Dentz2022-04-181-11/+27
| | | | | This adds a dedicated option to start D-Bus alone which can be useful when testing the bluetoothd with the likes of valgrind.
* tools: Limit width of fields in sscanfIldar Kamaletdinov2022-04-042-2/+2
| | | | | | | | In tools/btmgmt.c and tools/hex2hcd.c few sscanf does not limit width of fields. This could lead to static overflow and stack corruption. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* tools: Fix signed integer overflow in btsnoop.cIldar Kamaletdinov2022-04-041-1/+1
| | | | | | | | | | If malformed packet is proceed with zero 'size' field we will face with wrong behaviour of write() call. Value 'toread - 1' gives wrong sign for value 'written' (-1) in write() call. To prevent this we should check that 'toread' is not equal to zero. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* tools: Fix buffer overflow in hciattach_tialt.cIldar Kamaletdinov2022-04-041-1/+2
| | | | | | | | Array 'c_brf_chip' of size 8 could be accessed by index > 7. We should limit array access like in previous check at line 221. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
* tools: Fix g_dbus_setup_private connection check in mpris-proxyFrédéric Danis2022-04-041-1/+1
|
* client: Add support for player submenuLuiz Augusto von Dentz2022-03-301-1066/+15
| | | | | This moves adds the functionality of bluetooth-player into bluetoothctl.
* test-runner: Update help informationLuiz Augusto von Dentz2022-03-081-0/+1
| | | | | | | | | | | | | | | | | This updates usage so it list -l/--emulator properly: test-runner - Automated test execution utility Usage: test-runner [options] [--] <command> [args] Options: -a, --auto Find tests and run them -d, --dbus Start D-Bus daemon -m, --monitor Start btmon -l, --emulator Start btvirt -u, --unix [path] Provide serial device -q, --qemu <path> QEMU binary -k, --kernel <image> Kernel image (bzImage) -h, --help Show help options
* test-runner: Fix -l/--emulatorLuiz Augusto von Dentz2022-03-081-2/+7
| | | | | This fixes -l/--emulator not able to start depending on what parameters are given as it was not setting the directory properly.
* test-runner: Fix parsing of command lineLuiz Augusto von Dentz2022-03-011-21/+7
| | | | | | | | | Instead of parsing the command line, which can contain a shell script, run using /bin/sh so it allows more complex command line to be tested: sudo tools/test-runner -l -d -k <pathto/bzImage> -- 'client/bluetoothctl power on && sleep 2 && client/bluetoothctl power off'
* test-runner: Add option to start emulatorLuiz Augusto von Dentz2022-02-281-4/+82
| | | | | | | | This adds an option (-l/--emulator) to start btvirt before processing the command which is convenient to runs tools like bluetoothctl: sudo tools/test-runner -l -d -k <pathto/bzImage> -- client/bluetoothctl power on
* btproxy: Attempt to bind the next indexLuiz Augusto von Dentz2022-02-251-4/+17
| | | | | If no specific index is given attempt to bind the next index if the current one is already in use.
* tools/mesh-cfgtest: include limits.hMichael Nosthoff2022-02-161-0/+1
| | | | | | mesh-cfgtest.c uses MAX_PATH so it should include limits.h. fixes compilation error with musl-based toolchains.
* build: Fix errors with glibc < 2.25Fabrice Fontaine2022-02-151-2/+1
| | | | | | | | | | | | | | | | | | getrandom and sys/random.h are only available since glibc 2.25: https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html resulting in the following build failures since version 5.63 and https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=getrandom: plugins/autopair.c:20:24: fatal error: sys/random.h: No such file or directory #include <sys/random.h> ^ To fix this build failure, add util_getrandom and a fallback (borrowed from pipewire and licensed under MIT): https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/utils.c Fixes: - http://autobuild.buildroot.org/results/6b8870d12e0804d6154230a7322c49416c1dc0e2
* rfcomm-tester: Increase amount of data from 8k to 32kLuiz Augusto von Dentz2022-02-141-24/+66
| | | | | | | This forces the behavior where not all data can be written at once so it is able to reproduce the from [1]. [1]https://bugzilla.kernel.org/show_bug.cgi?id=215594
* obexctl: Add optional argument channel to connect commandLuiz Augusto von Dentz2022-02-141-6/+21
| | | | | | This adds a third argument to connect command so a channel can be passed to CreateSession which is useful since it possible to force a specific RFCOMM channel.
* rfcomm-tester: Add test to write big chunks of dataLuiz Augusto von Dentz2022-02-091-7/+40
| | | | This attempts to test traffic similar to OBEX using big chunk of data.
* tools/mesh-cfgclient: Fix config menu help messageInga Stotland2022-01-121-3/+3
| | | | | An info message suggesting to request a remote node composition should reference the correct menu command: "composition-get".
* tools/mesh-cfgclient: Fix typos in config storageInga Stotland2022-01-121-2/+2
| | | | Fix keyword typos and comments.
* build: Replace use of g_memdup with util_memdupLuiz Augusto von Dentz2022-01-062-9/+11
| | | | | | | | | | | This replaces the uses of g_memdup with util_memdup since the former has been deprecated: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations] g_memdup2 requires bumping glib version which would likely have its own problems thus why util_memdup was introduced.
* build: Fix build when sanitizer are enabledLuiz Augusto von Dentz2021-12-232-4/+9
| | | | This fixes various issues found when sanitizers are enabled.