All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH  0/7] Add Write Long Characteristic Value client TC
@ 2015-03-26 12:59 Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 1/7] unit/test-gatt: Add TP/GAW/CL/BV-05-C test Gowtham Anandha Babu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Adds the below client test cases:
1) Write Long Characteristic Value - by Client
2) Write Long Characteristic Value - Invalid Handle
3) Write Long Characteristic Value - Write Not Permitted
4) Write Long Characteristic Value - Insufficient Authorization
5) Write Long Characteristic Value - Insufficient Authentication
6) Write Long Characteristic Value - Insufficient Encryption Key Size

Gowtham Anandha Babu (7):
  unit/test-gatt: Add TP/GAW/CL/BV-05-C test
  unit/test-gatt: Add TP/GAW/CL/BI-07-C test
  unit/test-gatt: Add TP/GAW/CL/BI-08-C test
  unit/test-gatt: Add TP/GAW/CL/BI-11-C test
  unit/test-gatt: Add TP/GAW/CL/BI-12-C test
  unit/test-gatt: Add TP/GAW/CL/BI-13-C test
  shared/gatt-client: Add const qualifier to prepare write value

 src/shared/gatt-client.c |   2 +-
 src/shared/gatt-client.h |   2 +-
 unit/test-gatt.c         | 331 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 330 insertions(+), 5 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH  1/7] unit/test-gatt: Add TP/GAW/CL/BV-05-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 2/7] unit/test-gatt: Add TP/GAW/CL/BI-07-C test Gowtham Anandha Babu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify that a Generic Attribute Profile client can write a long
Characteristic Value selected by handle.
---
 unit/test-gatt.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 248 insertions(+), 3 deletions(-)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 92ab6dc..d2a03a7 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1019,6 +1019,38 @@ static const struct test_step test_signed_write_seclevel_1 = {
 	.length = 0x03
 };
 
+static void test_long_write_cb(bool success, bool reliable_error,
+					uint8_t att_ecode, void *user_data)
+{
+	struct context *context = user_data;
+	const struct test_step *step = context->data->step;
+
+	g_assert(att_ecode == step->expected_att_ecode);
+
+	context_quit(context);
+}
+
+static void test_long_write(struct context *context)
+{
+	const struct test_step *step = context->data->step;
+
+	g_assert(bt_gatt_client_write_long_value(context->client, false,
+				step->handle, 0, step->value,
+				step->length, test_long_write_cb,
+				context, NULL));
+}
+
+/* The maximum length of an attribute value shall be 512 octets. */
+static const uint8_t long_data_2[512] = { [0 ... 511] = 0xff };
+
+static const struct test_step test_long_write_1 = {
+	.handle = 0x0007,
+	.func = test_long_write,
+	.expected_att_ecode = 0,
+	.value = long_data_2,
+	.length = sizeof(long_data_2)
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -1916,9 +1948,6 @@ static const struct test_step test_long_read_1 = {
 	.length = 0x03
 };
 
-/* The maximum length of an attribute value shall be 512 octets. */
-static const uint8_t long_data_2[512] = { [0 ... 511] = 0xff };
-
 static const struct test_step test_long_read_2 = {
 	.handle = 0x0003,
 	.func = test_long_read,
@@ -3348,6 +3377,222 @@ int main(int argc, char *argv[])
 			raw_pdu(0x12, 0x04, 0x00, 0x01, 0x02, 0x03),
 			raw_pdu(0x01, 0x12, 0x04, 0x00, 0x03));
 
+	define_test_client("/TP/GAW/CL/BV-05-C", test_client, service_db_1,
+			&test_long_write_1,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff),
+			raw_pdu(0x17, 0x07, 0x00, 0x00, 0x00,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff),
+			raw_pdu(0x16, 0x07, 0x00, 0xfb, 0x01,
+				0xff, 0xff, 0xff, 0xff, 0xff),
+			raw_pdu(0x17, 0x07, 0x00, 0xfb, 0x01,
+				0xff, 0xff, 0xff, 0xff, 0xff),
+			raw_pdu(0x18, 0x01),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  2/7] unit/test-gatt: Add TP/GAW/CL/BI-07-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 1/7] unit/test-gatt: Add TP/GAW/CL/BV-05-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 3/7] unit/test-gatt: Add TP/GAW/CL/BI-08-C test Gowtham Anandha Babu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify Generic Attribute Profile client behavior when the Write
Long Characteristic Value procedure fails due to invalid handle.
---
 unit/test-gatt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index d2a03a7..5adc4e5 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1051,6 +1051,14 @@ static const struct test_step test_long_write_1 = {
 	.length = sizeof(long_data_2)
 };
 
