public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue
@ 2014-07-15  8:24 Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

It will be simplier to add new cases.
---
 android/tester-bluetooth.c | 35 +++++++++++++++--------------------
 android/tester-gatt.c      | 11 +++++++++--
 android/tester-hidhost.c   | 11 +++++++++--
 android/tester-socket.c    | 11 +++++++++--
 4 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 56518ea..202d085 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -235,30 +235,25 @@ static struct test_case bluetooth_setprop_disctimeout_success_tc = {
 				bluetooth_setprop_disctimeout_success_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&bluetooth_init,
+	&bluetooth_enable_success_tc,
+	&bluetooth_enable_success2_tc,
+	&bluetooth_disable_success_tc,
+	&bluetooth_setprop_bdname_success_tc,
+	&bluetooth_setprop_scanmode_success_tc,
+	&bluetooth_setprop_disctimeout_success_tc,
+};
+
 struct queue *get_bluetooth_tests(void)
 {
-	list = queue_new();
-
-	if (!queue_push_tail(list, &bluetooth_init))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_enable_success_tc))
-		return NULL;
+	uint16_t i = 0;
 
-	if (!queue_push_tail(list, &bluetooth_enable_success2_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_disable_success_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_setprop_bdname_success_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_setprop_scanmode_success_tc))
-		return NULL;
+	list = queue_new();
 
-	if (!queue_push_tail(list, &bluetooth_setprop_disctimeout_success_tc))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index b58886f..4a7c9b1 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -30,12 +30,19 @@ static struct test_case gatt_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&gatt_init,
+};
+
 struct queue *get_gatt_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &gatt_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
index 87c9452..413c6b8 100644
--- a/android/tester-hidhost.c
+++ b/android/tester-hidhost.c
@@ -30,12 +30,19 @@ static struct test_case hidhost_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&hidhost_init,
+};
+
 struct queue *get_hidhost_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &hidhost_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-socket.c b/android/tester-socket.c
index 8e8b6d2..a57b324 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -30,12 +30,19 @@ static struct test_case socket_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&socket_init,
+};
+
 struct queue *get_socket_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &socket_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
-- 
1.9.1


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

* [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 03/10] android/tester-ng: Set proper callback count Jakub Tyszkowski
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

If no callback count was set in the step, test passed despite valid properties
still waiting to be verified.
---
 android/tester-main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/android/tester-main.c b/android/tester-main.c
index 8a1f6ed..f5bcb1c 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -376,6 +376,14 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props,
 		}
 	}
 
+	if ((i == 0) && exp_props) {
+		tester_warn("No property was verified: %s", exp_num_props ?
+				"unknown error!" :
+				"wrong \'.callback_result.num_properties\'?");
+
+		return 1;
+	}
+
 	return exp_prop_to_find;
 }
 
-- 
1.9.1


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

* [PATCH 03/10] android/tester-ng: Set proper callback count
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 04/10] android/tester-ng: Verify action results also for success case Jakub Tyszkowski
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This was a missing piece after fixing the callback count verifying
routine.
---
 android/tester-bluetooth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 202d085..fc04c9d 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -157,6 +157,7 @@ static struct step bluetooth_setprop_bdname_success_steps[] = {
 	{
 		.callback = CB_BT_ADAPTER_PROPERTIES,
 		.callback_result.properties = &setprop_bdname_prop,
+		.callback_result.num_properties = 1,
 	}
 };
 static struct test_case bluetooth_setprop_bdname_success_tc = {
@@ -192,6 +193,7 @@ static struct step bluetooth_setprop_scanmode_success_steps[] = {
 	{
 		.callback = CB_BT_ADAPTER_PROPERTIES,
 		.callback_result.properties = &setprop_scanmode_prop,
+		.callback_result.num_properties = 1,
 	},
 };
 static struct test_case bluetooth_setprop_scanmode_success_tc = {
-- 
1.9.1


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

* [PATCH 04/10] android/tester-ng: Verify action results also for success case
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 03/10] android/tester-ng: Set proper callback count Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 05/10] android/tester-bluetooth: Add get bdaddr and bdname success cases Jakub Tyszkowski
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Case when we were expecting fail as action result but we got success was
not caught.
---
 android/tester-main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index f5bcb1c..5bafc0e 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -404,8 +404,7 @@ static bool match_data(struct step *step)
 		return false;
 	}
 
-	if (exp->action_result.status && (exp->action_result.status !=
-						step->action_result.status)) {
+	if (exp->action_result.status != step->action_result.status) {
 		tester_debug("Action status don't match");
 		return false;
 	}
-- 
1.9.1


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

* [PATCH 05/10] android/tester-bluetooth: Add get bdaddr and bdname success cases
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (2 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 04/10] android/tester-ng: Verify action results also for success case Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 06/10] android/tester-bluetooth: Add various property set fail cases Jakub Tyszkowski
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-bluetooth.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.c      | 22 ++++++++++++++
 android/tester-main.h      |  1 +
 3 files changed, 97 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index fc04c9d..6c05620 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -237,6 +237,78 @@ static struct test_case bluetooth_setprop_disctimeout_success_tc = {
 				bluetooth_setprop_disctimeout_success_steps),
 };
 
