tools/mgmt-tester: Add callback routine for validating the parameter
PATCH 1/2 tools/mgmt-tester: Add callback routine for validating the parameter
From: Tedd Ho-Jeong An <[email protected]>
This patch adds a callback routine for validating the received HCI parameter, so it can customize to compare the parameters instead of memcmp the full length.
--- tools/mgmt-tester.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/mgmt-tester.c +7 -1
@@ -280,6 +280,7 @@ struct generic_data {uint16_t expect_alt_ev_len;uint16_t expect_hci_command;const void *expect_hci_param; +int (*expect_hci_param_check_func)(const void *param,uint16_t length);uint8_t expect_hci_len;const void * (*expect_hci_func)(uint8_t *len);bool expect_pin;
@@ -6632,6 +6633,7 @@ static void command_hci_callback(uint16_t opcode, const void *param,const struct generic_data *test = data->test_data;const void *expect_hci_param = test->expect_hci_param;uint8_t expect_hci_len = test->expect_hci_len; +int ret;tester_print ("HCI Command 0x%04x length %u" , opcode, length);
@@ -6647,7 +6649,11 @@ static void command_hci_callback(uint16_t opcode, const void *param,return ; } -if (memcmp (param, expect_hci_param, length) !=0 ) { +if (test->expect_hci_param_check_func) + ret = test->expect_hci_param_check_func (param, length); +else + ret =memcmp (param, expect_hci_param, length); +if (ret !=0 ) {tester_warn ("Unexpected HCI command parameter value:" );util_hexdump ('>' , param, length, print_debug,"" );util_hexdump ('!' , expect_hci_param, length, print_debug,"" );
Signature · 1 line
2.25.1
PATCH 2/2 tools/mgmt-tester: Add param check callback for LE Set Adv Params
From: Tedd Ho-Jeong An <[email protected]>
The interval_min and interval_max in LE Set Advertising Parameters command are changed/updated often whenever the values are tuned in the kernel, and it causes some tests failure.
This patch adds a parameter check callback for LE Set Advertising Parameters command to ignore the interval_min and interval_max parameters.
--- tools/mgmt-tester.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
tools/mgmt-tester.c +34 -0
@@ -910,6 +910,20 @@ static uint8_t set_connectable_off_scan_adv_param[] = { 0x00, /* filter_policy */ }; +static int set_connectable_off_scan_adv_check_func (const void *param, +uint16_t length) +{ +const uint8_t *received = param; +uint8_t *expected = set_connectable_off_scan_adv_param; + +/* Compare the received param with expected param, but ignore the +* min_internal and max_interval since these values are turned often +* in the kernel and we don't want to update the expected value every +* time. +*/ +return memcmp (&received[4 ], &expected[4 ], length -4 ); +} +static const struct generic_data set_connectable_off_le_test_2 = { .setup_settings = settings_powered_le_connectable_advertising, .send_opcode =MGMT_OP_SET_CONNECTABLE ,
@@ -922,6 +936,7 @@ static const struct generic_data set_connectable_off_le_test_2 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func };static uint16_t settings_powered_le_discoverable[] = {
@@ -949,6 +964,7 @@ static const struct generic_data set_connectable_off_le_test_3 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func };static const struct generic_data set_connectable_off_le_test_4 = {
@@ -964,6 +980,7 @@ static const struct generic_data set_connectable_off_le_test_4 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func };static const char set_fast_conn_on_param[] = {0x01 };
@@ -4750,6 +4767,7 @@ static const struct generic_data add_advertising_success_13 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func };static uint8_t set_connectable_off_adv_param[] = {
@@ -4763,6 +4781,20 @@ static uint8_t set_connectable_off_adv_param[] = { 0x00, /* filter_policy */ }; +static int set_connectable_off_adv_check_func (const void *param, +uint16_t length) +{ +const uint8_t *received = param; +uint8_t *expected = set_connectable_off_adv_param; + +/* Compare the received param with expected param, but ignore the +* min_internal and max_interval since these values are turned often +* in the kernel and we don't want to update the expected value every +* time. +*/ +return memcmp (&received[4 ], &expected[4 ], length -4 ); +} +static const struct generic_data add_advertising_success_14 = { .setup_settings = settings_powered_le, .send_opcode =MGMT_OP_ADD_ADVERTISING ,
@@ -4774,6 +4806,7 @@ static const struct generic_data add_advertising_success_14 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_adv_param, .expect_hci_len = sizeof(set_connectable_off_adv_param), + .expect_hci_param_check_func = set_connectable_off_adv_check_func };static const struct generic_data add_advertising_success_15 = {
@@ -4814,6 +4847,7 @@ static const struct generic_data add_advertising_success_17 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_adv_param, .expect_hci_len = sizeof(set_connectable_off_adv_param), + .expect_hci_param_check_func = set_connectable_off_adv_check_func };static const char set_powered_off_le_settings_param[] = {
Signature · 1 line
2.25.1
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=464847
---Test result---
Test Summary:
CheckPatch PASS 0.54 seconds GitLint PASS 0.23 seconds Prep - Setup ELL PASS 48.52 seconds Build - Prep PASS 0.11 seconds Build - Configure PASS 8.49 seconds Build - Make PASS 204.22 seconds Make Check PASS 9.82 seconds Make Dist PASS 13.24 seconds Make Dist - Configure PASS 5.31 seconds Make Dist - Make PASS 85.07 seconds Build w/ext ELL - Configure PASS 8.76 seconds Build w/ext ELL - Make PASS 197.17 seconds
Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint
##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL
##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build
##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree
##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree
##############################
Test: Make Check - PASS
Desc: Run 'make check'
##############################
Test: Make Dist - PASS
Desc: Run 'make dist' and build the distribution tarball
##############################
Test: Make Dist - Configure - PASS
Desc: Configure the source from distribution tarball
##############################
Test: Make Dist - Make - PASS
Desc: Build the source from distribution tarball
##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration
##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration
---
Regards,
Linux Bluetooth
Hi Tedd,
Quoted 76 lines · On Sat, Apr 10, 2021 at 12:11 AM <[email protected]> wrote:
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=464847---Test result---
Test Summary:
CheckPatch PASS 0.54 seconds GitLint PASS 0.23 seconds Prep - Setup ELL PASS 48.52 seconds Build - Prep PASS 0.11 seconds Build - Configure PASS 8.49 seconds Build - Make PASS 204.22 seconds Make Check PASS 9.82 seconds Make Dist PASS 13.24 seconds Make Dist - Configure PASS 5.31 seconds Make Dist - Make PASS 85.07 seconds Build w/ext ELL - Configure PASS 8.76 seconds Build w/ext ELL - Make PASS 197.17 secondsDetails
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree##############################
Test: Make Check - PASS
Desc: Run 'make check'##############################
Test: Make Dist - PASS
Desc: Run 'make dist' and build the distribution tarball##############################
Test: Make Dist - Configure - PASS
Desc: Configure the source from distribution tarball##############################
Test: Make Dist - Make - PASS
Desc: Build the source from distribution tarball##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration
Quoted 3 lines
---
Regards,
Linux Bluetooth
Applied, thanks.
Signature · 1 line
Luiz Augusto von Dentz