+static const struct test_step test_long_write_2 = {
+	.handle = 0x0000,
+	.func = test_long_write,
+	.expected_att_ecode = 0x01,
+	.value = write_data_1,
+	.length = 0x03
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -3593,6 +3601,14 @@ int main(int argc, char *argv[])
 			raw_pdu(0x18, 0x01),
 			raw_pdu(0x19));
 
+	define_test_client("/TP/GAW/CL/BI-07-C", test_client, service_db_1,
+			&test_long_write_2,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01),
+			raw_pdu(0x18, 0x00),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  3/7] unit/test-gatt: Add TP/GAW/CL/BI-08-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 1/7] unit/test-gatt: Add TP/GAW/CL/BV-05-C test Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 2/7] unit/test-gatt: Add TP/GAW/CL/BI-07-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 4/7] unit/test-gatt: Add TP/GAW/CL/BI-11-C test Gowtham Anandha Babu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify Generic Attribute Profile client behavior when the Write
Long Characteristic Value procedure fails due to write not permitted.
---
 unit/test-gatt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 5adc4e5..be20da9 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1059,6 +1059,14 @@ static const struct test_step test_long_write_2 = {
 	.length = 0x03
 };
 
+static const struct test_step test_long_write_3 = {
+	.handle = 0x0003,
+	.func = test_long_write,
+	.expected_att_ecode = 0x03,
+	.value = write_data_1,
+	.length = 0x03
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -3609,6 +3617,14 @@ int main(int argc, char *argv[])
 			raw_pdu(0x18, 0x00),
 			raw_pdu(0x19));
 
+	define_test_client("/TP/GAW/CL/BI-08-C", test_client, service_db_1,
+			&test_long_write_3,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x01, 0x16, 0x03, 0x00, 0x03),
+			raw_pdu(0x18, 0x00),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  4/7] unit/test-gatt: Add TP/GAW/CL/BI-11-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
                   ` (2 preceding siblings ...)
  2015-03-26 12:59 ` [PATCH 3/7] unit/test-gatt: Add TP/GAW/CL/BI-08-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 5/7] unit/test-gatt: Add TP/GAW/CL/BI-12-C test Gowtham Anandha Babu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify Generic Attribute Profile client behavior when the Write
Long Characteristic Value procedure fails due to insufficient
authorization.
---
 unit/test-gatt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index be20da9..f2c771a 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1067,6 +1067,14 @@ static const struct test_step test_long_write_3 = {
 	.length = 0x03
 };
 
+static const struct test_step test_long_write_4 = {
+	.handle = 0x0007,
+	.func = test_long_write,
+	.expected_att_ecode = 0x08,
+	.value = write_data_1,
+	.length = 0x03
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -3625,6 +3633,14 @@ int main(int argc, char *argv[])
 			raw_pdu(0x18, 0x00),
 			raw_pdu(0x19));
 
