2015-02-18 11:09:55

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 00/11] Add Read Long Characteristic Descriptors TC

Fixed the invalid handle in TP/GAR/CL/BI-14-C and added the below
test cases:
1) Read Long Characteristic Descriptors by Client
2) Read Long Characteristic Descriptors - Read Not Permitted
3) Read Long Characteristic Descriptors - Invalid Handle
4) Read Long Characteristic Descriptors - Insufficient Authorization
5) Read Long Characteristic Descriptors - Insufficient Authentication
6) Read Long Characteristic Descriptors - Insufficient Encryption Key Size

Bharat Panda (6):
unit/test-gatt: Add TP/GAR/CL/BI-30-C test
unit/test-gatt: Add TP/GAR/CL/BI-31-C test
unit/test-gatt: Add TP/GAR/CL/BI-32-C test
unit/test-gatt: Add TP/GAR/CL/BI-33-C test
unit/test-gatt: Add TP/GAR/CL/BI-34-C test
unit/test-gatt: Add TP/GAR/CL/BI-35-C test

Gowtham Anandha Babu (5):
unit/test-gatt: Fix invalid handle test case
unit/test-gatt: Add TP/GAR/CL/BV-07-C test
unit/test-gatt: Add TP/GAR/CL/BV-07-C/512B test
unit/test-gatt: Add TP/GAR/CL/BI-28-C test
unit/test-gatt: Add TP/GAR/CL/BI-29-C test

unit/test-gatt.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 221 insertions(+), 3 deletions(-)

--
1.9.1



2015-02-18 15:29:59

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH 01/11] unit/test-gatt: Fix invalid handle test case

Hi Gowtham,

On Wed, Feb 18, 2015 at 1:09 PM, Gowtham Anandha Babu
<[email protected]> wrote:
> The main aim of TC TP/GAR/CL/BI-14-C is to check the handle validity.
> So, the requested handle in the pdu should be invalid (0x0000).
> ---
> unit/test-gatt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/unit/test-gatt.c b/unit/test-gatt.c
> index 441cf34..2fc0595 100644
> --- a/unit/test-gatt.c
> +++ b/unit/test-gatt.c
> @@ -1591,7 +1591,7 @@ static const struct test_step test_long_read_4 = {
> };
>
> static const struct test_step test_long_read_5 = {
> - .handle = 0x0003,
> + .handle = 0x0000,
> .func = test_long_read,
> .expected_att_ecode = 0x01
> };
> @@ -2415,8 +2415,8 @@ int main(int argc, char *argv[])
> 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));
> + raw_pdu(0x0c, 0x00, 0x00, 0x00, 0x00),
> + raw_pdu(0x01, 0x0c, 0x00, 0x00, 0x01));
>
> define_test_client("/TP/GAR/CL/BI-15-C", test_client, service_db_1,
> &test_long_read_6,
> --
> 1.9.1

Applied, I had to fix the messages to be within 72 columns, but
otherwise these nice and clean patches so thanks.


--
Luiz Augusto von Dentz

2015-02-18 11:10:06

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 11/11] unit/test-gatt: Add TP/GAR/CL/BI-35-C test

From: Bharat Panda <[email protected]>

Verify Generic Attribute Profile client behavior when an attempt to use
LE transport to execute the Read Characteristic Value procedure on a
characteristic contained within a service defined for use only over
BR/EDR transport.
---
unit/test-gatt.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 51f2179..2be4c87 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -2873,5 +2873,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0a, 0x03, 0x00),
raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));

+ define_test_client("/TP/GAR/CL/BI-35-C", test_client, service_db_1,
+ &test_read_12,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0a, 0x03, 0x00),
+ raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:05

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 10/11] unit/test-gatt: Add TP/GAR/CL/BI-34-C test

From: Bharat Panda <[email protected]>

Verify Generic Attribute Profile client behavior when an attempt to use
BR/EDR transport to execute the Read Characteristic Value procedure on a
characteristic contained within a service defined for use only over
LE transport.
---
unit/test-gatt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 082527c..51f2179 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -772,6 +772,12 @@ static const struct test_step test_read_11 = {
.expected_att_ecode = 0x0c,
};

+static const struct test_step test_read_12 = {
+ .handle = 0x0003,
+ .func = test_read,
+ .expected_att_ecode = 0x80,
+};
+
static void att_write_cb(struct gatt_db_attribute *att, int err,
void *user_data)
{
@@ -2861,5 +2867,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x0c));

+ define_test_client("/TP/GAR/CL/BI-34-C", test_client, service_db_1,
+ &test_read_12,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0a, 0x03, 0x00),
+ raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:04

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 09/11] unit/test-gatt: Add TP/GAR/CL/BI-33-C test

From: Bharat Panda <[email protected]>

Verify Generic Attribute Profile client behavior when the Read Long
Characteristic Descriptor 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 182251b..082527c 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1656,6 +1656,12 @@ static const struct test_step test_long_read_14 = {
.expected_att_ecode = 0x05
};

+static const struct test_step test_long_read_15 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0x0c
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2849,5 +2855,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x05));

+ define_test_client("/TP/GAR/CL/BI-33-C", test_client, service_db_1,
+ &test_long_read_15,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x0c));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:03

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 08/11] unit/test-gatt: Add TP/GAR/CL/BI-32-C test

From: Bharat Panda <[email protected]>

Verify Generic Attribute Profile client behavior when the Read Long
Characteristic Descriptor 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 39c3966..182251b 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1650,6 +1650,12 @@ static const struct test_step test_long_read_13 = {
.expected_att_ecode = 0x08
};

