diff mbox series

[BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter

Message ID 20210410064605.287884-1-hj.tedd.an@gmail.com
State New
Headers show
Series [BlueZ,1/2] tools/mgmt-tester: Add callback routine for validating the parameter | expand

Commit Message

Tedd Ho-Jeong An April 10, 2021, 6:46 a.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

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(-)

Comments

Luiz Augusto von Dentz April 12, 2021, 5:27 p.m. UTC | #1
Hi Tedd,

On Sat, Apr 10, 2021 at 12:11 AM <bluez.test.bot@gmail.com> 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 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


Applied, thanks.

-- 
Luiz Augusto von Dentz
diff mbox series

Patch

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 1835ca079..ef37f0e03 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -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, "");