+static bt_bdaddr_t test_getprop_bdaddr_val = {
+	{0x00, 0xaa, 0x01, 0x00, 0x00, 0x00},
+};
+
+static bt_property_t getprop_bdaddr_prop = {
+	.type = BT_PROPERTY_BDADDR,
+	.val = &test_getprop_bdaddr_val,
+	.len = sizeof(test_getprop_bdaddr_val),
+};
+
+static struct step bluetooth_getprop_bdaddr_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_bdaddr_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_bdaddr_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_bdaddr_success_tc = {
+	.step = bluetooth_getprop_bdaddr_success_steps,
+	.title = "Bluetooth Get BDADDR - Success",
+	.step_num = get_test_case_step_num(
+					bluetooth_getprop_bdaddr_success_steps),
+};
+
+static const char test_getprop_bdname_val[] = "BlueZ for Android";
+
+static bt_property_t getprop_bdname_prop = {
+	.type = BT_PROPERTY_BDNAME,
+	.val = &test_getprop_bdname_val,
+	.len = sizeof(test_getprop_bdname_val) - 1,
+};
+
+static struct step bluetooth_getprop_bdname_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_bdname_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_bdname_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_bdname_success_tc = {
+	.step = bluetooth_getprop_bdname_success_steps,
+	.title = "Bluetooth Get BDNAME - Success",
+	.step_num = get_test_case_step_num(
+					bluetooth_getprop_bdname_success_steps),
+};
+
 static struct test_case *test_cases[] = {
 	&bluetooth_init,
 	&bluetooth_enable_success_tc,
@@ -245,6 +317,8 @@ static struct test_case *test_cases[] = {
 	&bluetooth_setprop_bdname_success_tc,
 	&bluetooth_setprop_scanmode_success_tc,
 	&bluetooth_setprop_disctimeout_success_tc,
+	&bluetooth_getprop_bdaddr_success_tc,
+	&bluetooth_getprop_bdname_success_tc,
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.c b/android/tester-main.c
index 5bafc0e..e8cd4f2 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -911,6 +911,28 @@ void bt_set_property_action(void)
 	verify_step(&step, NULL);
 }
 
+void bt_get_property_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step step;
+	struct step *current_data_step = queue_peek_head(data->steps);
+	bt_property_t *prop;
+
+	if (!current_data_step->set_data) {
+		tester_debug("BT property to get not defined");
+		tester_test_failed();
+		return;
+	}
+
+	prop = (bt_property_t *)current_data_step->set_data;
+
+	memset(&step, 0, sizeof(step));
+	step.action_result.status = data->if_bluetooth->get_adapter_property(
+								prop->type);
+
+	verify_step(&step, NULL);
+}
+
 static void generic_test_function(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
diff --git a/android/tester-main.h b/android/tester-main.h
index a740f6b..c10513e 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -189,3 +189,4 @@ void dummy_action(void);
 void bluetooth_enable_action(void);
 void bluetooth_disable_action(void);
 void bt_set_property_action(void);
+void bt_get_property_action(void);
-- 
1.9.1


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

* [PATCH 06/10] android/tester-bluetooth: Add various property set fail cases
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (3 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 05/10] android/tester-bluetooth: Add get bdaddr and bdname success cases Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 07/10] android/tester-bluetooth: Add set scan mode success case Jakub Tyszkowski
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

These cases should fail as they are read only props.
---
 android/tester-bluetooth.c | 225 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 225 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 6c05620..ce777b0 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -309,6 +309,224 @@ static struct test_case bluetooth_getprop_bdname_success_tc = {
 					bluetooth_getprop_bdname_success_steps),
 };
 
