All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/9] Read Long client unit tests
@ 2015-01-27 12:03 Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 1/9] unit/gatt: Add TP/GAR/CL/BV-04-C test Luiz Augusto von Dentz
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

These implement the unit tests for read long procedure as a client and
fix the behavior for values over maximum length.

Luiz Augusto von Dentz (9):
  unit/gatt: Add TP/GAR/CL/BV-04-C test
  unit/gatt: Add TP/GAR/CL/BV-04-C/512B test
  shared/gatt-client: Fix read long value
  unit/gatt: Add TP/GAR/CL/BI-12-C test
  unit/gatt: Add TP/GAR/CL/BI-13-C test
  unit/gatt: Add TP/GAR/CL/BI-14-C test
  unit/gatt: Add TP/GAR/CL/BI-15-C test
  unit/gatt: Add TP/GAR/CL/BI-16-C test
  unit/gatt: Add TP/GAR/CL/BI-17-C test

 src/shared/att-types.h   |   1 +
 src/shared/gatt-client.c |  12 ++-
 unit/test-gatt.c         | 224 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 229 insertions(+), 8 deletions(-)

-- 
2.1.0


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

* [PATCH BlueZ 1/9] unit/gatt: Add TP/GAR/CL/BV-04-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 2/9] unit/gatt: Add TP/GAR/CL/BV-04-C/512B test Luiz Augusto von Dentz
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Verify that a Generic Attribute Profile client can read a Characteristic
Value by selected handle. The Characteristic Value length is unknown to
the client and might be long.
---
 unit/test-gatt.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 98783fd..c49c71f 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1432,6 +1432,23 @@ static void test_read_by_type(gconstpointer data)
 	execute_context(context);
 }
 
+static void test_long_read(struct context *context)
+{
+	const struct test_step *step = context->data->step;
+
+	g_assert(bt_gatt_client_read_long_value(context->client, step->handle,
+						0, multiple_read_cb, context,
+						NULL));
+}
+
+static const struct test_step test_long_read_1 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0,
+	.value = read_data_1,
+	.length = 0x03
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -1968,6 +1985,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0C, 0xF0, 0x0F, 0x00, 0x00),
 			raw_pdu(0x01, 0x0C, 0xF0, 0x0F, 0x01));
 
+	define_test_client("/TP/GAR/CL/BV-04-C", test_client, service_db_1,
+			&test_long_read_1,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x0b, 0x01, 0x02, 0x03));
+
 	define_test_client("/TP/GAR/CL/BV-05-C", test_client, service_db_1,
 			&test_multiple_read_1,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 2/9] unit/gatt: Add TP/GAR/CL/BV-04-C/512B test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 1/9] unit/gatt: Add TP/GAR/CL/BV-04-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 3/9] shared/gatt-client: Fix read long value Luiz Augusto von Dentz
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Verify if long reads works with a value of 512 bytes.
---
 unit/test-gatt.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 122 insertions(+), 1 deletion(-)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index c49c71f..54c8ed5 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1329,7 +1329,7 @@ static void multiple_read_cb(bool success, uint8_t att_ecode,
 	g_assert(att_ecode == step->expected_att_ecode);
 
 	if (success) {
-		g_assert(length == step->length);
+		g_assert_cmpint(length, ==, step->length);
 		g_assert(memcmp(value, step->value, length) == 0);
 	}
 
@@ -1449,6 +1449,17 @@ 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,
+	.expected_att_ecode = 0,
+	.value = long_data_2,
+	.length = sizeof(long_data_2)
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -1991,6 +2002,116 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x0b, 0x01, 0x02, 0x03));
 
+	define_test_client("/TP/GAR/CL/BV-04-C/512B", test_client, service_db_1,
+			&test_long_read_2,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x0d, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 0xff,
+				0xff, 0xff, 0xff, 0xff, 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(0x0c, 0x03, 0x00, 0xff, 0x01),
+			raw_pdu(0x0d, 0xff));
+
 	define_test_client("/TP/GAR/CL/BV-05-C", test_client, service_db_1,
 			&test_multiple_read_1,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 3/9] shared/gatt-client: Fix read long value
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 1/9] unit/gatt: Add TP/GAR/CL/BV-04-C test Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 2/9] unit/gatt: Add TP/GAR/CL/BV-04-C/512B test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 4/9] unit/gatt: Add TP/GAR/CL/BI-12-C test Luiz Augusto von Dentz
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Bluetooth 4.2 vol 3, part F, ch 3.2.9 states: "The maximum length of an
attribute value shall be 512 octets." therefore the code should never
attempt to read past that length.
---
 src/shared/att-types.h   |  1 +
 src/shared/gatt-client.c | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/shared/att-types.h b/src/shared/att-types.h