+	define_test_client("/TP/GAW/CL/BI-11-C", test_client, service_db_1,
+			&test_long_write_4,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x01, 0x16, 0x07, 0x00, 0x08),
+			raw_pdu(0x18, 0x00),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  5/7] unit/test-gatt: Add TP/GAW/CL/BI-12-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
                   ` (3 preceding siblings ...)
  2015-03-26 12:59 ` [PATCH 4/7] unit/test-gatt: Add TP/GAW/CL/BI-11-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 6/7] unit/test-gatt: Add TP/GAW/CL/BI-13-C test Gowtham Anandha Babu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify Generic Attribute Profile client behavior when the Write
Long Characteristic Value procedure fails due to insufficient
authentication.
---
 unit/test-gatt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index f2c771a..e65d724 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1075,6 +1075,14 @@ static const struct test_step test_long_write_4 = {
 	.length = 0x03
 };
 
+static const struct test_step test_long_write_5 = {
+	.handle = 0x0007,
+	.func = test_long_write,
+	.expected_att_ecode = 0x05,
+	.value = write_data_1,
+	.length = 0x03
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -3641,6 +3649,14 @@ int main(int argc, char *argv[])
 			raw_pdu(0x18, 0x00),
 			raw_pdu(0x19));
 
+	define_test_client("/TP/GAW/CL/BI-12-C", test_client, service_db_1,
+			&test_long_write_5,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x01, 0x16, 0x07, 0x00, 0x05),
+			raw_pdu(0x18, 0x00),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  6/7] unit/test-gatt: Add TP/GAW/CL/BI-13-C test
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
                   ` (4 preceding siblings ...)
  2015-03-26 12:59 ` [PATCH 5/7] unit/test-gatt: Add TP/GAW/CL/BI-12-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-26 12:59 ` [PATCH 7/7] shared/gatt-client: Add const qualifier to prepare write value Gowtham Anandha Babu
  2015-03-27 14:37 ` [PATCH 0/7] Add Write Long Characteristic Value client TC Luiz Augusto von Dentz
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

Verify Generic Attribute Profile client behavior when the Write
Long Characteristic Value procedure fails due to insufficient
encryption key size.
---
 unit/test-gatt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index e65d724..1c1d4bf 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1083,6 +1083,14 @@ static const struct test_step test_long_write_5 = {
 	.length = 0x03
 };
 
+static const struct test_step test_long_write_6 = {
+	.handle = 0x0007,
+	.func = test_long_write,
+	.expected_att_ecode = 0x0c,
+	.value = write_data_1,
+	.length = 0x03
+};
+
 static void att_write_cb(struct gatt_db_attribute *att, int err,
 								void *user_data)
 {
@@ -3657,6 +3665,14 @@ int main(int argc, char *argv[])
 			raw_pdu(0x18, 0x00),
 			raw_pdu(0x19));
 
+	define_test_client("/TP/GAW/CL/BI-13-C", test_client, service_db_1,
+			&test_long_write_6,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+			raw_pdu(0x01, 0x16, 0x07, 0x00, 0x0c),
+			raw_pdu(0x18, 0x00),
+			raw_pdu(0x19));
+
 	define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
 			ts_small_db, NULL,
 			raw_pdu(0x03, 0x00, 0x02),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH  7/7] shared/gatt-client: Add const qualifier to prepare write value
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
                   ` (5 preceding siblings ...)
  2015-03-26 12:59 ` [PATCH 6/7] unit/test-gatt: Add TP/GAW/CL/BI-13-C test Gowtham Anandha Babu
@ 2015-03-26 12:59 ` Gowtham Anandha Babu
  2015-03-27 14:37 ` [PATCH 0/7] Add Write Long Characteristic Value client TC Luiz Augusto von Dentz
  7 siblings, 0 replies; 9+ messages in thread
From: Gowtham Anandha Babu @ 2015-03-26 12:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, cpgs, Gowtham Anandha Babu

For all GATT write operation, value remains constant throughout the
transaction. All bt_gatt_client_write procedure in
src/shared/gatt-client.h follows this convention.
Tested in ubuntu.
---
 src/shared/gatt-client.c | 2 +-
 src/shared/gatt-client.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 729bd87..056f812 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -2703,7 +2703,7 @@ static struct request *get_reliable_request(struct bt_gatt_client *client,
 
 unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
 				unsigned int id, uint16_t value_handle,
-				uint16_t offset, uint8_t *value,
+				uint16_t offset, const uint8_t *value,
 				uint16_t length,
 				bt_gatt_client_write_long_callback_t callback,
 				void *user_data,
diff --git a/src/shared/gatt-client.h b/src/shared/gatt-client.h
index 8e5e0f5..b816cc4 100644
--- a/src/shared/gatt-client.h
+++ b/src/shared/gatt-client.h
@@ -111,7 +111,7 @@ unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client,
 unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client,
 				unsigned int id,
 				uint16_t value_handle, uint16_t offset,
-				uint8_t *value, uint16_t length,
+				const uint8_t *value, uint16_t length,
 				bt_gatt_client_write_long_callback_t callback,
 				void *user_data,
 				bt_gatt_client_destroy_func_t destroy);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/7] Add Write Long Characteristic Value client TC
  2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
                   ` (6 preceding siblings ...)
  2015-03-26 12:59 ` [PATCH 7/7] shared/gatt-client: Add const qualifier to prepare write value Gowtham Anandha Babu
@ 2015-03-27 14:37 ` Luiz Augusto von Dentz
  7 siblings, 0 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2015-03-27 14:37 UTC (permalink / raw)
  To: Gowtham Anandha Babu; +Cc: linux-bluetooth, Bharat Panda, cpgs

Hi Gowtham,

On Thu, Mar 26, 2015 at 2:59 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Adds the below client test cases:
> 1) Write Long Characteristic Value - by Client
> 2) Write Long Characteristic Value - Invalid Handle
> 3) Write Long Characteristic Value - Write Not Permitted
> 4) Write Long Characteristic Value - Insufficient Authorization
> 5) Write Long Characteristic Value - Insufficient Authentication
> 6) Write Long Characteristic Value - Insufficient Encryption Key Size
>
> Gowtham Anandha Babu (7):
>   unit/test-gatt: Add TP/GAW/CL/BV-05-C test
>   unit/test-gatt: Add TP/GAW/CL/BI-07-C test
>   unit/test-gatt: Add TP/GAW/CL/BI-08-C test
>   unit/test-gatt: Add TP/GAW/CL/BI-11-C test
>   unit/test-gatt: Add TP/GAW/CL/BI-12-C test
>   unit/test-gatt: Add TP/GAW/CL/BI-13-C test
>   shared/gatt-client: Add const qualifier to prepare write value
>
>  src/shared/gatt-client.c |   2 +-
>  src/shared/gatt-client.h |   2 +-
>  unit/test-gatt.c         | 331 ++++++++++++++++++++++++++++++++++++++++++++++-
>  3 files changed, 330 insertions(+), 5 deletions(-)
>
> --
> 1.9.1

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-27 14:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 12:59 [PATCH 0/7] Add Write Long Characteristic Value client TC Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 1/7] unit/test-gatt: Add TP/GAW/CL/BV-05-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 2/7] unit/test-gatt: Add TP/GAW/CL/BI-07-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 3/7] unit/test-gatt: Add TP/GAW/CL/BI-08-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 4/7] unit/test-gatt: Add TP/GAW/CL/BI-11-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 5/7] unit/test-gatt: Add TP/GAW/CL/BI-12-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 6/7] unit/test-gatt: Add TP/GAW/CL/BI-13-C test Gowtham Anandha Babu
2015-03-26 12:59 ` [PATCH 7/7] shared/gatt-client: Add const qualifier to prepare write value Gowtham Anandha Babu
2015-03-27 14:37 ` [PATCH 0/7] Add Write Long Characteristic Value client TC Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.