+
+static unsigned char setprop_uuids[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
+			0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00 };
+
+static bt_property_t setprop_uuid_prop = {
+	.type = BT_PROPERTY_UUIDS,
+	.val = &setprop_uuids,
+	.len = sizeof(setprop_uuids),
+};
+
+static struct step bluetooth_setprop_uuid_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_uuid_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_uuid_fail_tc = {
+	.step = bluetooth_setprop_uuid_fail_steps,
+	.title = "Bluetooth Set UUID - Fail",
+	.step_num = get_test_case_step_num(bluetooth_setprop_uuid_fail_steps),
+};
+
+static uint32_t setprop_cod_val = 0;
+
+static bt_property_t setprop_cod_prop = {
+	.type = BT_PROPERTY_CLASS_OF_DEVICE,
+	.val = &setprop_cod_val,
+	.len = sizeof(setprop_cod_val),
+};
+
+static struct step bluetooth_setprop_cod_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_cod_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_cod_fail_tc = {
+	.step = bluetooth_setprop_cod_fail_steps,
+	.title = "Bluetooth Set CLASS_OF_DEVICE - Fail",
+	.step_num = get_test_case_step_num(bluetooth_setprop_cod_fail_steps),
+};
+
+static uint32_t setprop_tod_val = BT_DEVICE_DEVTYPE_DUAL;
+
+static bt_property_t setprop_tod_prop = {
+	.type = BT_PROPERTY_TYPE_OF_DEVICE,
+	.val = &setprop_tod_val,
+	.len = sizeof(setprop_tod_val),
+};
+
+static struct step bluetooth_setprop_tod_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_tod_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_tod_fail_tc = {
+	.step = bluetooth_setprop_tod_fail_steps,
+	.title = "Bluetooth Set TYPE_OF_DEVICE - Fail",
+	.step_num = get_test_case_step_num(bluetooth_setprop_tod_fail_steps),
+};
+
+static int32_t setprop_remote_rssi_val = -9;
+
+static bt_property_t setprop_remote_rssi_prop = {
+	.type = BT_PROPERTY_REMOTE_RSSI,
+	.val = &setprop_remote_rssi_val,
+	.len = sizeof(setprop_remote_rssi_val),
+};
+
+static struct step bluetooth_setprop_remote_rssi_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_remote_rssi_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_remote_rssi_fail_tc = {
+	.step = bluetooth_setprop_remote_rssi_fail_steps,
+	.title = "Bluetooth Set REMOTE_RSSI - Fail",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_remote_rssi_fail_steps),
+};
+
+static bt_service_record_t setprop_srvc_record_val =  {
+	.uuid = { {0x00} },
+	.channel = 12,
+	.name = "bt_name",
+};
+
+static bt_property_t setprop_srvc_record_prop = {
+	.type = BT_PROPERTY_SERVICE_RECORD,
+	.val = &setprop_srvc_record_val,
+	.len = sizeof(setprop_srvc_record_val),
+};
+
+static struct step bluetooth_setprop_srvc_record_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_srvc_record_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_srvc_record_fail_tc = {
+	.step = bluetooth_setprop_srvc_record_fail_steps,
+	.title = "Bluetooth Set SERVICE_RECORD - Fail",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_srvc_record_fail_steps),
+};
+
+static bt_bdaddr_t setprop_bdaddr_val = {
+	.address = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+};
+
+static bt_property_t setprop_bdaddr_prop = {
+	.type = BT_PROPERTY_BDADDR,
+	.val = &setprop_bdaddr_val,
+	.len = sizeof(setprop_bdaddr_val),
+};
+
+static struct step bluetooth_setprop_bdaddr_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_bdaddr_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_bdaddr_fail_tc = {
+	.step = bluetooth_setprop_bdaddr_fail_steps,
+	.title = "Bluetooth Set BDADDR - Fail",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_bdaddr_fail_steps),
+};
+
+static bt_bdaddr_t setprop_bonded_dev_val = {
+	.address = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 },
+};
+
+static bt_property_t setprop_bonded_dev_prop = {
+	.type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
+	.val = &setprop_bonded_dev_val,
+	.len = sizeof(setprop_bonded_dev_val),
+};
+
+static struct step bluetooth_setprop_bonded_dev_fail_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_FAIL,
+		.set_data = &setprop_bonded_dev_prop,
+		.action = bt_set_property_action,
+	},
+};
+static struct test_case bluetooth_setprop_bonded_dev_fail_tc = {
+	.step = bluetooth_setprop_bonded_dev_fail_steps,
+	.title = "Bluetooth Set BONDED_DEVICES - Fail",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_bonded_dev_fail_steps),
+};
+
 static struct test_case *test_cases[] = {
 	&bluetooth_init,
 	&bluetooth_enable_success_tc,
@@ -319,6 +537,13 @@ static struct test_case *test_cases[] = {
 	&bluetooth_setprop_disctimeout_success_tc,
 	&bluetooth_getprop_bdaddr_success_tc,
 	&bluetooth_getprop_bdname_success_tc,
+	&bluetooth_setprop_uuid_fail_tc,
+	&bluetooth_setprop_cod_fail_tc,
+	&bluetooth_setprop_tod_fail_tc,
+	&bluetooth_setprop_remote_rssi_fail_tc,
+	&bluetooth_setprop_srvc_record_fail_tc,
+	&bluetooth_setprop_bdaddr_fail_tc,
+	&bluetooth_setprop_bonded_dev_fail_tc,
 };
 
 struct queue *get_bluetooth_tests(void)
-- 
1.9.1


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

* [PATCH 07/10] android/tester-bluetooth: Add set scan mode success case
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (4 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 06/10] android/tester-bluetooth: Add various property set fail cases Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 08/10] android/tester-bluetooth: Add get properties success cases Jakub Tyszkowski
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-bluetooth.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index ce777b0..a8eecb6 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -527,6 +527,41 @@ static struct test_case bluetooth_setprop_bonded_dev_fail_tc = {
 				bluetooth_setprop_bonded_dev_fail_steps),
 };
 
+static bt_scan_mode_t setprop_scan_mode_conn_val = BT_SCAN_MODE_CONNECTABLE;
+
+static bt_property_t setprop_scan_mode_conn_prop = {
+	.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
+	.val = &setprop_scan_mode_conn_val,
+	.len = sizeof(setprop_scan_mode_conn_val),
+};
+
+static struct step bluetooth_setprop_scan_mode_conn_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &setprop_scan_mode_conn_prop,
+		.action = bt_set_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &setprop_scan_mode_conn_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_setprop_scan_mode_conn_success_tc = {
+	.step = bluetooth_setprop_scan_mode_conn_success_steps,
+	.title = "Bluetooth Set SCAN_MODE_CONNECTABLE - SUCCESS",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_scan_mode_conn_success_steps),
+};
+
 static struct test_case *test_cases[] = {
 	&bluetooth_init,
 	&bluetooth_enable_success_tc,
@@ -544,6 +579,7 @@ static struct test_case *test_cases[] = {
 	&bluetooth_setprop_srvc_record_fail_tc,
 	&bluetooth_setprop_bdaddr_fail_tc,
 	&bluetooth_setprop_bonded_dev_fail_tc,
+	&bluetooth_setprop_scan_mode_conn_success_tc,
 };
 
 struct queue *get_bluetooth_tests(void)
-- 
1.9.1


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

* [PATCH 08/10] android/tester-bluetooth: Add get properties success cases
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (5 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 07/10] android/tester-bluetooth: Add set scan mode success case Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 09/10] android/tester-bluetooth: Add set scan mode none succes case Jakub Tyszkowski
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-bluetooth.c | 219 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 219 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index a8eecb6..d69134b 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -562,6 +562,219 @@ static struct test_case bluetooth_setprop_scan_mode_conn_success_tc = {
 				bluetooth_setprop_scan_mode_conn_success_steps),
 };
 
