Diff between 29cf0393d160fd39ebac5178a49433e35c8dbd6e and 59c916269c300ae7765a2c7b0fe6b74efe760af2

Changed Files

File Additions Deletions Status
tools/mgmt-tester.c +56 -0 modified

Full Patch

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 99c36ac..c99a066 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -2906,6 +2906,52 @@ static const struct generic_data load_conn_params_fail_1 = {
 	.expect_status = MGMT_STATUS_INVALID_PARAMS,
 };
 
+static const uint8_t add_device_nval_1[] = {
+					0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+					0x00,
+					0x00,
+};
+static const uint8_t add_device_rsp[] =  {
+					0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+					0x00,
+};
+static const struct generic_data add_device_fail_1 = {
+	.send_opcode = MGMT_OP_ADD_DEVICE,
+	.send_param = add_device_nval_1,
+	.send_len = sizeof(add_device_nval_1),
+	.expect_param = add_device_rsp,
+	.expect_len = sizeof(add_device_rsp),
+	.expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
+static const uint8_t add_device_nval_2[] = {
+					0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+					0x00,
+					0x02,
+};
+static const struct generic_data add_device_fail_2 = {
+	.send_opcode = MGMT_OP_ADD_DEVICE,
+	.send_param = add_device_nval_2,
+	.send_len = sizeof(add_device_nval_2),
+	.expect_param = add_device_rsp,
+	.expect_len = sizeof(add_device_rsp),
+	.expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
+static const uint8_t add_device_nval_3[] = {
+					0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+					0x00,
+					0xff,
+};
+static const struct generic_data add_device_fail_3 = {
+	.send_opcode = MGMT_OP_ADD_DEVICE,
+	.send_param = add_device_nval_3,
+	.send_len = sizeof(add_device_nval_3),
+	.expect_param = add_device_rsp,
+	.expect_len = sizeof(add_device_rsp),
+	.expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
 static void client_cmd_complete(uint16_t opcode, uint8_t status,
 					const void *param, uint8_t len,
 					void *user_data)
@@ -4274,5 +4320,15 @@ int main(int argc, char *argv[])
 				&load_conn_params_fail_1,
 				NULL, test_command_generic);
 
+	test_bredrle("Add Device - Invalid Params 1",
+				&add_device_fail_1,
+				NULL, test_command_generic);
+	test_bredrle("Add Device - Invalid Params 2",
+				&add_device_fail_2,
+				NULL, test_command_generic);
+	test_bredrle("Add Device - Invalid Params 3",
+				&add_device_fail_3,
+				NULL, test_command_generic);
+
 	return tester_run();
 }