index 8b6d537..97c12ff 100644
--- a/src/shared/att-types.h
+++ b/src/shared/att-types.h
@@ -29,6 +29,7 @@
 
 #define BT_ATT_DEFAULT_LE_MTU	23
 #define BT_ATT_MAX_LE_MTU	517
+#define BT_ATT_MAX_VALUE_LEN	512
 
 /* ATT protocol opcodes */
 #define BT_ATT_OP_ERROR_RSP	      		0x01
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 1acd34f..04fb4cb 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1927,8 +1927,8 @@ struct read_long_op {
 	struct bt_gatt_client *client;
 	int ref_count;
 	uint16_t value_handle;
-	size_t orig_offset;
-	size_t offset;
+	uint16_t orig_offset;
+	uint16_t offset;
 	struct queue *blobs;
 	bt_gatt_client_read_callback_t callback;
 	void *user_data;
@@ -1950,6 +1950,10 @@ static struct blob *create_blob(const uint8_t *data, uint16_t len,
 	if (!blob)
 		return NULL;
 
+	/* Truncate if the data would exceed maximum length */
+	if (offset + len > BT_ATT_MAX_VALUE_LEN)
+		len = BT_ATT_MAX_VALUE_LEN - offset;
+
 	blob->data = malloc(len);
 	if (!blob->data) {
 		free(blob);
@@ -2050,8 +2054,8 @@ static void read_long_cb(uint8_t opcode, const void *pdu,
 	}
 
 	queue_push_tail(op->blobs, blob);
-	op->offset += length;
-	if (op->offset > UINT16_MAX)
+	op->offset += blob->length;
+	if (op->offset >= BT_ATT_MAX_VALUE_LEN)
 		goto success;
 
 	if (length >= bt_att_get_mtu(op->client->att) - 1) {
-- 
2.1.0


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

* [PATCH BlueZ 4/9] unit/gatt: Add TP/GAR/CL/BI-12-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 3/9] shared/gatt-client: Fix read long value Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 5/9] unit/gatt: Add TP/GAR/CL/BI-13-C test Luiz Augusto von Dentz
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 54c8ed5..811a5fc 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1326,7 +1326,7 @@ static void multiple_read_cb(bool success, uint8_t att_ecode,
 	struct context *context = user_data;
 	const struct test_step *step = context->data->step;
 
-	g_assert(att_ecode == step->expected_att_ecode);
+	g_assert_cmpint(att_ecode, ==, step->expected_att_ecode);
 
 	if (success) {
 		g_assert_cmpint(length, ==, step->length);
@@ -1460,6 +1460,12 @@ static const struct test_step test_long_read_2 = {
 	.length = sizeof(long_data_2)
 };
 
+static const struct test_step test_long_read_3 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x02
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2118,6 +2124,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
 			raw_pdu(0x0f, 0x01, 0x02, 0x03));
 
+	define_test_client("/TP/GAR/CL/BI-12-C", test_client, service_db_1,
+			&test_long_read_3,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x02));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 5/9] unit/gatt: Add TP/GAR/CL/BI-13-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (3 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 4/9] unit/gatt: Add TP/GAR/CL/BI-12-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 6/9] unit/gatt: Add TP/GAR/CL/BI-14-C test Luiz Augusto von Dentz
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 811a5fc..acee87b 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1466,6 +1466,12 @@ static const struct test_step test_long_read_3 = {
 	.expected_att_ecode = 0x02
 };
 
+static const struct test_step test_long_read_4 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x07
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2130,6 +2136,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x02));
 
+	define_test_client("/TP/GAR/CL/BI-13-C", test_client, service_db_1,
+			&test_long_read_4,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x07));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 6/9] unit/gatt: Add TP/GAR/CL/BI-14-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (4 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 5/9] unit/gatt: Add TP/GAR/CL/BI-13-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 7/9] unit/gatt: Add TP/GAR/CL/BI-15-C test Luiz Augusto von Dentz
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index acee87b..2415c4b 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1472,6 +1472,12 @@ static const struct test_step test_long_read_4 = {
 	.expected_att_ecode = 0x07
 };
 
+static const struct test_step test_long_read_5 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x01
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2142,6 +2148,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x07));
 
+	define_test_client("/TP/GAR/CL/BI-14-C", test_client, service_db_1,
+			&test_long_read_5,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x01));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 7/9] unit/gatt: Add TP/GAR/CL/BI-15-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (5 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 6/9] unit/gatt: Add TP/GAR/CL/BI-14-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 8/9] unit/gatt: Add TP/GAR/CL/BI-16-C test Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 2415c4b..c9eb5c3 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1478,6 +1478,12 @@ static const struct test_step test_long_read_5 = {
 	.expected_att_ecode = 0x01
 };
 
+static const struct test_step test_long_read_6 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x08
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2154,6 +2160,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x01));
 
+	define_test_client("/TP/GAR/CL/BI-15-C", test_client, service_db_1,
+			&test_long_read_6,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x08));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 8/9] unit/gatt: Add TP/GAR/CL/BI-16-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (6 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 7/9] unit/gatt: Add TP/GAR/CL/BI-15-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-27 12:03 ` [PATCH BlueZ 9/9] unit/gatt: Add TP/GAR/CL/BI-17-C test Luiz Augusto von Dentz
  2015-01-29 11:11 ` [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index c9eb5c3..8c08c4b 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1484,6 +1484,12 @@ static const struct test_step test_long_read_6 = {
 	.expected_att_ecode = 0x08
 };
 
+static const struct test_step test_long_read_7 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x05
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2166,6 +2172,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x08));
 
+	define_test_client("/TP/GAR/CL/BI-16-C", test_client, service_db_1,
+			&test_long_read_7,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x05));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* [PATCH BlueZ 9/9] unit/gatt: Add TP/GAR/CL/BI-17-C test
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (7 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 8/9] unit/gatt: Add TP/GAR/CL/BI-16-C test Luiz Augusto von Dentz
@ 2015-01-27 12:03 ` Luiz Augusto von Dentz
  2015-01-29 11:11 ` [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-27 12:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 8c08c4b..bbafbda 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1490,6 +1490,12 @@ static const struct test_step test_long_read_7 = {
 	.expected_att_ecode = 0x05
 };
 
+static const struct test_step test_long_read_8 = {
+	.handle = 0x0003,
+	.func = test_long_read,
+	.expected_att_ecode = 0x0c
+};
+
 int main(int argc, char *argv[])
 {
 	struct gatt_db *service_db_1, *ts_small_db, *ts_large_db_1;
@@ -2178,6 +2184,12 @@ int main(int argc, char *argv[])
 			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
 			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x05));
 
+	define_test_client("/TP/GAR/CL/BI-17-C", test_client, service_db_1,
+			&test_long_read_8,
+			SERVICE_DATA_1_PDUS,
+			raw_pdu(0x0c, 0x03, 0x00, 0x00, 0x00),
+			raw_pdu(0x01, 0x0c, 0x03, 0x00, 0x0c));
+
 	define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
 			&test_multiple_read_2,
 			SERVICE_DATA_1_PDUS,
-- 
2.1.0


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

* Re: [PATCH BlueZ 0/9] Read Long client unit tests
  2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
                   ` (8 preceding siblings ...)
  2015-01-27 12:03 ` [PATCH BlueZ 9/9] unit/gatt: Add TP/GAR/CL/BI-17-C test Luiz Augusto von Dentz
@ 2015-01-29 11:11 ` Luiz Augusto von Dentz
  9 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-29 11:11 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Tue, Jan 27, 2015 at 2:03 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> These implement the unit tests for read long procedure as a client and
> fix the behavior for values over maximum length.
>
> Luiz Augusto von Dentz (9):
>   unit/gatt: Add TP/GAR/CL/BV-04-C test
>   unit/gatt: Add TP/GAR/CL/BV-04-C/512B test
>   shared/gatt-client: Fix read long value
>   unit/gatt: Add TP/GAR/CL/BI-12-C test
>   unit/gatt: Add TP/GAR/CL/BI-13-C test
>   unit/gatt: Add TP/GAR/CL/BI-14-C test
>   unit/gatt: Add TP/GAR/CL/BI-15-C test
>   unit/gatt: Add TP/GAR/CL/BI-16-C test
>   unit/gatt: Add TP/GAR/CL/BI-17-C test
>
>  src/shared/att-types.h   |   1 +
>  src/shared/gatt-client.c |  12 ++-
>  unit/test-gatt.c         | 224 ++++++++++++++++++++++++++++++++++++++++++++++-
>  3 files changed, 229 insertions(+), 8 deletions(-)
>
> --
> 2.1.0

Applied.


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2015-01-29 11:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 12:03 [PATCH BlueZ 0/9] Read Long client unit tests Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 1/9] unit/gatt: Add TP/GAR/CL/BV-04-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 2/9] unit/gatt: Add TP/GAR/CL/BV-04-C/512B test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 3/9] shared/gatt-client: Fix read long value Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 4/9] unit/gatt: Add TP/GAR/CL/BI-12-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 5/9] unit/gatt: Add TP/GAR/CL/BI-13-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 6/9] unit/gatt: Add TP/GAR/CL/BI-14-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 7/9] unit/gatt: Add TP/GAR/CL/BI-15-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 8/9] unit/gatt: Add TP/GAR/CL/BI-16-C test Luiz Augusto von Dentz
2015-01-27 12:03 ` [PATCH BlueZ 9/9] unit/gatt: Add TP/GAR/CL/BI-17-C test Luiz Augusto von Dentz
2015-01-29 11:11 ` [PATCH BlueZ 0/9] Read Long client unit tests 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.