+static uint32_t test_getprop_cod_val = 0x00020c;
+
+static bt_property_t getprop_cod_prop = {
+	.type = BT_PROPERTY_CLASS_OF_DEVICE,
+	.val = &test_getprop_cod_val,
+	.len = sizeof(test_getprop_cod_val),
+};
+
+static struct step bluetooth_getprop_cod_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_cod_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_cod_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_cod_success_tc = {
+	.step = bluetooth_getprop_cod_success_steps,
+	.title = "Bluetooth Get CLASS_OF_DEVICE - Success",
+	.step_num = get_test_case_step_num(bluetooth_getprop_cod_success_steps),
+};
+
+static bt_device_type_t test_getprop_tod_val = BT_DEVICE_DEVTYPE_DUAL;
+
+static bt_property_t getprop_tod_prop = {
+	.type = BT_PROPERTY_TYPE_OF_DEVICE,
+	.val = &test_getprop_tod_val,
+	.len = sizeof(test_getprop_tod_val),
+};
+
+static struct step bluetooth_getprop_tod_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_tod_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_tod_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_tod_success_tc = {
+	.step = bluetooth_getprop_tod_success_steps,
+	.title = "Bluetooth Get TYPE_OF_DEVICE - Success",
+	.step_num = get_test_case_step_num(bluetooth_getprop_tod_success_steps),
+};
+
+static bt_scan_mode_t test_getprop_scan_mode_val = BT_SCAN_MODE_NONE;
+
+static bt_property_t getprop_scan_mode_prop = {
+	.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
+	.val = &test_getprop_scan_mode_val,
+	.len = sizeof(test_getprop_scan_mode_val),
+};
+
+static struct step bluetooth_getprop_scan_mode_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_scan_mode_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_scan_mode_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_scan_mode_success_tc = {
+	.step = bluetooth_getprop_scan_mode_success_steps,
+	.title = "Bluetooth Get SCAN_MODE - Success",
+	.step_num = get_test_case_step_num(
+				bluetooth_getprop_scan_mode_success_steps),
+};
+
+static uint32_t test_getprop_disc_timeout_val = 120;
+
+static bt_property_t getprop_disc_timeout_prop = {
+	.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+	.val = &test_getprop_disc_timeout_val,
+	.len = sizeof(test_getprop_disc_timeout_val),
+};
+
+static struct step bluetooth_getprop_disc_timeout_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_disc_timeout_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_disc_timeout_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_disc_timeout_success_tc = {
+	.step = bluetooth_getprop_disc_timeout_success_steps,
+	.title = "Bluetooth Get DISCOVERY_TIMEOUT - Success",
+	.step_num = get_test_case_step_num(
+				bluetooth_getprop_disc_timeout_success_steps),
+};
+
+static const char test_getprop_uuids_val[] = {
+	/* Multi profile UUID */
+	0x00, 0x00, 0x11, 0x3b, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
+					0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB,
+	/* Device identification profile UUID */
+	0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
+					0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB,
+};
+
+static bt_property_t getprop_uuids_prop = {
+	.type = BT_PROPERTY_UUIDS,
+	.val = &test_getprop_uuids_val,
+	.len = sizeof(test_getprop_uuids_val),
+};
+
+static struct step bluetooth_getprop_uuids_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_uuids_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_uuids_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_uuids_success_tc = {
+	.step = bluetooth_getprop_uuids_success_steps,
+	.title = "Bluetooth Get UUIDS - Success",
+	.step_num = get_test_case_step_num(
+					bluetooth_getprop_uuids_success_steps),
+};
+
+static bt_property_t getprop_bonded_devs_prop = {
+	.type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
+	.val = NULL,
+	.len = 0,
+};
+
+static struct step bluetooth_getprop_bonded_devs_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &getprop_bonded_devs_prop,
+		.action = bt_get_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &getprop_bonded_devs_prop,
+		.callback_result.num_properties = 1,
+	},
+};
+static struct test_case bluetooth_getprop_bonded_devs_success_tc = {
+	.step = bluetooth_getprop_bonded_devs_success_steps,
+	.title = "Bluetooth Get BONDED_DEVICES - Success",
+	.step_num = get_test_case_step_num(
+				bluetooth_getprop_bonded_devs_success_steps),
+};
+
 static struct test_case *test_cases[] = {
 	&bluetooth_init,
 	&bluetooth_enable_success_tc,
@@ -580,6 +793,12 @@ static struct test_case *test_cases[] = {
 	&bluetooth_setprop_bdaddr_fail_tc,
 	&bluetooth_setprop_bonded_dev_fail_tc,
 	&bluetooth_setprop_scan_mode_conn_success_tc,
+	&bluetooth_getprop_cod_success_tc,
+	&bluetooth_getprop_tod_success_tc,
+	&bluetooth_getprop_scan_mode_success_tc,
+	&bluetooth_getprop_disc_timeout_success_tc,
+	&bluetooth_getprop_uuids_success_tc,
+	&bluetooth_getprop_bonded_devs_success_tc,
 };
 
 struct queue *get_bluetooth_tests(void)
-- 
1.9.1


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

* [PATCH 09/10] android/tester-bluetooth: Add set scan mode none succes case
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (6 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 08/10] android/tester-bluetooth: Add get properties success cases Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 10/10] android/tester: Remove old cases Jakub Tyszkowski
  2014-07-16 15:31 ` [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Szymon Janc
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-bluetooth.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index d69134b..78a27f7 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -775,6 +775,41 @@ static struct test_case bluetooth_getprop_bonded_devs_success_tc = {
 				bluetooth_getprop_bonded_devs_success_steps),
 };
 
+static bt_scan_mode_t test_setprop_scanmode_val2 = BT_SCAN_MODE_NONE;
+
+static bt_property_t setprop_scan_mode2_prop = {
+	.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
+	.val = &test_setprop_scanmode_val2,
+	.len = sizeof(test_setprop_scanmode_val2),
+};
+
+static struct step bluetooth_setprop_scan_mode2_success_steps[] = {
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.action = bluetooth_enable_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_STATE_CHANGED,
+		.callback_result.state = BT_STATE_ON,
+	},
+	{
+		.action_result.status = BT_STATUS_SUCCESS,
+		.set_data = &setprop_scan_mode2_prop,
+		.action = bt_set_property_action,
+	},
+	{
+		.callback = CB_BT_ADAPTER_PROPERTIES,
+		.callback_result.properties = &setprop_scan_mode2_prop,
+		.callback_result.num_properties = 1,
+	}
+};
+static struct test_case bluetooth_setprop_scan_mode2_success_tc = {
+	.step = bluetooth_setprop_scan_mode2_success_steps,
+	.title = "Bluetooth Set SCAN_MODE - Success",
+	.step_num = get_test_case_step_num(
+				bluetooth_setprop_scan_mode2_success_steps),
+};
+
 static struct test_case *test_cases[] = {
 	&bluetooth_init,
 	&bluetooth_enable_success_tc,
@@ -799,6 +834,7 @@ static struct test_case *test_cases[] = {
 	&bluetooth_getprop_disc_timeout_success_tc,
 	&bluetooth_getprop_uuids_success_tc,
 	&bluetooth_getprop_bonded_devs_success_tc,
+	&bluetooth_setprop_scan_mode2_success_tc,
 };
 
 struct queue *get_bluetooth_tests(void)
-- 
1.9.1


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

* [PATCH 10/10] android/tester: Remove old cases
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (7 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 09/10] android/tester-bluetooth: Add set scan mode none succes case Jakub Tyszkowski
@ 2014-07-15  8:24 ` Jakub Tyszkowski
  2014-07-16 15:31 ` [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Szymon Janc
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Those were already reimplemented using newer testing framework.
---
 android/android-tester.c | 639 -----------------------------------------------
 1 file changed, 639 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 09aece5..eb5c513 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1074,15 +1074,6 @@ static void device_found_cb(int num_properties, bt_property_t *properties)
 	g_idle_add(device_found, cb_data);
 }
 
-static void check_count_properties_cb(bt_status_t status, int num_properties,
-						bt_property_t *properties)
-{
-	int i;
-
-	for (i = 0; i < num_properties; i++)
-		check_expected_property(properties[i]);
-}
-
 static gboolean adapter_properties(gpointer user_data)
 {
 	struct test_data *data = tester_get_data();
@@ -1385,314 +1376,6 @@ static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
 	g_idle_add(ssp_request, cb_data);
 }
 
-static bt_scan_mode_t test_setprop_scanmode_val =
-					BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
-
-static struct priority_property setprop_scanmode_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
-	.prop.val = &test_setprop_scanmode_val,
-	.prop.len = sizeof(bt_scan_mode_t),
-	},
-};
-
-static uint32_t test_setprop_disctimeout_val = 120;
-
-static struct priority_property setprop_disctimeout_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
-	.prop.val = &test_setprop_disctimeout_val,
-	.prop.len = sizeof(test_setprop_disctimeout_val),
-	},
-};
-
-static bt_bdaddr_t test_getprop_bdaddr_val = { {0x00} };
-
-static struct priority_property getprop_bdaddr_props[] = {
-	{
-	.prop.type = BT_PROPERTY_BDADDR,
-	.prop.val = &test_getprop_bdaddr_val,
-	.prop.len = sizeof(test_getprop_bdaddr_val),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_bdaddr_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static const char test_bdname[] = "test_bdname_setget";
-
-static struct priority_property getprop_bdname_props[] = {
-	{
-	.prop.type = BT_PROPERTY_BDNAME,
-	.prop.val = &test_bdname,
-	.prop.len = sizeof(test_bdname) - 1,
-	},
-};
-
-static const struct generic_data bluetooth_getprop_bdname_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_bdname_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static unsigned char setprop_uuids[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
-			0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00 };
-
-static struct priority_property setprop_uuid_prop[] = {
-	{
-	.prop.type = BT_PROPERTY_UUIDS,
-	.prop.val = &setprop_uuids,
-	.prop.len = sizeof(setprop_uuids),
-	},
-};
-
-static const struct generic_data bluetooth_setprop_uuid_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static uint32_t setprop_class_of_device = 0;
-
-static struct priority_property setprop_cod_props[] = {
-	{
-	.prop.type = BT_PROPERTY_CLASS_OF_DEVICE,
-	.prop.val = &setprop_class_of_device,
-	.prop.len = sizeof(setprop_class_of_device),
-	},
-};
-
-static const struct generic_data bluetooth_setprop_cod_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static bt_device_type_t setprop_type_of_device = BT_DEVICE_DEVTYPE_DUAL;
-
-static struct priority_property setprop_tod_props[] = {
-	{
-	.prop.type = BT_PROPERTY_TYPE_OF_DEVICE,
-	.prop.val = &setprop_type_of_device,
-	.prop.len = sizeof(setprop_type_of_device),
-	},
-};
-
-static const struct generic_data bluetooth_setprop_tod_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static int32_t setprop_remote_rssi = 0;
-
-static struct priority_property setprop_remote_rssi_props[] = {
-	{
-	.prop.type = BT_PROPERTY_REMOTE_RSSI,
-	.prop.val = &setprop_remote_rssi,
-	.prop.len = sizeof(setprop_remote_rssi),
-	},
-};
-
-static const struct generic_data bluetooth_setprop_remote_rssi_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static bt_service_record_t setprop_remote_service = {
-	.uuid = { {0x00} },
-	.channel = 12,
-	.name = "bt_name",
-};
-
-static struct priority_property setprop_service_record_props[] = {
-	{
-	.prop.type = BT_PROPERTY_SERVICE_RECORD,
-	.prop.val = &setprop_remote_service,
-	.prop.len = sizeof(setprop_remote_service),
-	},
-};
-
-static const struct generic_data
-			bluetooth_setprop_service_record_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static bt_bdaddr_t setprop_bdaddr = {
-	.address = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-};
-
-static struct priority_property setprop_bdaddr_props[] = {
-	{
-	.prop.type = BT_PROPERTY_BDADDR,
-	.prop.val = &setprop_bdaddr,
-	.prop.len = sizeof(setprop_bdaddr),
-	},
-};
-
-static const struct generic_data bluetooth_setprop_bdaddr_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static bt_scan_mode_t setprop_scanmode_connectable = BT_SCAN_MODE_CONNECTABLE;
-
-static struct priority_property setprop_scanmode_connectable_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
-	.prop.val = &setprop_scanmode_connectable,
-	.prop.len = sizeof(setprop_scanmode_connectable),
-	},
-};
-
-static const struct generic_data
-			bluetooth_setprop_scanmode_connectable_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = setprop_scanmode_connectable_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static bt_bdaddr_t setprop_bonded_devices = {
-	.address = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 },
-};
-
-static struct priority_property setprop_bonded_devices_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
-	.prop.val = &setprop_bonded_devices,
-	.prop.len = sizeof(setprop_bonded_devices),
-	},
-};
-
-static const struct generic_data
-			bluetooth_setprop_bonded_devices_invalid_test = {
-	.expected_adapter_status = BT_STATUS_FAIL,
-};
-
-static uint32_t getprop_cod = 0x00020c;
-
-static struct priority_property getprop_cod_props[] = {
-	{
-	.prop.type = BT_PROPERTY_CLASS_OF_DEVICE,
-	.prop.val = &getprop_cod,
-	.prop.len = sizeof(getprop_cod),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_cod_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_cod_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static bt_device_type_t getprop_tod = BT_DEVICE_DEVTYPE_DUAL;
-
-static struct priority_property getprop_tod_props[] = {
-	{
-	.prop.type = BT_PROPERTY_TYPE_OF_DEVICE,
-	.prop.val = &getprop_tod,
-	.prop.len = sizeof(getprop_tod),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_tod_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_tod_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static bt_scan_mode_t getprop_scanmode = BT_SCAN_MODE_NONE;
-
-static struct priority_property getprop_scanmode_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
-	.prop.val = &getprop_scanmode,
-	.prop.len = sizeof(getprop_scanmode),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_scanmode_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_scanmode_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static uint32_t getprop_disctimeout_val = 120;
-
-static struct priority_property getprop_disctimeout_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
-	.prop.val = &getprop_disctimeout_val,
-	.prop.len = sizeof(getprop_disctimeout_val),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_disctimeout_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_disctimeout_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static const char getprop_uuids[] = {
-	/* Multi profile UUID */
-	0x00, 0x00, 0x11, 0x3b, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
-					0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB,
-	/* Device identification profile UUID */
-	0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
-					0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB,
-};
-
-static struct priority_property getprop_uuids_props[] = {
-	{
-	.prop.type = BT_PROPERTY_UUIDS,
-	.prop.val = &getprop_uuids,
-	.prop.len = sizeof(getprop_uuids),
-	},
-};
-
-static const struct generic_data bluetooth_getprop_uuids_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_uuids_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static struct priority_property getprop_bondeddev_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
-	.prop.val = NULL,
-	.prop.len = 0,
-	},
-};
-
-static const struct generic_data bluetooth_getprop_bondeddev_success_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = getprop_bondeddev_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
-static bt_scan_mode_t setprop_scanmode_none = BT_SCAN_MODE_NONE;
-
-static struct priority_property setprop_scanmode_none_props[] = {
-	{
-	.prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
-	.prop.val = &setprop_scanmode_none,
-	.prop.len = sizeof(setprop_scanmode_none),
-	},
-};
-
-static const struct generic_data
-			bluetooth_setprop_scanmode_none_success2_test = {
-	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
-	.expected_properties_num = 1,
-	.expected_properties = setprop_scanmode_none_props,
-	.expected_adapter_status = BT_STATUS_SUCCESS,
-};
-
 static const struct generic_data bluetooth_discovery_start_success_test = {
 	.expected_hal_cb.discovery_state_changed_cb =
 						discovery_start_success_cb,
@@ -2427,26 +2110,6 @@ static bool setup(struct test_data *data)
 	return true;
 }
 
-static void setup_base(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	bt_status_t status;
-
-	if (!setup(data)) {
-		tester_setup_failed();
-		return;
-	}
-
-	status = data->if_bluetooth->init(&bt_callbacks);
-	if (status != BT_STATUS_SUCCESS) {
-		data->if_bluetooth = NULL;
-		tester_setup_failed();
-		return;
-	}
-
-	tester_setup_complete();
-}
-
 static void setup_enabled_adapter(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -2500,221 +2163,6 @@ static void test_dummy(const void *test_data)
 	tester_test_passed();
 }
 
-static void test_getprop_bdaddr_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = setprop_bdaddr_props[0].prop;
-	bt_status_t adapter_status;
-	uint8_t *bdaddr = (uint8_t *)hciemu_get_master_bdaddr(data->hciemu);
-
-	init_test_conditions(data);
-
-	bdaddr2android((const bdaddr_t *)bdaddr,
-					&test_getprop_bdaddr_val.address);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_bdname_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(getprop_bdname_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	if (adapter_status != BT_STATUS_SUCCESS) {
-		tester_test_failed();
-		return;
-	}
-
-	adapter_status = data->if_bluetooth->get_adapter_property((*prop).type);
-	check_expected_status(adapter_status);
-}
-static void test_setprop_uuid_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_uuid_prop[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_cod_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_cod_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_tod_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const struct generic_data *test = data->test_data;
-	const bt_property_t *prop = &test->set_property;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_rssi_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_remote_rssi_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_service_record_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_service_record_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_bdaddr_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_bdaddr_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_scanmode_connectable_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop =
-				&(setprop_scanmode_connectable_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_bonded_devices_invalid(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_bonded_devices_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_cod_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = setprop_cod_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_tod_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = setprop_tod_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_scanmode_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = setprop_scanmode_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_disctimeout_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = setprop_disctimeout_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_uuids_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = getprop_uuids_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_getprop_bondeddev_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t prop = getprop_bondeddev_props[0].prop;
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
-	check_expected_status(adapter_status);
-}
-
-static void test_setprop_scanmode_none_done(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	const bt_property_t *prop = &(setprop_scanmode_none_props[0].prop);
-	bt_status_t adapter_status;
-
-	init_test_conditions(data);
-
-	adapter_status = data->if_bluetooth->set_adapter_property(prop);
-	check_expected_status(adapter_status);
-}
-
 static void test_discovery_start_success(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -4211,93 +3659,6 @@ int main(int argc, char *argv[])
 
 	tester_init(&argc, &argv);
 
-	test_bredrle("Bluetooth Init", NULL, setup_base, test_dummy, teardown);
-
-	test_bredrle("Bluetooth Get BDADDR - Success",
-					&bluetooth_getprop_bdaddr_success_test,
-					setup_enabled_adapter,
-					test_getprop_bdaddr_success, teardown);
-
-	test_bredrle("Bluetooth Get BDNAME - Success",
-					&bluetooth_getprop_bdname_success_test,
-					setup_enabled_adapter,
-					test_getprop_bdname_success, teardown);
-
-	test_bredrle("Bluetooth Set UUID - Invalid",
-					&bluetooth_setprop_uuid_invalid_test,
-					setup_enabled_adapter,
-					test_setprop_uuid_invalid, teardown);
-
-	test_bredrle("Bluetooth Set CLASS_OF_DEVICE - Invalid",
-					&bluetooth_setprop_cod_invalid_test,
-					setup_enabled_adapter,
-					test_setprop_cod_invalid, teardown);
-
-	test_bredrle("Bluetooth Set TYPE_OF_DEVICE - Invalid",
-					&bluetooth_setprop_tod_invalid_test,
-					setup_enabled_adapter,
-					test_setprop_tod_invalid, teardown);
-
-	test_bredrle("Bluetooth Set REMOTE_RSSI - Invalid",
-				&bluetooth_setprop_remote_rssi_invalid_test,
-				setup_enabled_adapter,
-				test_setprop_rssi_invalid, teardown);
-
-	test_bredrle("Bluetooth Set SERVICE_RECORD - Invalid",
-				&bluetooth_setprop_service_record_invalid_test,
-				setup_enabled_adapter,
-				test_setprop_service_record_invalid, teardown);
-
-	test_bredrle("Bluetooth Set BDADDR - Invalid",
-					&bluetooth_setprop_bdaddr_invalid_test,
-					setup_enabled_adapter,
-					test_setprop_bdaddr_invalid, teardown);
-
-	test_bredrle("Bluetooth Set SCAN_MODE CONNECTABLE - Success",
-			&bluetooth_setprop_scanmode_connectable_success_test,
-			setup_enabled_adapter,
-			test_setprop_scanmode_connectable_success, teardown);
-
-	test_bredrle("Bluetooth Set BONDED_DEVICES - Invalid",
-				&bluetooth_setprop_bonded_devices_invalid_test,
-				setup_enabled_adapter,
-				test_setprop_bonded_devices_invalid, teardown);
-
-	test_bredrle("Bluetooth Get CLASS_OF_DEVICE - Success",
-					&bluetooth_getprop_cod_success_test,
-					setup_enabled_adapter,
-					test_getprop_cod_success, teardown);
-
-	test_bredrle("Bluetooth Get TYPE_OF_DEVICE - Success",
-					&bluetooth_getprop_tod_success_test,
-					setup_enabled_adapter,
-					test_getprop_tod_success, teardown);
-
-	test_bredrle("Bluetooth Get SCAN_MODE - Success",
-				&bluetooth_getprop_scanmode_success_test,
-				setup_enabled_adapter,
-				test_getprop_scanmode_success, teardown);
-
-	test_bredrle("Bluetooth Get DISCOVERY_TIMEOUT - Success",
-				&bluetooth_getprop_disctimeout_success_test,
-				setup_enabled_adapter,
-				test_getprop_disctimeout_success, teardown);
-
-	test_bredrle("Bluetooth Get UUIDS - Success",
-					&bluetooth_getprop_uuids_success_test,
-					setup_enabled_adapter,
-					test_getprop_uuids_success, teardown);
-
-	test_bredrle("Bluetooth Get BONDED_DEVICES - Success",
-				&bluetooth_getprop_bondeddev_success_test,
-				setup_enabled_adapter,
-				test_getprop_bondeddev_success, teardown);
-
-	test_bredrle("Bluetooth Set SCAN_MODE NONE - Success 2",
-				&bluetooth_setprop_scanmode_none_success2_test,
-				setup_enabled_adapter,
-				test_setprop_scanmode_none_done, teardown);
-
 	test_bredrle("Bluetooth BR/EDR Discovery Start - Success",
 				&bluetooth_discovery_start_success_test,
 				setup_enabled_adapter,
-- 
1.9.1


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

* Re: [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue
  2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
                   ` (8 preceding siblings ...)
  2014-07-15  8:24 ` [PATCH 10/10] android/tester: Remove old cases Jakub Tyszkowski
@ 2014-07-16 15:31 ` Szymon Janc
  9 siblings, 0 replies; 11+ messages in thread
