iso-tester: Add suspend tests
Luiz Augusto von Dentz
maintainerPATCH 1/1 iso-tester: Add suspend tests
From: Luiz Augusto von Dentz <[email protected]>
This adds the following test which attempt to trigger suspend code path while ISO sockets are connecting or have been connected:
ISO Connect Suspend - Success ISO Connected Suspend - Success ISO Connect2 Suspend - Success ISO Connected2 Suspend - Success
--- tools/iso-tester.c | 85 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-)
tools/iso-tester.c +84 -1
@@ -25,6 +25,7 @@#include "lib/mgmt.h" #include "monitor/bt.h" +#include "emulator/vhci.h" #include "emulator/bthost.h" #include "emulator/hciemu.h"
@@ -391,6 +392,7 @@ struct test_data {uint8_t client_num;int step;bool reconnect; +bool suspending; };struct iso_client_data {
@@ -405,6 +407,7 @@ struct iso_client_data {bool disconnect;bool ts;bool mconn; +bool suspend;uint8_t pkt_status;const uint8_t *base;size_t base_len;
@@ -806,6 +809,11 @@ static const struct iso_client_data connect_reject = { .expect_err = -ENOSYS }; +static const struct iso_client_data connect_suspend = { + .qos =QOS_16_2_1 , + .expect_err = -ECONNRESET +}; +static const struct iso_client_data connect_cig_f0_invalid = { .qos =QOS_FULL (0xF0 ,0x00 , {},QOS_IO (10000 ,10 ,40 ,0x02 ,2 )), .expect_err = -EINVAL
@@ -920,6 +928,11 @@ static const struct iso_client_data disconnect_16_2_1 = { .disconnect = true, }; +static const struct iso_client_data suspend_16_2_1 = { + .qos =QOS_16_2_1 , + .suspend = true, +}; +static const struct iso_client_data reconnect_16_2_1 = { .qos =QOS_16_2_1 , .expect_err =0 ,
@@ -1255,7 +1268,7 @@ static void setup_powered_callback(uint8_t status, uint16_t length,continue ;if (isodata->send || isodata->recv || isodata->disconnect || - data->accept_reason) + isodata->suspend || data->accept_reason)bthost_set_iso_cb (host, iso_accept_conn, iso_new_conn, data);
@@ -1892,6 +1905,46 @@ static void iso_shutdown(struct test_data *data, GIOChannel *io)tester_print ("Disconnecting..." ); } +static bool hook_set_event_mask (const void *msg,uint16_t len,void *user_data) +{ +struct test_data *data = user_data; + +tester_print ("Set Event Mask" ); + + --data->step; +if (!data->step) +tester_test_passed (); + +return true; +} + +static void trigger_force_suspend (void *user_data) +{ +struct test_data *data =tester_get_data (); +struct vhci *vhci =hciemu_get_vhci (data->hciemu); +int err; + +/* Make sure suspend is only triggered once */ +if (data->suspending) +return ; + + data->suspending = true; + +/* Triggers the suspend */ +tester_print ("Set the system into Suspend via force_suspend" ); + err =vhci_set_force_suspend (vhci, true); +if (err) { +tester_warn ("Unable to enable the force_suspend" ); +return ; + } + + data->step++; + +hciemu_add_hook (data->hciemu,HCIEMU_HOOK_PRE_CMD , +BT_HCI_CMD_SET_EVENT_MASK , + hook_set_event_mask, data); +} +static gboolean iso_connect (GIOChannel *io,GIOCondition cond,gpointer user_data) {
@@ -1954,6 +2007,8 @@ static gboolean iso_connect(GIOChannel *io, GIOCondition cond,iso_recv (data, io); else if (isodata->disconnect) iso_shutdown(data, io); + else if (isodata->suspend) + trigger_force_suspend(data); elsetester_test_passed (); }
@@ -2567,6 +2622,12 @@ static void test_connect_wait_close(const void *test_data)setup_connect (data,0 , iso_connect_wait_close_cb); } +static void test_connect_suspend (const void *test_data) +{ +test_connect (test_data); +trigger_force_suspend ((void *)test_data); +} +static void test_bcast (const void *test_data) {struct test_data *data =tester_get_data ();
@@ -2590,6 +2651,12 @@ static void test_bcast_recv(const void *test_data)setup_listen (data,0 , iso_accept_cb); } +static void test_connect2_suspend (const void *test_data) +{ +test_connect2 (test_data); +trigger_force_suspend ((void *)test_data); +} +int main (int argc,char *argv[]) {tester_init (&argc, &argv);
@@ -2755,6 +2822,14 @@ int main(int argc, char *argv[])test_iso ("ISO Connect Wait Close - Success" , &connect_16_2_1, setup_powered, test_connect_wait_close); +test_iso ("ISO Connect Suspend - Success" , &connect_suspend, + setup_powered, + test_connect_suspend); + +test_iso ("ISO Connected Suspend - Success" , &suspend_16_2_1, + setup_powered, + test_connect); +test_iso2 ("ISO Connect2 CIG 0x01 - Success" , &connect_1_16_2_1, setup_powered, test_connect2);
@@ -2767,6 +2842,14 @@ int main(int argc, char *argv[]) setup_powered, test_connect2); +test_iso2 ("ISO Connect2 Suspend - Success" , &connect_suspend, + setup_powered, + test_connect2_suspend); + +test_iso2 ("ISO Connected2 Suspend - Success" , &suspend_16_2_1, + setup_powered, + test_connect2); +test_iso ("ISO Defer Send - Success" , &connect_16_2_1_defer_send, setup_powered, test_connect);
Signature · 1 line
2.41.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=776431
---Test result---
Test Summary:
CheckPatch PASS 0.52 seconds GitLint PASS 0.29 seconds BuildEll PASS 26.58 seconds BluezMake PASS 1001.36 seconds MakeCheck PASS 11.78 seconds MakeDistcheck FAIL 9.10 seconds CheckValgrind PASS 247.58 seconds CheckSmatch PASS 344.92 seconds bluezmakeextell PASS 101.99 seconds IncrementalBuild PASS 859.38 seconds ScanBuild PASS 1079.54 seconds
Details
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:
make[2]: *** No rule to make target 'doc/test-runner.txt', needed by 'distdir-am'. Stop. make[1]: *** [Makefile:11708: distdir] Error 2
make: *** [Makefile:11784: dist] Error 2
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 11 lines · On Tue, 15 Aug 2023 15:17:38 -0700 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This adds the following test which attempt to trigger suspend code path while ISO sockets are connecting or have been connected:
ISO Connect Suspend - Success ISO Connected Suspend - Success ISO Connect2 Suspend - Success ISO Connected2 Suspend - Success
[...]
Here is the summary with links:
- [BlueZ] iso-tester: Add suspend tests
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=583d579178d4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html