+static const struct test_step test_long_read_14 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0x05
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2837,5 +2843,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x08));

+ define_test_client("/TP/GAR/CL/BI-32-C", test_client, service_db_1,
+ &test_long_read_14,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x05));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:02

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 07/11] unit/test-gatt: Add TP/GAR/CL/BI-31-C test

From: Bharat Panda <[email protected]>

Verify Generic Attribute Profile client behavior when the Read Long
Characteristic Descriptor 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 9a657eb..39c3966 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1644,6 +1644,12 @@ static const struct test_step test_long_read_12 = {
.expected_att_ecode = 0x07
};

+static const struct test_step test_long_read_13 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0x08
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2825,5 +2831,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x00, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x00, 0x00, 0x01));

+ define_test_client("/TP/GAR/CL/BI-31-C", test_client, service_db_1,
+ &test_long_read_13,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x08));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:01

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 06/11] unit/test-gatt: Add TP/GAR/CL/BI-30-C test

From: Bharat Panda <[email protected]>

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 36565bd..9a657eb 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -2819,5 +2819,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x07));

+ define_test_client("/TP/GAR/CL/BI-30-C", test_client, service_db_1,
+ &test_long_read_5,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x00, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x00, 0x00, 0x01));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:10:00

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 05/11] unit/test-gatt: Add TP/GAR/CL/BI-29-C test

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 47692b8..36565bd 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1638,6 +1638,12 @@ static const struct test_step test_long_read_11 = {
.expected_att_ecode = 0x02
};

+static const struct test_step test_long_read_12 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0x07
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2807,5 +2813,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x02));

+ define_test_client("/TP/GAR/CL/BI-29-C", test_client, service_db_1,
+ &test_long_read_12,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x07));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:09:59

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 04/11] unit/test-gatt: Add TP/GAR/CL/BI-28-C test

Verify Generic Attribute Profile client behavior when the Read Long
Characteristic Descriptor 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 276fa57..47692b8 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1632,6 +1632,12 @@ static const struct test_step test_long_read_10 = {
.length = sizeof(long_data_2)
};

+static const struct test_step test_long_read_11 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0x02
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2795,5 +2801,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0xff, 0x01),
raw_pdu(0x0d, 0xff));

+ define_test_client("/TP/GAR/CL/BI-28-C", test_client, service_db_1,
+ &test_long_read_11,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x04, 0x00, 0x02));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:09:58

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 03/11] unit/test-gatt: Add TP/GAR/CL/BV-07-C/512B test

Verify that a Generic Attribute Profile client can read a characteristic descriptor
by selected handle. The Characteristic Descriptor length is unknown to the client
and might be long with a value of 512 bytes.
---
unit/test-gatt.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 118 insertions(+)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 295d10b..276fa57 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1624,6 +1624,14 @@ static const struct test_step test_long_read_9 = {
.length = 0x03
};

+static const struct test_step test_long_read_10 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0,
+ .value = long_data_2,
+ .length = sizeof(long_data_2)
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2677,5 +2685,115 @@ int main(int argc, char *argv[])
raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
raw_pdu(0x0b, 0x01, 0x02, 0x03));

+ define_test_client("/TP/GAR/CL/BV-07-C/512B", test_client, service_db_1,
+ &test_long_read_10,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 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, 0x04, 0x00, 0xff, 0x01),
+ raw_pdu(0x0d, 0xff));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:09:57

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 02/11] unit/test-gatt: Add TP/GAR/CL/BV-07-C test

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

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 2fc0595..295d10b 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1614,6 +1614,16 @@ static const struct test_step test_long_read_8 = {
.expected_att_ecode = 0x0c
};

+/* Descriptor test data's */
+
+static const struct test_step test_long_read_9 = {
+ .handle = 0x0004,
+ .func = test_long_read,
+ .expected_att_ecode = 0,
+ .value = read_data_1,
+ .length = 0x03
+};
+
static void notification_cb(uint16_t value_handle, const uint8_t *value,
uint16_t length, void *user_data)
{
@@ -2661,5 +2671,11 @@ int main(int argc, char *argv[])
raw_pdu(0x0a, 0x04, 0x00),
raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x0c));

+ define_test_client("/TP/GAR/CL/BV-07-C", test_client, service_db_1,
+ &test_long_read_9,
+ SERVICE_DATA_1_PDUS,
+ raw_pdu(0x0c, 0x04, 0x00, 0x00, 0x00),
+ raw_pdu(0x0b, 0x01, 0x02, 0x03));
+
return g_test_run();
}
--
1.9.1


2015-02-18 11:09:56

by Gowtham Anandha Babu

[permalink] [raw]
Subject: [PATCH 01/11] unit/test-gatt: Fix invalid handle test case

The main aim of TC TP/GAR/CL/BI-14-C is to check the handle validity.
So, the requested handle in the pdu should be invalid (0x0000).
---
unit/test-gatt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 441cf34..2fc0595 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1591,7 +1591,7 @@ static const struct test_step test_long_read_4 = {
};

static const struct test_step test_long_read_5 = {
- .handle = 0x0003,
+ .handle = 0x0000,
.func = test_long_read,
.expected_att_ecode = 0x01
};
@@ -2415,8 +2415,8 @@ int main(int argc, char *argv[])
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));
+ raw_pdu(0x0c, 0x00, 0x00, 0x00, 0x00),
+ raw_pdu(0x01, 0x0c, 0x00, 0x00, 0x01));

define_test_client("/TP/GAR/CL/BI-15-C", test_client, service_db_1,
&test_long_read_6,
--
1.9.1