From: Szymon Janc @ 2014-07-16 15:31 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth

Hi Jakub,

On Tuesday 15 of July 2014 10:24:50 Jakub Tyszkowski wrote:
> It will be simplier to add new cases.
> ---
>  android/tester-bluetooth.c | 35 +++++++++++++++--------------------
>  android/tester-gatt.c      | 11 +++++++++--
>  android/tester-hidhost.c   | 11 +++++++++--
>  android/tester-socket.c    | 11 +++++++++--
>  4 files changed, 42 insertions(+), 26 deletions(-)
> 
> diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
> index 56518ea..202d085 100644
> --- a/android/tester-bluetooth.c
> +++ b/android/tester-bluetooth.c
> @@ -235,30 +235,25 @@ static struct test_case bluetooth_setprop_disctimeout_success_tc = {
>  				bluetooth_setprop_disctimeout_success_steps),
>  };
>  
> +static struct test_case *test_cases[] = {
> +	&bluetooth_init,
> +	&bluetooth_enable_success_tc,
> +	&bluetooth_enable_success2_tc,
> +	&bluetooth_disable_success_tc,
> +	&bluetooth_setprop_bdname_success_tc,
> +	&bluetooth_setprop_scanmode_success_tc,
> +	&bluetooth_setprop_disctimeout_success_tc,
> +};
> +
>  struct queue *get_bluetooth_tests(void)
>  {
> -	list = queue_new();
> -
> -	if (!queue_push_tail(list, &bluetooth_init))
> -		return NULL;
> -
> -	if (!queue_push_tail(list, &bluetooth_enable_success_tc))
> -		return NULL;
> +	uint16_t i = 0;
>  
> -	if (!queue_push_tail(list, &bluetooth_enable_success2_tc))
> -		return NULL;
> -
> -	if (!queue_push_tail(list, &bluetooth_disable_success_tc))
> -		return NULL;
> -
> -	if (!queue_push_tail(list, &bluetooth_setprop_bdname_success_tc))
> -		return NULL;
> -
> -	if (!queue_push_tail(list, &bluetooth_setprop_scanmode_success_tc))
> -		return NULL;
> +	list = queue_new();
>  
> -	if (!queue_push_tail(list, &bluetooth_setprop_disctimeout_success_tc))
> -		return NULL;
> +	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
> +		if (!queue_push_tail(list, test_cases[i]))
> +			return NULL;
>  
>  	return list;
>  }
> diff --git a/android/tester-gatt.c b/android/tester-gatt.c
> index b58886f..4a7c9b1 100644
> --- a/android/tester-gatt.c
> +++ b/android/tester-gatt.c
> @@ -30,12 +30,19 @@ static struct test_case gatt_init = {
>  	.step_num = get_test_case_step_num(dummy_steps),
>  };
>  
> +static struct test_case *test_cases[] = {
> +	&gatt_init,
> +};
> +
>  struct queue *get_gatt_tests(void)
>  {
> +	uint16_t i = 0;
> +
>  	list = queue_new();
>  
> -	if (!queue_push_tail(list, &gatt_init))
> -		return NULL;
> +	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
> +		if (!queue_push_tail(list, test_cases[i]))
> +			return NULL;
>  
>  	return list;
>  }
> diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
> index 87c9452..413c6b8 100644
> --- a/android/tester-hidhost.c
> +++ b/android/tester-hidhost.c
> @@ -30,12 +30,19 @@ static struct test_case hidhost_init = {
>  	.step_num = get_test_case_step_num(dummy_steps),
>  };
>  
> +static struct test_case *test_cases[] = {
> +	&hidhost_init,
> +};
> +
>  struct queue *get_hidhost_tests(void)
>  {
> +	uint16_t i = 0;
> +
>  	list = queue_new();
>  
> -	if (!queue_push_tail(list, &hidhost_init))
> -		return NULL;
> +	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
> +		if (!queue_push_tail(list, test_cases[i]))
> +			return NULL;
>  
>  	return list;
>  }
> diff --git a/android/tester-socket.c b/android/tester-socket.c
> index 8e8b6d2..a57b324 100644
> --- a/android/tester-socket.c
> +++ b/android/tester-socket.c
> @@ -30,12 +30,19 @@ static struct test_case socket_init = {
>  	.step_num = get_test_case_step_num(dummy_steps),
>  };
>  
> +static struct test_case *test_cases[] = {
> +	&socket_init,
> +};
> +
>  struct queue *get_socket_tests(void)
>  {
> +	uint16_t i = 0;
> +
>  	list = queue_new();
>  
> -	if (!queue_push_tail(list, &socket_init))
> -		return NULL;
> +	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
> +		if (!queue_push_tail(list, test_cases[i]))
> +			return NULL;
>  
>  	return list;
>  }
> 

All patches applied, thanks.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-07-16 15:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 03/10] android/tester-ng: Set proper callback count Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 04/10] android/tester-ng: Verify action results also for success case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 05/10] android/tester-bluetooth: Add get bdaddr and bdname success cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 06/10] android/tester-bluetooth: Add various property set fail cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 07/10] android/tester-bluetooth: Add set scan mode success case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 08/10] android/tester-bluetooth: Add get properties success cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 09/10] android/tester-bluetooth: Add set scan mode none succes case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 10/10] android/tester: Remove old cases Jakub Tyszkowski
2014-07-16 15:31 ` [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox