All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type
@ 2014-07-18 11:51 Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 02/11] android/tester-ng: Improve result print Jakub Tyszkowski
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This allows to set emulated adapter type for each test case in place
where tests are defined. Previously this was hardcoded in the framework.
---
 android/tester-bluetooth.c | 108 ++++++++++++++++++++++-----------------------
 android/tester-gatt.c      |   2 +-
 android/tester-hidhost.c   |   2 +-
 android/tester-main.c      |  25 +++--------
 android/tester-main.h      |  11 ++++-
 android/tester-socket.c    |   2 +-
 6 files changed, 73 insertions(+), 77 deletions(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index c36b507..bf399f3 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -381,150 +381,150 @@ static struct bt_action_data prop_test_ble_remote_timestamp_req = {
 };
 
 static struct test_case test_cases[] = {
-	TEST_CASE("Bluetooth Init",
+	TEST_CASE_BREDRLE("Bluetooth Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
-	TEST_CASE("Bluetooth Enable - Success",
+	TEST_CASE_BREDRLE("Bluetooth Enable - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 	),
-	TEST_CASE("Bluetooth Enable - Success 2",
+	TEST_CASE_BREDRLE("Bluetooth Enable - Success 2",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 	),
-	TEST_CASE("Bluetooth Disable - Success",
+	TEST_CASE_BREDRLE("Bluetooth Disable - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bluetooth_disable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
-	TEST_CASE("Bluetooth Set BDNAME - Success",
+	TEST_CASE_BREDRLE("Bluetooth Set BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action, &prop_test_bdname),
 		CALLBACK_ADAPTER_PROPS(&prop_test_bdname, 1),
 	),
-	TEST_CASE("Bluetooth Set SCAN_MODE - Success",
+	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 					&prop_test_scanmode_conn_discov),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scanmode_conn_discov, 1),
 	),
-	TEST_CASE("Bluetooth Set DISCOVERY_TIMEOUT - Success",
+	TEST_CASE_BREDRLE("Bluetooth Set DISCOVERY_TIMEOUT - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action, &prop_test_disctimeout),
 		CALLBACK_ADAPTER_PROPS(&prop_test_disctimeout, 1),
 	),
-	TEST_CASE("Bluetooth Get BDADDR - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get BDADDR - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bdaddr),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bdaddr, 1),
 	),
-	TEST_CASE("Bluetooth Get BDNAME - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bdname),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bdname, 1),
 	),
-	TEST_CASE("Bluetooth Set UUID - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set UUID - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_uuid),
 	),
-	TEST_CASE("Bluetooth Set CLASS_OF_DEVICE - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set CLASS_OF_DEVICE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_cod),
 	),
-	TEST_CASE("Bluetooth Set TYPE_OF_DEVICE - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set TYPE_OF_DEVICE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_tod),
 	),
-	TEST_CASE("Bluetooth Set REMOTE_RSSI - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set REMOTE_RSSI - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_remote_rssi),
 	),
-	TEST_CASE("Bluetooth Set SERVICE_RECORD - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set SERVICE_RECORD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_srvc_record),
 	),
-	TEST_CASE("Bluetooth Set BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_bdaddr),
 	),
-	TEST_CASE("Bluetooth Set SCAN_MODE_CONNECTABLE - SUCCESS",
+	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE_CONNECTABLE - SUCCESS",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 						&prop_test_scan_mode_conn),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_conn, 1),
 	),
-	TEST_CASE("Bluetooth Set BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Set BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_bonded_dev_addr),
 	),
-	TEST_CASE("Bluetooth Get CLASS_OF_DEVICE - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get CLASS_OF_DEVICE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_cod),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_cod, 1),
 	),
-	TEST_CASE("Bluetooth Get TYPE_OF_DEVICE - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get TYPE_OF_DEVICE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_tod),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_tod, 1),
 	),
-	TEST_CASE("Bluetooth Get SCAN_MODE - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get SCAN_MODE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_scan_mode),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_scan_mode, 1),
 	),
-	TEST_CASE("Bluetooth Get DISCOVERY_TIMEOUT - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get DISCOVERY_TIMEOUT - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_disc_timeout),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_disc_timeout, 1),
 	),
-	TEST_CASE("Bluetooth Get UUIDS - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get UUIDS - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_uuids),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_uuids, 1),
 	),
-	TEST_CASE("Bluetooth Get BONDED_DEVICES - Success",
+	TEST_CASE_BREDRLE("Bluetooth Get BONDED_DEVICES - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bonded_devs),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bonded_devs, 1),
 	),
-	TEST_CASE("Bluetooth Set SCAN_MODE - Success 2",
+	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE - Success 2",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 						&prop_test_scan_mode_none),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_none, 1),
 	),
-	TEST_CASE("Bluetooth BR/EDR Discovery Start - Success",
+	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Start - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STARTED),
 	),
-	TEST_CASE("Bluetooth BR/EDR Discovery Start - Done",
+	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Start - Done",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -532,7 +532,7 @@ static struct test_case test_cases[] = {
 							BT_DISCOVERY_STARTED),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 	),
-	TEST_CASE("Bluetooth BR/EDR Discovery Stop - Success",
+	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Stop - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -542,7 +542,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 	),
-	TEST_CASE("Bluetooth BR/EDR Discovery Stop - Done",
+	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Stop - Done",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -553,7 +553,7 @@ static struct test_case test_cases[] = {
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 	),
-	TEST_CASE("Bluetooth BR/EDR Discovery Device Found",
+	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Device Found",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -565,7 +565,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 	),
-	TEST_CASE("Bluetooth Device Get Props - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get Props - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -579,7 +579,7 @@ static struct test_case test_cases[] = {
 							&emu_remote_bdaddr_val),
 		CALLBACK_DEVICE_PROPS(prop_emu_ble_remotes_query_set, 6),
 	),
-	TEST_CASE("Bluetooth Device Get BDNAME - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -593,7 +593,7 @@ static struct test_case test_cases[] = {
 					&prop_emu_ble_remote_bdname_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_bdname_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get UUIDS - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get UUIDS - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -607,7 +607,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_uuids_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_uuids_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get COD - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get COD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -621,7 +621,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_cod_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_cod_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get TOD - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get TOD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -635,7 +635,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_tod_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_tod_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get RSSI - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get RSSI - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -649,7 +649,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_rssi_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_rssi_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get TIMESTAMP - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Get TIMESTAMP - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -663,7 +663,7 @@ static struct test_case test_cases[] = {
 					&prop_emu_ble_remote_timestamp_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_timestamp_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Get BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -676,7 +676,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_bdaddr_req),
 	),
-	TEST_CASE("Bluetooth Device Get SCAN_MODE - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -689,7 +689,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_scan_mode_req),
 	),
-	TEST_CASE("Bluetooth Device Get BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -702,7 +702,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_bondeddev_req),
 	),
-	TEST_CASE("Bluetooth Device Get DISCOVERY_TIMEOUT - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get DISCOVERY_TIMEOUT - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -715,7 +715,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_disctimeout_req),
 	),
-	TEST_CASE("Bluetooth Device Get VERSION_INFO - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get VERSION_INFO - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -728,7 +728,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_verinfo_req),
 	),
-	TEST_CASE("Bluetooth Device Get FRIENDLY_NAME - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Get FRIENDLY_NAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -741,7 +741,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 						&prop_emu_ble_remote_fname_req),
 	),
-	TEST_CASE("Bluetooth Device Set FRIENDLY_NAME - Success",
+	TEST_CASE_BREDRLE("Bluetooth Device Set FRIENDLY_NAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -757,7 +757,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_fname_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_fname_prop, 1),
 	),
-	TEST_CASE("Bluetooth Device Set BDNAME - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set BDNAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -770,7 +770,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_bdname_req),
 	),
-	TEST_CASE("Bluetooth Device Set UUIDS - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set UUIDS - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -783,7 +783,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_uuids_req),
 	),
-	TEST_CASE("Bluetooth Device Set COD - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set COD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -796,7 +796,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_cod_req),
 	),
-	TEST_CASE("Bluetooth Device Set TOD - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set TOD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -809,7 +809,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_tod_req),
 	),
-	TEST_CASE("Bluetooth Device Set RSSI - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set RSSI - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -822,7 +822,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_rssi_req),
 	),
-	TEST_CASE("Bluetooth Device Set TIMESTAMP - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set TIMESTAMP - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -835,7 +835,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_timestamp_req),
 	),
-	TEST_CASE("Bluetooth Device Set BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -848,7 +848,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_bdaddr_req),
 	),
-	TEST_CASE("Bluetooth Device Set SERVICE_RECORD - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set SERVICE_RECORD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -861,7 +861,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_srvc_record_req),
 	),
-	TEST_CASE("Bluetooth Device Set SCAN_MODE - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -874,7 +874,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_scanmode_req),
 	),
-	TEST_CASE("Bluetooth Device Set BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -887,7 +887,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_bonded_dev_req),
 	),
-	TEST_CASE("Bluetooth Device Set DISCOVERY_TIMEOUT - Fail",
+	TEST_CASE_BREDRLE("Bluetooth Device Set DISCOVERY_TIMEOUT - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index a55fbe0..b85cfc8 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -20,7 +20,7 @@
 static struct queue *list; /* List of gatt test cases */
 
 static struct test_case test_cases[] = {
-	TEST_CASE("Gatt Init",
+	TEST_CASE_BREDRLE("Gatt Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
 };
diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
index b00a4e9..a32b0df 100644
--- a/android/tester-hidhost.c
+++ b/android/tester-hidhost.c
@@ -20,7 +20,7 @@
 static struct queue *list; /* List of hidhost test cases */
 
 static struct test_case test_cases[] = {
-	TEST_CASE("Hidhost Init",
+	TEST_CASE_BREDRLE("Hidhost Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
 };
diff --git a/android/tester-main.c b/android/tester-main.c
index 4c7a5e7..c850082 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -1116,26 +1116,13 @@ static void generic_test_function(const void *test_data)
 	first_step->action();
 }
 
-#define test_bredr(data, test_setup, test, test_teardown) \
+#define test(data, test_setup, test, test_teardown) \
 	do { \
 		struct test_data *user; \
 		user = g_malloc0(sizeof(struct test_data)); \
 		if (!user) \
 			break; \
-		user->hciemu_type = HCIEMU_TYPE_BREDR; \
-		user->test_data = data; \
-		tester_add_full(data->title, data, test_pre_setup, \
-					test_setup, test, test_teardown, \
-					test_post_teardown, 3, user, g_free); \
-	} while (0)
-
-#define test_bredrle(data, test_setup, test, test_teardown) \
-	do { \
-		struct test_data *user; \
-		user = g_malloc0(sizeof(struct test_data)); \
-		if (!user) \
-			break; \
-		user->hciemu_type = HCIEMU_TYPE_BREDRLE; \
+		user->hciemu_type = data->emu_type; \
 		user->test_data = data; \
 		tester_add_full(data->title, data, test_pre_setup, \
 					test_setup, test, test_teardown, \
@@ -1152,28 +1139,28 @@ static void add_bluetooth_tests(void *data, void *user_data)
 {
 	struct test_case *tc = data;
 
-	test_bredrle(tc, setup, generic_test_function, teardown);
+	test(tc, setup, generic_test_function, teardown);
 }
 
 static void add_socket_tests(void *data, void *user_data)
 {
 	struct test_case *tc = data;
 
-	test_bredrle(tc, setup_socket, generic_test_function, teardown);
+	test(tc, setup_socket, generic_test_function, teardown);
 }
 
 static void add_hidhost_tests(void *data, void *user_data)
 {
 	struct test_case *tc = data;
 
-	test_bredrle(tc, setup_hidhost, generic_test_function, teardown);
+	test(tc, setup_hidhost, generic_test_function, teardown);
 }
 
 static void add_gatt_tests(void *data, void *user_data)
 {
 	struct test_case *tc = data;
 
-	test_bredrle(tc, setup_gatt, generic_test_function, teardown);
+	test(tc, setup_gatt, generic_test_function, teardown);
 }
 
 int main(int argc, char *argv[])
diff --git a/android/tester-main.h b/android/tester-main.h
index 2f6252d..e8eedf4 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -50,7 +50,15 @@
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
 
-#define TEST_CASE(text, ...) { \
+#define TEST_CASE_BREDR(text, ...) { \
+		HCIEMU_TYPE_BREDR, \
+		text, \
+		sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
+		(struct step[]) {__VA_ARGS__}, \
+	}
+
+#define TEST_CASE_BREDRLE(text, ...) { \
+		HCIEMU_TYPE_BREDRLE, \
 		text, \
 		sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
 		(struct step[]) {__VA_ARGS__}, \
@@ -212,6 +220,7 @@ struct step {
 };
 
 struct test_case {
+	uint8_t emu_type;
 	char *title;
 	uint16_t step_num;
 	const struct step const *step;
diff --git a/android/tester-socket.c b/android/tester-socket.c
index 254b539..fd0f035 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -20,7 +20,7 @@
 static struct queue *list; /* List of socket test cases */
 
 static struct test_case test_cases[] = {
-	TEST_CASE("Socket Init",
+	TEST_CASE_BREDRLE("Socket Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
 };
-- 
1.9.1


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

* [PATCH 02/11] android/tester-ng: Improve result print
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 03/11] android/tester-ng: Improve callback defining makro Jakub Tyszkowski
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

It might be usefull to print if test involves LE or BREDR adapter and
remotes. Test case title length had to be reduced for better results
format.
---
 android/tester-bluetooth.c | 108 ++++++++++++++++++++++-----------------------
 android/tester-main.h      |   4 +-
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index bf399f3..24d6dcb 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -381,150 +381,150 @@ static struct bt_action_data prop_test_ble_remote_timestamp_req = {
 };
 
 static struct test_case test_cases[] = {
-	TEST_CASE_BREDRLE("Bluetooth Init",
+	TEST_CASE_BREDRLE("Bt. Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Enable - Success",
+	TEST_CASE_BREDRLE("Bt. Enable - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Enable - Success 2",
+	TEST_CASE_BREDRLE("Bt. Enable - Success 2",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_ADAPTER_PROPS(prop_emu_default_set, 8),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Disable - Success",
+	TEST_CASE_BREDRLE("Bt. Disable - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bluetooth_disable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set BDNAME - Success",
+	TEST_CASE_BREDRLE("Bt. Set BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action, &prop_test_bdname),
 		CALLBACK_ADAPTER_PROPS(&prop_test_bdname, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE - Success",
+	TEST_CASE_BREDRLE("Bt. Set SCAN_MODE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 					&prop_test_scanmode_conn_discov),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scanmode_conn_discov, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set DISCOVERY_TIMEOUT - Success",
+	TEST_CASE_BREDRLE("Bt. Set DISCOVERY_TIMEOUT - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action, &prop_test_disctimeout),
 		CALLBACK_ADAPTER_PROPS(&prop_test_disctimeout, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get BDADDR - Success",
+	TEST_CASE_BREDRLE("Bt. Get BDADDR - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bdaddr),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bdaddr, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get BDNAME - Success",
+	TEST_CASE_BREDRLE("Bt. Get BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bdname),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bdname, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set UUID - Fail",
+	TEST_CASE_BREDRLE("Bt. Set UUID - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_uuid),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set CLASS_OF_DEVICE - Fail",
+	TEST_CASE_BREDRLE("Bt. Set CLASS_OF_DEVICE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_cod),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set TYPE_OF_DEVICE - Fail",
+	TEST_CASE_BREDRLE("Bt. Set TYPE_OF_DEVICE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_tod),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set REMOTE_RSSI - Fail",
+	TEST_CASE_BREDRLE("Bt. Set REMOTE_RSSI - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_remote_rssi),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set SERVICE_RECORD - Fail",
+	TEST_CASE_BREDRLE("Bt. Set SERVICE_RECORD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_srvc_record),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bt. Set BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_bdaddr),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE_CONNECTABLE - SUCCESS",
+	TEST_CASE_BREDRLE("Bt. Set SCAN_MODE_CONNECTABLE - SUCCESS",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 						&prop_test_scan_mode_conn),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_conn, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bt. Set BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_FAIL(bt_set_property_action, &prop_test_bonded_dev_addr),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get CLASS_OF_DEVICE - Success",
+	TEST_CASE_BREDRLE("Bt. Get CLASS_OF_DEVICE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_cod),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_cod, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get TYPE_OF_DEVICE - Success",
+	TEST_CASE_BREDRLE("Bt. Get TYPE_OF_DEVICE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_tod),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_tod, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get SCAN_MODE - Success",
+	TEST_CASE_BREDRLE("Bt. Get SCAN_MODE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_scan_mode),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_scan_mode, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get DISCOVERY_TIMEOUT - Success",
+	TEST_CASE_BREDRLE("Bt. Get DISCOVERY_TIMEOUT - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_disc_timeout),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_disc_timeout, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get UUIDS - Success",
+	TEST_CASE_BREDRLE("Bt. Get UUIDS - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_uuids),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_uuids, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Get BONDED_DEVICES - Success",
+	TEST_CASE_BREDRLE("Bt. Get BONDED_DEVICES - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_get_property_action, &prop_emu_bonded_devs),
 		CALLBACK_ADAPTER_PROPS(&prop_emu_bonded_devs, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Set SCAN_MODE - Success 2",
+	TEST_CASE_BREDRLE("Bt. Set SCAN_MODE - Success 2",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_set_property_action,
 						&prop_test_scan_mode_none),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_none, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Start - Success",
+	TEST_CASE_BREDRLE("Bt. Discovery Start - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STARTED),
 	),
-	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Start - Done",
+	TEST_CASE_BREDRLE("Bt. Discovery Start - Done",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -532,7 +532,7 @@ static struct test_case test_cases[] = {
 							BT_DISCOVERY_STARTED),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 	),
-	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Stop - Success",
+	TEST_CASE_BREDRLE("Bt. Discovery Stop - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -542,7 +542,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 	),
-	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Stop - Done",
+	TEST_CASE_BREDRLE("Bt. Discovery Stop - Done",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
@@ -553,7 +553,7 @@ static struct test_case test_cases[] = {
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 	),
-	TEST_CASE_BREDRLE("Bluetooth BR/EDR Discovery Device Found",
+	TEST_CASE_BREDRLE("Bt. Discovery Device Found",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -565,7 +565,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get Props - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get Props - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -579,7 +579,7 @@ static struct test_case test_cases[] = {
 							&emu_remote_bdaddr_val),
 		CALLBACK_DEVICE_PROPS(prop_emu_ble_remotes_query_set, 6),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get BDNAME - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -593,7 +593,7 @@ static struct test_case test_cases[] = {
 					&prop_emu_ble_remote_bdname_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_bdname_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get UUIDS - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get UUIDS - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -607,7 +607,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_uuids_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_uuids_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get COD - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get COD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -621,7 +621,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_cod_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_cod_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get TOD - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get TOD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -635,7 +635,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_tod_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_tod_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get RSSI - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get RSSI - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -649,7 +649,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_rssi_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_rssi_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get TIMESTAMP - Success",
+	TEST_CASE_BREDRLE("Bt. Device Get TIMESTAMP - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -663,7 +663,7 @@ static struct test_case test_cases[] = {
 					&prop_emu_ble_remote_timestamp_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_timestamp_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -676,7 +676,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_bdaddr_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get SCAN_MODE - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -689,7 +689,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_scan_mode_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -702,7 +702,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_bondeddev_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get DISCOVERY_TIMEOUT - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get DISCOVERY_TIMEOUT - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -715,7 +715,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_disctimeout_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get VERSION_INFO - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get VERSION_INFO - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -728,7 +728,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 					&prop_emu_ble_remote_verinfo_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Get FRIENDLY_NAME - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Get FRIENDLY_NAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -741,7 +741,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_get_device_prop_action,
 						&prop_emu_ble_remote_fname_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set FRIENDLY_NAME - Success",
+	TEST_CASE_BREDRLE("Bt. Device Set FRIENDLY_NAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -757,7 +757,7 @@ static struct test_case test_cases[] = {
 						&prop_emu_ble_remote_fname_req),
 		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_fname_prop, 1),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set BDNAME - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set BDNAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -770,7 +770,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_bdname_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set UUIDS - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set UUIDS - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -783,7 +783,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_uuids_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set COD - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set COD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -796,7 +796,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_cod_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set TOD - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set TOD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -809,7 +809,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_tod_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set RSSI - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set RSSI - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -822,7 +822,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_remote_rssi_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set TIMESTAMP - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set TIMESTAMP - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -835,7 +835,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_timestamp_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set BDADDR - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -848,7 +848,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_bdaddr_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set SERVICE_RECORD - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set SERVICE_RECORD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -861,7 +861,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_srvc_record_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set SCAN_MODE - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -874,7 +874,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_ble_remote_scanmode_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set BONDED_DEVICES - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -887,7 +887,7 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 						&prop_test_ble_bonded_dev_req),
 	),
-	TEST_CASE_BREDRLE("Bluetooth Device Set DISCOVERY_TIMEOUT - Fail",
+	TEST_CASE_BREDRLE("Bt. Device Set DISCOVERY_TIMEOUT - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
diff --git a/android/tester-main.h b/android/tester-main.h
index e8eedf4..a5ed5b1 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -52,14 +52,14 @@
 
 #define TEST_CASE_BREDR(text, ...) { \
 		HCIEMU_TYPE_BREDR, \
-		text, \
+		"[BR/EDR] "text, \
 		sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
 		(struct step[]) {__VA_ARGS__}, \
 	}
 
 #define TEST_CASE_BREDRLE(text, ...) { \
 		HCIEMU_TYPE_BREDRLE, \
-		text, \
+		"[DUAL] "text, \
 		sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
 		(struct step[]) {__VA_ARGS__}, \
 	}
-- 
1.9.1


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

* [PATCH 03/11] android/tester-ng: Improve callback defining makro
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 02/11] android/tester-ng: Improve result print Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 04/11] android/tester-ng: Improve variable's names Jakub Tyszkowski
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This makes CALLBACK_DEVICE_PROPS and CALLBACK_DEVICE_FOUND use more
generic CALLBACK_PROPS makro.
---
 android/tester-main.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/android/tester-main.h b/android/tester-main.h
index a5ed5b1..883ec4d 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -87,17 +87,17 @@
 		.callback_result.num_properties = prop_cnt, \
 	}
 
-#define CALLBACK_DEVICE_PROPS(props, prop_cnt) { \
-		.callback = CB_BT_REMOTE_DEVICE_PROPERTIES, \
+#define CALLBACK_PROPS(cb, props, prop_cnt) { \
+		.callback = cb, \
 		.callback_result.properties = props, \
 		.callback_result.num_properties = prop_cnt, \
 	}
 
-#define CALLBACK_DEVICE_FOUND(props, prop_cnt) { \
-		.callback = CB_BT_DEVICE_FOUND, \
-		.callback_result.properties = props, \
-		.callback_result.num_properties = prop_cnt, \
-	}
+#define CALLBACK_DEVICE_PROPS(props, prop_cnt) \
+	CALLBACK_PROPS(CB_BT_REMOTE_DEVICE_PROPERTIES, props, prop_cnt)
+
+#define CALLBACK_DEVICE_FOUND(props, prop_cnt) \
+	CALLBACK_PROPS(CB_BT_DEVICE_FOUND, props, prop_cnt)
 
 /*
  * NOTICE:
-- 
1.9.1


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

* [PATCH 04/11] android/tester-ng: Improve variable's names
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 02/11] android/tester-ng: Improve result print Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 03/11] android/tester-ng: Improve callback defining makro Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 05/11] android/tester-ng: Add missing check for callback status Jakub Tyszkowski
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Some variables are specific to emulator device type and remote device type.
This patch makes names more descriptive.
---
 android/tester-bluetooth.c | 177 +++++++++++++++++++++++----------------------
 1 file changed, 89 insertions(+), 88 deletions(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 24d6dcb..020bbe2 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -56,11 +56,11 @@ static bt_property_t prop_emu_cod = {
 	.len = sizeof(emu_cod_val),
 };
 
-static bt_device_type_t emu_tod_val = BT_DEVICE_DEVTYPE_DUAL;
-static bt_property_t prop_emu_tod = {
+static bt_device_type_t emu_tod_dual_val = BT_DEVICE_DEVTYPE_DUAL;
+static bt_property_t prop_emu_dual_tod = {
 	.type = BT_PROPERTY_TYPE_OF_DEVICE,
-	.val = &emu_tod_val,
-	.len = sizeof(emu_tod_val),
+	.val = &emu_tod_dual_val,
+	.len = sizeof(emu_tod_dual_val),
 };
 
 static bt_scan_mode_t emu_scan_mode_val = BT_SCAN_MODE_NONE;
@@ -86,112 +86,113 @@ static bt_property_t prop_emu_bonded_devs = {
 static bt_bdaddr_t emu_remote_bdaddr_val = {
 	.address = { 0x00, 0xaa, 0x01, 0x01, 0x00, 0x00 },
 };
-static struct bt_action_data prop_emu_ble_remote_bdaddr_req = {
+static struct bt_action_data prop_emu_remote_ble_bdaddr_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_BDADDR,
 };
 
-static uint32_t emu_remote_type_val = BT_DEVICE_DEVTYPE_BLE;
-static bt_property_t prop_emu_ble_remote_tod_prop = {
+static uint32_t emu_remote_tod_ble_val = BT_DEVICE_DEVTYPE_BLE;
+static bt_property_t prop_emu_remote_ble_tod_prop = {
 	.type = BT_PROPERTY_TYPE_OF_DEVICE,
-	.val = &emu_remote_type_val,
-	.len = sizeof(emu_remote_type_val),
+	.val = &emu_remote_tod_ble_val,
+	.len = sizeof(emu_remote_tod_ble_val),
 };
-static struct bt_action_data prop_emu_ble_remote_tod_req = {
+static struct bt_action_data prop_emu_remote_ble_tod_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_TYPE_OF_DEVICE,
 };
 
-static int32_t emu_remote_rssi_val = 127;
-static bt_property_t prop_emu_ble_remote_rssi_prop = {
+static int32_t emu_remote_ble_rssi_val = 127;
+static bt_property_t prop_emu_remote_ble_rssi_prop = {
 	.type = BT_PROPERTY_REMOTE_RSSI,
-	.val = &emu_remote_rssi_val,
-	.len = sizeof(emu_remote_rssi_val),
+	.val = &emu_remote_ble_rssi_val,
+	.len = sizeof(emu_remote_ble_rssi_val),
 };
-static struct bt_action_data prop_emu_ble_remote_rssi_req = {
+static struct bt_action_data prop_emu_remote_ble_rssi_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_RSSI,
 };
 
 static const char emu_remote_bdname_val[] = "00:AA:01:01:00:00";
-static bt_property_t prop_emu_ble_remote_bdname_prop = {
+static bt_property_t prop_emu_remote_ble_bdname_prop = {
 	.type = BT_PROPERTY_BDNAME,
 	.val = &emu_remote_bdname_val,
 	.len = sizeof(emu_remote_bdname_val) - 1,
 };
-static struct bt_action_data prop_emu_ble_remote_bdname_req = {
+static struct bt_action_data prop_emu_remote_ble_bdname_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_BDNAME,
 };
 
 static uint32_t emu_remote_cod_val = 0;
-static bt_property_t prop_emu_ble_remote_cod_prop = {
+static bt_property_t prop_emu_remote_ble_cod_prop = {
 	.type = BT_PROPERTY_CLASS_OF_DEVICE,
 	.val = &emu_remote_cod_val,
 	.len = sizeof(emu_remote_cod_val),
 };
-static struct bt_action_data prop_emu_ble_remote_cod_req = {
+static struct bt_action_data prop_emu_remote_ble_cod_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_CLASS_OF_DEVICE,
 };
 
-static bt_property_t prop_emu_ble_remote_uuids_prop = {
+static bt_property_t prop_emu_remote_ble_uuids_prop = {
 	.type = BT_PROPERTY_UUIDS,
 	.val = NULL,
 	.len = 0,
 };
-static struct bt_action_data prop_emu_ble_remote_uuids_req = {
+static struct bt_action_data prop_emu_remote_ble_uuids_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_UUIDS,
 };
 
-static bt_property_t prop_emu_ble_remote_timestamp_prop = {
+static bt_property_t prop_emu_remote_ble_timestamp_prop = {
 	.type = BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP,
 	.val = NULL,
 	.len = 4,
 };
-static struct bt_action_data prop_emu_ble_remote_timestamp_req = {
+static struct bt_action_data prop_emu_remote_ble_timestamp_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP,
 };
 
-static struct bt_action_data prop_emu_ble_remote_scan_mode_req = {
+static struct bt_action_data prop_emu_remote_ble_scan_mode_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_ADAPTER_SCAN_MODE,
 };
 
-static struct bt_action_data prop_emu_ble_remote_bondeddev_req = {
+static struct bt_action_data prop_emu_remote_ble_bondeddev_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
 };
 
-static struct bt_action_data prop_emu_ble_remote_disctimeout_req = {
+static struct bt_action_data prop_emu_remote_ble_disctimeout_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
 };
 
-static struct bt_action_data prop_emu_ble_remote_verinfo_req = {
+static struct bt_action_data prop_emu_remote_ble_verinfo_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_VERSION_INFO,
 };
 
 static const char prop_test_fname_val[] = "FriendlyTestName";
-static bt_property_t prop_emu_ble_remote_fname_prop = {
+static bt_property_t prop_emu_remote_ble_fname_prop = {
 	.type = BT_PROPERTY_REMOTE_FRIENDLY_NAME,
 	.val = &prop_test_fname_val,
 	.len = sizeof(prop_test_fname_val) - 1,
 };
-static struct bt_action_data prop_emu_ble_remote_fname_req = {
+static struct bt_action_data prop_emu_remote_ble_fname_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_FRIENDLY_NAME,
-	.prop = &prop_emu_ble_remote_fname_prop,
+	.prop = &prop_emu_remote_ble_fname_prop,
 };
 
 static bt_property_t prop_emu_default_set[] = {
 	{ BT_PROPERTY_BDADDR, sizeof(emu_bdaddr_val), NULL },
 	{ BT_PROPERTY_BDNAME, sizeof(emu_bdname_val) - 1, &emu_bdname_val },
 	{ BT_PROPERTY_CLASS_OF_DEVICE, sizeof(uint32_t), NULL },
-	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_tod_val), &emu_tod_val },
+	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_tod_dual_val),
+							&emu_tod_dual_val },
 	{ BT_PROPERTY_ADAPTER_SCAN_MODE, sizeof(emu_scan_mode_val),
 							&emu_scan_mode_val },
 	{ BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, sizeof(emu_disc_timeout_val),
@@ -200,22 +201,22 @@ static bt_property_t prop_emu_default_set[] = {
 	{ BT_PROPERTY_UUIDS, sizeof(emu_uuids_val), &emu_uuids_val },
 };
 
-static bt_property_t prop_emu_ble_remotes_default_set[] = {
+static bt_property_t prop_emu_remote_bles_default_set[] = {
 	{ BT_PROPERTY_BDADDR, sizeof(emu_remote_bdaddr_val),
 						&emu_remote_bdaddr_val },
-	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_type_val),
-							&emu_remote_type_val },
-	{ BT_PROPERTY_REMOTE_RSSI, sizeof(emu_remote_rssi_val),
-							&emu_remote_rssi_val },
+	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_tod_ble_val),
+						&emu_remote_tod_ble_val },
+	{ BT_PROPERTY_REMOTE_RSSI, sizeof(emu_remote_ble_rssi_val),
+						&emu_remote_ble_rssi_val },
 };
 
-static bt_property_t prop_emu_ble_remotes_query_set[] = {
-	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_type_val),
-							&emu_remote_type_val },
+static bt_property_t prop_emu_remote_bles_query_set[] = {
+	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_tod_ble_val),
+						&emu_remote_tod_ble_val },
 	{ BT_PROPERTY_CLASS_OF_DEVICE, sizeof(emu_remote_cod_val),
 							&emu_remote_cod_val },
-	{ BT_PROPERTY_REMOTE_RSSI, sizeof(emu_remote_rssi_val),
-							&emu_remote_rssi_val },
+	{ BT_PROPERTY_REMOTE_RSSI, sizeof(emu_remote_ble_rssi_val),
+						&emu_remote_ble_rssi_val },
 	{ BT_PROPERTY_BDNAME, sizeof(emu_remote_bdname_val) - 1,
 						&emu_remote_bdname_val },
 	{ BT_PROPERTY_UUIDS, 0, NULL },
@@ -228,7 +229,7 @@ static bt_property_t prop_test_bdname = {
 	.val = test_bdname,
 	.len = sizeof(test_bdname) - 1,
 };
-static struct bt_action_data prop_test_ble_remote_bdname_req = {
+static struct bt_action_data prop_test_remote_ble_bdname_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_BDNAME,
 	.prop = &prop_test_bdname,
@@ -248,7 +249,7 @@ static bt_property_t prop_test_disctimeout = {
 	.val = &test_disctimeout_val,
 	.len = sizeof(test_disctimeout_val),
 };
-static struct bt_action_data prop_test_ble_remote_disc_timeout_req = {
+static struct bt_action_data prop_test_remote_ble_disc_timeout_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
 	.prop = &prop_test_disctimeout,
@@ -262,7 +263,7 @@ static bt_property_t prop_test_uuid = {
 	.val = &test_uuids_val,
 	.len = sizeof(test_uuids_val),
 };
-static struct bt_action_data prop_test_ble_remote_uuids_req = {
+static struct bt_action_data prop_test_remote_ble_uuids_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_UUIDS,
 	.prop = &prop_test_uuid,
@@ -274,7 +275,7 @@ static bt_property_t prop_test_cod = {
 	.val = &test_cod_val,
 	.len = sizeof(test_cod_val),
 };
-static struct bt_action_data prop_test_ble_remote_cod_req = {
+static struct bt_action_data prop_test_remote_ble_cod_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_CLASS_OF_DEVICE,
 	.prop = &prop_test_cod,
@@ -286,7 +287,7 @@ static bt_property_t prop_test_tod = {
 	.val = &test_tod_val,
 	.len = sizeof(test_tod_val),
 };
-static struct bt_action_data prop_test_ble_remote_tod_req = {
+static struct bt_action_data prop_test_remote_ble_tod_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_TYPE_OF_DEVICE,
 	.prop = &prop_test_tod,
@@ -298,7 +299,7 @@ static bt_property_t prop_test_remote_rssi = {
 	.val = &test_remote_rssi_val,
 	.len = sizeof(test_remote_rssi_val),
 };
-static struct bt_action_data prop_test_ble_remote_rssi_req = {
+static struct bt_action_data prop_test_remote_ble_rssi_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_RSSI,
 	.prop = &prop_test_remote_rssi,
@@ -314,7 +315,7 @@ static bt_property_t prop_test_srvc_record = {
 	.val = &test_srvc_record_val,
 	.len = sizeof(test_srvc_record_val),
 };
-static struct bt_action_data prop_test_ble_remote_srvc_record_req = {
+static struct bt_action_data prop_test_remote_ble_srvc_record_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_SERVICE_RECORD,
 	.prop = &prop_test_srvc_record,
@@ -328,7 +329,7 @@ static bt_property_t prop_test_bdaddr = {
 	.val = &test_bdaddr_val,
 	.len = sizeof(test_bdaddr_val),
 };
-static struct bt_action_data prop_test_ble_remote_bdaddr_req = {
+static struct bt_action_data prop_test_remote_ble_bdaddr_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_BDADDR,
 	.prop = &prop_test_bdaddr,
@@ -348,7 +349,7 @@ static bt_property_t prop_test_scan_mode_none = {
 	.val = &test_scan_mode_none_val,
 	.len = sizeof(test_scan_mode_none_val),
 };
-static struct bt_action_data prop_test_ble_remote_scanmode_req = {
+static struct bt_action_data prop_test_remote_ble_scanmode_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_ADAPTER_SCAN_MODE,
 	.prop = &prop_test_scan_mode_none,
@@ -369,15 +370,15 @@ static struct bt_action_data prop_test_ble_bonded_dev_req = {
 };
 
 static long test_remote_timestamp_val = 0x7f3d79965adf;
-static bt_property_t prop_test_ble_remote_timestamp_prop = {
+static bt_property_t prop_test_remote_ble_timestamp_prop = {
 	.type = BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP,
 	.val = &test_remote_timestamp_val,
 	.len = sizeof(test_remote_timestamp_val),
 };
-static struct bt_action_data prop_test_ble_remote_timestamp_req = {
+static struct bt_action_data prop_test_remote_ble_timestamp_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP,
-	.prop = &prop_test_ble_remote_timestamp_prop,
+	.prop = &prop_test_remote_ble_timestamp_prop,
 };
 
 static struct test_case test_cases[] = {
@@ -483,8 +484,8 @@ static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("Bt. Get TYPE_OF_DEVICE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
-		ACTION_SUCCESS(bt_get_property_action, &prop_emu_tod),
-		CALLBACK_ADAPTER_PROPS(&prop_emu_tod, 1),
+		ACTION_SUCCESS(bt_get_property_action, &prop_emu_dual_tod),
+		CALLBACK_ADAPTER_PROPS(&prop_emu_dual_tod, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Get SCAN_MODE - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -560,7 +561,7 @@ static struct test_case test_cases[] = {
 		ACTION_SUCCESS(bt_start_discovery_action, NULL),
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STARTED),
-		CALLBACK_DEVICE_FOUND(prop_emu_ble_remotes_default_set, 3),
+		CALLBACK_DEVICE_FOUND(prop_emu_remote_bles_default_set, 3),
 		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
@@ -577,7 +578,7 @@ static struct test_case test_cases[] = {
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_props_action,
 							&emu_remote_bdaddr_val),
-		CALLBACK_DEVICE_PROPS(prop_emu_ble_remotes_query_set, 6),
+		CALLBACK_DEVICE_PROPS(prop_emu_remote_bles_query_set, 6),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get BDNAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -590,8 +591,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-					&prop_emu_ble_remote_bdname_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_bdname_prop, 1),
+					&prop_emu_remote_ble_bdname_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_bdname_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get UUIDS - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -604,8 +605,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-						&prop_emu_ble_remote_uuids_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_uuids_prop, 1),
+						&prop_emu_remote_ble_uuids_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_uuids_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get COD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -618,8 +619,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-						&prop_emu_ble_remote_cod_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_cod_prop, 1),
+						&prop_emu_remote_ble_cod_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_cod_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get TOD - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -632,8 +633,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-						&prop_emu_ble_remote_tod_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_tod_prop, 1),
+						&prop_emu_remote_ble_tod_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_tod_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get RSSI - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -646,8 +647,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-						&prop_emu_ble_remote_rssi_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_rssi_prop, 1),
+						&prop_emu_remote_ble_rssi_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_rssi_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get TIMESTAMP - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -660,8 +661,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-					&prop_emu_ble_remote_timestamp_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_timestamp_prop, 1),
+					&prop_emu_remote_ble_timestamp_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_timestamp_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -674,7 +675,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-					&prop_emu_ble_remote_bdaddr_req),
+					&prop_emu_remote_ble_bdaddr_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -687,7 +688,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-					&prop_emu_ble_remote_scan_mode_req),
+					&prop_emu_remote_ble_scan_mode_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -700,7 +701,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-					&prop_emu_ble_remote_bondeddev_req),
+					&prop_emu_remote_ble_bondeddev_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get DISCOVERY_TIMEOUT - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -713,7 +714,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-					&prop_emu_ble_remote_disctimeout_req),
+					&prop_emu_remote_ble_disctimeout_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get VERSION_INFO - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -726,7 +727,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-					&prop_emu_ble_remote_verinfo_req),
+					&prop_emu_remote_ble_verinfo_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Get FRIENDLY_NAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -739,7 +740,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_get_device_prop_action,
-						&prop_emu_ble_remote_fname_req),
+						&prop_emu_remote_ble_fname_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set FRIENDLY_NAME - Success",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -752,10 +753,10 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_SUCCESS(bt_set_device_prop_action,
-						&prop_emu_ble_remote_fname_req),
+						&prop_emu_remote_ble_fname_req),
 		ACTION_SUCCESS(bt_get_device_prop_action,
-						&prop_emu_ble_remote_fname_req),
-		CALLBACK_DEVICE_PROPS(&prop_emu_ble_remote_fname_prop, 1),
+						&prop_emu_remote_ble_fname_req),
+		CALLBACK_DEVICE_PROPS(&prop_emu_remote_ble_fname_prop, 1),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set BDNAME - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -768,7 +769,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_bdname_req),
+					&prop_test_remote_ble_bdname_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set UUIDS - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -781,7 +782,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_uuids_req),
+					&prop_test_remote_ble_uuids_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set COD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -794,7 +795,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-						&prop_test_ble_remote_cod_req),
+						&prop_test_remote_ble_cod_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set TOD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -807,7 +808,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-						&prop_test_ble_remote_tod_req),
+						&prop_test_remote_ble_tod_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set RSSI - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -820,7 +821,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-						&prop_test_ble_remote_rssi_req),
+						&prop_test_remote_ble_rssi_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set TIMESTAMP - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -833,7 +834,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_timestamp_req),
+					&prop_test_remote_ble_timestamp_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set BDADDR - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -846,7 +847,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_bdaddr_req),
+					&prop_test_remote_ble_bdaddr_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set SERVICE_RECORD - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -859,7 +860,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_srvc_record_req),
+					&prop_test_remote_ble_srvc_record_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set SCAN_MODE - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -872,7 +873,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_scanmode_req),
+					&prop_test_remote_ble_scanmode_req),
 	),
 	TEST_CASE_BREDRLE("Bt. Device Set BONDED_DEVICES - Fail",
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
@@ -898,7 +899,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
 							BT_DISCOVERY_STOPPED),
 		ACTION_FAIL(bt_set_device_prop_action,
-					&prop_test_ble_remote_disc_timeout_req),
+					&prop_test_remote_ble_disc_timeout_req),
 	),
 };
 
-- 
1.9.1


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

* [PATCH 05/11] android/tester-ng: Add missing check for callback status
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (2 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 04/11] android/tester-ng: Improve variable's names Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 06/11] android/tester-ng: Add pin request and bond state callbacks Jakub Tyszkowski
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/android/tester-main.c b/android/tester-main.c
index c850082..17962e7 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -424,6 +424,12 @@ static bool match_data(struct step *step)
 			return false;
 		}
 
+		if (exp->callback_result.status !=
+						step->callback_result.status) {
+			tester_debug("Callback status don't match");
+			return false;
+		}
+
 		if (exp->callback_result.properties &&
 				verify_property(exp->callback_result.properties,
 				exp->callback_result.num_properties,
-- 
1.9.1


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

* [PATCH 06/11] android/tester-ng: Add pin request and bond state callbacks
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (3 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 05/11] android/tester-ng: Add missing check for callback status Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 07/11] android/tester-ng: Add BREDR pairing with pin test case Jakub Tyszkowski
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

To fully verify data passed by these callbacks we reuse existing
device properties verification mechanism. For this, callback argumenents
are repacked to properties array for further verification.
Those are verified against values passed to the callback step definition
macro just like with any other definition of callback step in which
we get device properties.

An alternative would be to extend 'bt_callback_data' struct and add new
fields for bdaddr, name, class of device and other properties, that we
get in callbacks as sepparate values and not as list of props.
---
 android/tester-main.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 75 insertions(+), 2 deletions(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 17962e7..043c0b9 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -570,6 +570,33 @@ static bt_property_t *copy_properties(int num_properties,
 	return props;
 }
 
+static bt_property_t *repack_properties(int num_properties,
+						bt_property_t **properties)
+{
+	int i;
+	bt_property_t *props = g_new0(bt_property_t, num_properties);
+
+	for (i = 0; i < num_properties; i++) {
+		props[i].type = properties[i]->type;
+		props[i].len = properties[i]->len;
+		props[i].val = g_memdup(properties[i]->val, properties[i]->len);
+	}
+
+	return props;
+}
+
+static bt_property_t *create_property(bt_property_type_t type, void *val,
+								int len)
+{
+	bt_property_t *prop = g_new0(bt_property_t, 1);
+
+	prop->type = type;
+	prop->len = len;
+	prop->val = g_memdup(val, len);
+
+	return prop;
+}
+
 static void adapter_properties_cb(bt_status_t status, int num_properties,
 						bt_property_t *properties)
 {
@@ -622,6 +649,52 @@ static void remote_device_properties_cb(bt_status_t status,
 	schedule_callback_call(step);
 }
 
+static void bond_state_changed_cb(bt_status_t status,
+						bt_bdaddr_t *remote_bd_addr,
+						bt_bond_state_t state)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback_result.status = status;
+	step->callback_result.state = state;
+
+	/* Utilize property verification mechanism for bdaddr */
+	step->callback_result.num_properties = 1;
+	step->callback_result.properties = create_property(BT_PROPERTY_BDADDR,
+						remote_bd_addr,
+						sizeof(*remote_bd_addr));
+
+	step->callback = CB_BT_BOND_STATE_CHANGED;
+
+	schedule_callback_call(step);
+}
+
+static void pin_request_cb(bt_bdaddr_t *remote_bd_addr,
+					bt_bdname_t *bd_name, uint32_t cod)
+{
+	struct step *step = g_new0(struct step, 1);
+	bt_property_t *props[3];
+
+	step->callback = CB_BT_PIN_REQUEST;
+
+	/* Utilize property verification mechanism for those */
+	props[0] = create_property(BT_PROPERTY_BDADDR, remote_bd_addr,
+						sizeof(*remote_bd_addr));
+	props[1] = create_property(BT_PROPERTY_BDNAME, bd_name->name,
+						strlen((char *) bd_name->name));
+	props[2] = create_property(BT_PROPERTY_CLASS_OF_DEVICE, &cod,
+								sizeof(cod));
+
+	step->callback_result.num_properties = 3;
+	step->callback_result.properties = repack_properties(3, props);
+
+	g_free(props[0]);
+	g_free(props[1]);
+	g_free(props[2]);
+
+	schedule_callback_call(step);
+}
+
 static bt_callbacks_t bt_callbacks = {
 	.size = sizeof(bt_callbacks),
 	.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -629,9 +702,9 @@ static bt_callbacks_t bt_callbacks = {
 	.remote_device_properties_cb = remote_device_properties_cb,
 	.device_found_cb = device_found_cb,
 	.discovery_state_changed_cb = discovery_state_changed_cb,
-	.pin_request_cb = NULL,
+	.pin_request_cb = pin_request_cb,
 	.ssp_request_cb = NULL,
-	.bond_state_changed_cb = NULL,
+	.bond_state_changed_cb = bond_state_changed_cb,
 	.acl_state_changed_cb = NULL,
 	.thread_evt_cb = NULL,
 	.dut_mode_recv_cb = NULL,
-- 
1.9.1


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

* [PATCH 07/11] android/tester-ng: Add BREDR pairing with pin test case
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (4 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 06/11] android/tester-ng: Add pin request and bond state callbacks Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 08/11] android/tester-ng: Add wrong PIN reply " Jakub Tyszkowski
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This also adds some actions for setting pin the emulated device and
for calling bonding api of bluetooth core.
---
 android/tester-bluetooth.c | 59 +++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.c      | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.h      | 14 +++++++++++
 3 files changed, 135 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 020bbe2..ebb85be 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -86,11 +86,18 @@ static bt_property_t prop_emu_bonded_devs = {
 static bt_bdaddr_t emu_remote_bdaddr_val = {
 	.address = { 0x00, 0xaa, 0x01, 0x01, 0x00, 0x00 },
 };
+static bt_property_t prop_emu_remote_bdadr = {
+	.type = BT_PROPERTY_BDADDR,
+	.val = &emu_remote_bdaddr_val,
+	.len = sizeof(emu_remote_bdaddr_val),
+};
 static struct bt_action_data prop_emu_remote_ble_bdaddr_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.prop_type = BT_PROPERTY_BDADDR,
 };
 
+static uint32_t emu_remote_type_val = BT_DEVICE_DEVTYPE_BREDR;
+
 static uint32_t emu_remote_tod_ble_val = BT_DEVICE_DEVTYPE_BLE;
 static bt_property_t prop_emu_remote_ble_tod_prop = {
 	.type = BT_PROPERTY_TYPE_OF_DEVICE,
@@ -102,6 +109,8 @@ static struct bt_action_data prop_emu_remote_ble_tod_req = {
 	.prop_type = BT_PROPERTY_TYPE_OF_DEVICE,
 };
 
+static int32_t emu_remote_rssi_val = -60;
+
 static int32_t emu_remote_ble_rssi_val = 127;
 static bt_property_t prop_emu_remote_ble_rssi_prop = {
 	.type = BT_PROPERTY_REMOTE_RSSI,
@@ -187,6 +196,15 @@ static struct bt_action_data prop_emu_remote_ble_fname_req = {
 	.prop = &prop_emu_remote_ble_fname_prop,
 };
 
+static bt_pin_code_t emu_pin_value = {
+	.pin = { 0x30, 0x30, 0x30, 0x30 },
+};
+static struct bt_action_data emu_pin_set_req = {
+	.addr = &emu_remote_bdaddr_val,
+	.pin = &emu_pin_value,
+	.pin_len = 4,
+};
+
 static bt_property_t prop_emu_default_set[] = {
 	{ BT_PROPERTY_BDADDR, sizeof(emu_bdaddr_val), NULL },
 	{ BT_PROPERTY_BDNAME, sizeof(emu_bdname_val) - 1, &emu_bdname_val },
@@ -210,6 +228,15 @@ static bt_property_t prop_emu_remote_bles_default_set[] = {
 						&emu_remote_ble_rssi_val },
 };
 
+static bt_property_t prop_emu_remotes_default_set[] = {
+	{ BT_PROPERTY_BDADDR, sizeof(emu_remote_bdaddr_val),
+						&emu_remote_bdaddr_val },
+	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_type_val),
+						&emu_remote_type_val },
+	{ BT_PROPERTY_REMOTE_RSSI, sizeof(emu_remote_rssi_val),
+						&emu_remote_rssi_val },
+};
+
 static bt_property_t prop_emu_remote_bles_query_set[] = {
 	{ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(emu_remote_tod_ble_val),
 						&emu_remote_tod_ble_val },
@@ -223,6 +250,15 @@ static bt_property_t prop_emu_remote_bles_query_set[] = {
 	{ BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP, 4, NULL },
 };
 
+static bt_property_t prop_emu_remotes_pin_req_set[] = {
+	{ BT_PROPERTY_BDADDR, sizeof(emu_remote_bdaddr_val),
+						&emu_remote_bdaddr_val },
+	{ BT_PROPERTY_CLASS_OF_DEVICE, sizeof(emu_remote_cod_val),
+						&emu_remote_cod_val },
+	{ BT_PROPERTY_BDNAME, sizeof(emu_remote_bdname_val) - 1,
+						&emu_remote_bdname_val },
+};
+
 static char test_bdname[] = "test_bdname";
 static bt_property_t prop_test_bdname = {
 	.type = BT_PROPERTY_BDNAME,
@@ -901,6 +937,29 @@ static struct test_case test_cases[] = {
 		ACTION_FAIL(bt_set_device_prop_action,
 					&prop_test_remote_ble_disc_timeout_req),
 	),
+	TEST_CASE_BREDR("Bt. Create Bond PIN - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_pin_code_action, &emu_pin_set_req),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_PROPS(CB_BT_PIN_REQUEST, prop_emu_remotes_pin_req_set,
+									2),
+		ACTION_SUCCESS(bt_pin_reply_accept_action,
+							&emu_pin_set_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
+						&prop_emu_remote_bdadr, 1),
+	),
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.c b/android/tester-main.c
index 043c0b9..9a06ffe 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -1019,6 +1019,27 @@ void emu_setup_powered_remote_action(void)
 		bthost_write_scan_enable(bthost, 0x03);
 }
 
+void emu_set_pin_code_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct bt_action_data *action_data = current_data_step->set_data;
+	struct bthost *bthost;
+	struct step step;
+
+	bthost = hciemu_client_get_host(data->hciemu);
+
+	bthost_set_pin_code(bthost, action_data->pin->pin,
+							action_data->pin_len);
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = BT_STATUS_SUCCESS;
+
+	tester_print("Setting emu pin done.");
+
+	verify_step(&step, NULL);
+}
+
 void dummy_action(void)
 {
 	struct step step;
@@ -1178,6 +1199,47 @@ void bt_set_device_prop_action(void)
 	verify_step(&step, NULL);
 }
 
+void bt_create_bond_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct bt_action_data *action_data = current_data_step->set_data;
+	struct step step;
+
+	if (!action_data || !action_data->addr) {
+		tester_warn("Bad arguments for 'create bond' req.");
+		tester_test_failed();
+		return;
+	}
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = data->if_bluetooth->create_bond(action_data->addr);
+
+	verify_step(&step, NULL);
+}
+
+void bt_pin_reply_accept_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct bt_action_data *action_data = current_data_step->set_data;
+	struct step step;
+
+	if (!action_data || !action_data->addr || !action_data->pin) {
+		tester_warn("Bad arguments for 'pin reply' req.");
+		tester_test_failed();
+		return;
+	}
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = data->if_bluetooth->pin_reply(action_data->addr,
+							TRUE,
+							action_data->pin_len,
+							action_data->pin);
+
+	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 883ec4d..a8cf4a2 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -99,6 +99,13 @@
 #define CALLBACK_DEVICE_FOUND(props, prop_cnt) \
 	CALLBACK_PROPS(CB_BT_DEVICE_FOUND, props, prop_cnt)
 
+#define CALLBACK_BOND_STATE(cb_res, props, prop_cnt) { \
+		.callback = CB_BT_BOND_STATE_CHANGED, \
+		.callback_result.state = cb_res, \
+		.callback_result.properties = props, \
+		.callback_result.num_properties = prop_cnt, \
+	}
+
 /*
  * NOTICE:
  * Callback enum sections should be
@@ -190,6 +197,10 @@ struct bt_action_data {
 	/* Remote props action arguments */
 	int prop_type;
 	bt_property_t *prop;
+
+	/* Bonding requests parameters */
+	bt_pin_code_t *pin;
+	uint8_t pin_len;
 };
 
 /*
@@ -238,6 +249,7 @@ void remove_gatt_tests(void);
 
 /* Emulator actions */
 void emu_setup_powered_remote_action(void);
+void emu_set_pin_code_action(void);
 
 /* Actions */
 void dummy_action(void);
@@ -250,3 +262,5 @@ void bt_cancel_discovery_action(void);
 void bt_get_device_props_action(void);
 void bt_get_device_prop_action(void);
 void bt_set_device_prop_action(void);
+void bt_create_bond_action(void);
+void bt_pin_reply_accept_action(void);
-- 
1.9.1


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

* [PATCH 08/11] android/tester-ng: Add wrong PIN reply test case
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (5 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 07/11] android/tester-ng: Add BREDR pairing with pin test case Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 09/11] android/tester-ng: Add ssp confirmation cases Jakub Tyszkowski
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/tester-bluetooth.c | 32 ++++++++++++++++++++++++++++++++
 android/tester-main.h      |  8 ++++++++
 2 files changed, 40 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index ebb85be..f35b023 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -199,11 +199,19 @@ static struct bt_action_data prop_emu_remote_ble_fname_req = {
 static bt_pin_code_t emu_pin_value = {
 	.pin = { 0x30, 0x30, 0x30, 0x30 },
 };
+static bt_pin_code_t emu_pin_invalid_value = {
+	.pin = { 0x30, 0x10, 0x30, 0x30 },
+};
 static struct bt_action_data emu_pin_set_req = {
 	.addr = &emu_remote_bdaddr_val,
 	.pin = &emu_pin_value,
 	.pin_len = 4,
 };
+static struct bt_action_data emu_pin_set_invalid_req = {
+	.addr = &emu_remote_bdaddr_val,
+	.pin = &emu_pin_invalid_value,
+	.pin_len = 4,
+};
 
 static bt_property_t prop_emu_default_set[] = {
 	{ BT_PROPERTY_BDADDR, sizeof(emu_bdaddr_val), NULL },
@@ -960,6 +968,30 @@ static struct test_case test_cases[] = {
 		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
 						&prop_emu_remote_bdadr, 1),
 	),
+	TEST_CASE_BREDR("Bt. Create Bond PIN - Bad PIN",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_pin_code_action, &emu_pin_set_req),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_PROPS(CB_BT_PIN_REQUEST, prop_emu_remotes_pin_req_set,
+									2),
+		ACTION_SUCCESS(bt_pin_reply_accept_action,
+						&emu_pin_set_invalid_req),
+		CALLBACK_BOND_STATE_FAILED(BT_BOND_STATE_NONE,
+						&prop_emu_remote_bdadr, 1,
+						BT_STATUS_AUTH_FAILURE),
+	),
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.h b/android/tester-main.h
index a8cf4a2..d49344e 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -106,6 +106,14 @@
 		.callback_result.num_properties = prop_cnt, \
 	}
 
+#define CALLBACK_BOND_STATE_FAILED(cb_res, props, prop_cnt, reason) { \
+		.callback = CB_BT_BOND_STATE_CHANGED, \
+		.callback_result.state = cb_res, \
+		.callback_result.status = reason, \
+		.callback_result.properties = props, \
+		.callback_result.num_properties = prop_cnt, \
+	}
+
 /*
  * NOTICE:
  * Callback enum sections should be
-- 
1.9.1


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

* [PATCH 09/11] android/tester-ng: Add ssp confirmation cases
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (6 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 08/11] android/tester-ng: Add wrong PIN reply " Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 10/11] android/tester-ng: Add more bonding cases Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 11/11] android/tester: Remove old bluetooth core test cases Jakub Tyszkowski
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Needed actions were added to properly execute spp procedure. Also
callback data was extended to verify incomming ssp variant, and
action data was extended to pass ssp accept parameters.
---
 android/tester-bluetooth.c | 59 ++++++++++++++++++++++++++++++++++++++++
 android/tester-main.c      | 67 +++++++++++++++++++++++++++++++++++++++++++++-
 android/tester-main.h      | 13 +++++++++
 3 files changed, 138 insertions(+), 1 deletion(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index f35b023..3f0f0c4 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -425,6 +425,18 @@ static struct bt_action_data prop_test_remote_ble_timestamp_req = {
 	.prop = &prop_test_remote_ble_timestamp_prop,
 };
 
+static struct bt_action_data ssp_confirm_accept_reply = {
+	.addr = &emu_remote_bdaddr_val,
+	.ssp_variant = BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+	.accept = TRUE,
+};
+
+static struct bt_action_data ssp_confirm_reject_reply = {
+	.addr = &emu_remote_bdaddr_val,
+	.ssp_variant = BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+	.accept = FALSE,
+};
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("Bt. Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -992,6 +1004,53 @@ static struct test_case test_cases[] = {
 						&prop_emu_remote_bdadr, 1,
 						BT_STATUS_AUTH_FAILURE),
 	),
+	TEST_CASE_BREDR("Bt. Create Bond SSP -Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+					prop_emu_remotes_pin_req_set, 2),
+		ACTION_SUCCESS(bt_ssp_reply_accept_action,
+						&ssp_confirm_accept_reply),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
+						&prop_emu_remote_bdadr, 1),
+	),
+	TEST_CASE_BREDR("Bt. Create Bond SSP - Negative reply",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+					prop_emu_remotes_pin_req_set, 2),
+		ACTION_SUCCESS(bt_ssp_reply_accept_action,
+						&ssp_confirm_reject_reply),
+		CALLBACK_BOND_STATE_FAILED(BT_BOND_STATE_NONE,
+						&prop_emu_remote_bdadr, 1,
+						BT_STATUS_AUTH_FAILURE),
+	),
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.c b/android/tester-main.c
index 9a06ffe..4effc2d 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -430,6 +430,12 @@ static bool match_data(struct step *step)
 			return false;
 		}
 
+		if (exp->callback_result.pairing_variant !=
+					step->callback_result.pairing_variant) {
+			tester_debug("Callback pairing result don't match");
+			return false;
+		}
+
 		if (exp->callback_result.properties &&
 				verify_property(exp->callback_result.properties,
 				exp->callback_result.num_properties,
@@ -695,6 +701,34 @@ static void pin_request_cb(bt_bdaddr_t *remote_bd_addr,
 	schedule_callback_call(step);
 }
 
+static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr,
+					bt_bdname_t *bd_name, uint32_t cod,
+					bt_ssp_variant_t pairing_variant,
+					uint32_t pass_key)
+{
+	struct step *step = g_new0(struct step, 1);
+	bt_property_t *props[3];
+
+	step->callback = CB_BT_SSP_REQUEST;
+
+	/* Utilize property verification mechanism for those */
+	props[0] = create_property(BT_PROPERTY_BDADDR, remote_bd_addr,
+						sizeof(*remote_bd_addr));
+	props[1] = create_property(BT_PROPERTY_BDNAME, bd_name->name,
+						strlen((char *) bd_name->name));
+	props[2] = create_property(BT_PROPERTY_CLASS_OF_DEVICE, &cod,
+								sizeof(cod));
+
+	step->callback_result.num_properties = 3;
+	step->callback_result.properties = repack_properties(3, props);
+
+	g_free(props[0]);
+	g_free(props[1]);
+	g_free(props[2]);
+
+	schedule_callback_call(step);
+}
+
 static bt_callbacks_t bt_callbacks = {
 	.size = sizeof(bt_callbacks),
 	.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -703,7 +737,7 @@ static bt_callbacks_t bt_callbacks = {
 	.device_found_cb = device_found_cb,
 	.discovery_state_changed_cb = discovery_state_changed_cb,
 	.pin_request_cb = pin_request_cb,
-	.ssp_request_cb = NULL,
+	.ssp_request_cb = ssp_request_cb,
 	.bond_state_changed_cb = bond_state_changed_cb,
 	.acl_state_changed_cb = NULL,
 	.thread_evt_cb = NULL,
@@ -1040,6 +1074,22 @@ void emu_set_pin_code_action(void)
 	verify_step(&step, NULL);
 }
 
+void emu_set_ssp_mode_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct bthost *bthost;
+	struct step step;
+
+	bthost = hciemu_client_get_host(data->hciemu);
+
+	bthost_write_ssp_mode(bthost, 0x01);
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = BT_STATUS_SUCCESS;
+
+	verify_step(&step, NULL);
+}
+
 void dummy_action(void)
 {
 	struct step step;
@@ -1240,6 +1290,21 @@ void bt_pin_reply_accept_action(void)
 	verify_step(&step, NULL);
 }
 
+void bt_ssp_reply_accept_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct bt_action_data *action_data = current_data_step->set_data;
+	struct step step;
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = data->if_bluetooth->ssp_reply(action_data->addr,
+						action_data->ssp_variant,
+						action_data->accept, 0);
+
+	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 d49344e..ee05cce 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -114,6 +114,13 @@
 		.callback_result.num_properties = prop_cnt, \
 	}
 
+#define CALLBACK_SSP_REQ(pair_var, props, prop_cnt) { \
+		.callback = CB_BT_SSP_REQUEST, \
+		.callback_result.pairing_variant = pair_var, \
+		.callback_result.properties = props, \
+		.callback_result.num_properties = prop_cnt, \
+	}
+
 /*
  * NOTICE:
  * Callback enum sections should be
@@ -209,6 +216,8 @@ struct bt_action_data {
 	/* Bonding requests parameters */
 	bt_pin_code_t *pin;
 	uint8_t pin_len;
+	uint8_t ssp_variant;
+	bool accept;
 };
 
 /*
@@ -221,6 +230,8 @@ struct bt_callback_data {
 	bt_status_t status;
 	int num_properties;
 	bt_property_t *properties;
+
+	bt_ssp_variant_t pairing_variant;
 };
 
 /*
@@ -258,6 +269,7 @@ void remove_gatt_tests(void);
 /* Emulator actions */
 void emu_setup_powered_remote_action(void);
 void emu_set_pin_code_action(void);
+void emu_set_ssp_mode_action(void);
 
 /* Actions */
 void dummy_action(void);
@@ -272,3 +284,4 @@ void bt_get_device_prop_action(void);
 void bt_set_device_prop_action(void);
 void bt_create_bond_action(void);
 void bt_pin_reply_accept_action(void);
+void bt_ssp_reply_accept_action(void);
-- 
1.9.1


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

* [PATCH 10/11] android/tester-ng: Add more bonding cases
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (7 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 09/11] android/tester-ng: Add ssp confirmation cases Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  2014-07-18 11:51 ` [PATCH 11/11] android/tester: Remove old bluetooth core test cases Jakub Tyszkowski
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This adds more cases for bond, bond canceling and bond removal.
---
 android/tester-bluetooth.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.c      | 26 ++++++++++++++
 android/tester-main.h      |  2 ++
 3 files changed, 118 insertions(+)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 3f0f0c4..79e3246 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -378,6 +378,11 @@ static struct bt_action_data prop_test_remote_ble_bdaddr_req = {
 	.prop_type = BT_PROPERTY_BDADDR,
 	.prop = &prop_test_bdaddr,
 };
+static struct bt_action_data prop_test_bdaddr_req = {
+	.addr = &test_bdaddr_val,
+	.prop_type = BT_PROPERTY_BDADDR,
+	.prop = &prop_test_bdaddr,
+};
 
 static bt_scan_mode_t setprop_scan_mode_conn_val = BT_SCAN_MODE_CONNECTABLE;
 
@@ -1051,6 +1056,91 @@ static struct test_case test_cases[] = {
 						&prop_emu_remote_bdadr, 1,
 						BT_STATUS_AUTH_FAILURE),
 	),
+	TEST_CASE_BREDR("Bt. Create Bond - No Discovery",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+					prop_emu_remotes_pin_req_set, 2),
+		ACTION_SUCCESS(bt_ssp_reply_accept_action,
+						&ssp_confirm_accept_reply),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
+						&prop_emu_remote_bdadr, 1),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
+	TEST_CASE_BREDR("Bt. Create Bond - Bad Address",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_create_bond_action, &prop_test_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+							&prop_test_bdaddr, 1),
+		CALLBACK_BOND_STATE_FAILED(BT_BOND_STATE_NONE,
+							&prop_test_bdaddr, 1,
+							BT_STATUS_FAIL),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
+	TEST_CASE_BREDR("Bt. Cancel Bonding - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+					prop_emu_remotes_pin_req_set, 2),
+		ACTION_SUCCESS(bt_cancel_bond_action, &emu_remote_bdaddr_val),
+		CALLBACK_BOND_STATE_FAILED(BT_BOND_STATE_NONE,
+						&prop_emu_remote_bdadr, 1,
+						BT_STATUS_FAIL),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
+	TEST_CASE_BREDR("Bt. Remove Bond - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 3),
+		ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STOPPED),
+		ACTION_SUCCESS(bt_create_bond_action,
+					&prop_test_remote_ble_bdaddr_req),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING,
+						&prop_emu_remote_bdadr, 1),
+		CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+					prop_emu_remotes_pin_req_set, 2),
+		ACTION_SUCCESS(bt_ssp_reply_accept_action,
+						&ssp_confirm_accept_reply),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
+						&prop_emu_remote_bdadr, 1),
+		ACTION_SUCCESS(bt_remove_bond_action, &emu_remote_bdaddr_val),
+		CALLBACK_BOND_STATE(BT_BOND_STATE_NONE,
+						&prop_emu_remote_bdadr, 1),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.c b/android/tester-main.c
index 4effc2d..5496d2e 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -1305,6 +1305,32 @@ void bt_ssp_reply_accept_action(void)
 	verify_step(&step, NULL);
 }
 
+void bt_cancel_bond_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	bt_bdaddr_t *addr = current_data_step->set_data;
+	struct step step;
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = data->if_bluetooth->cancel_bond(addr);
+
+	verify_step(&step, NULL);
+}
+
+void bt_remove_bond_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	bt_bdaddr_t *addr = current_data_step->set_data;
+	struct step step;
+
+	memset(&step, 0, sizeof(step));
+	step.action_status = data->if_bluetooth->remove_bond(addr);
+
+	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 ee05cce..a239ae1 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -285,3 +285,5 @@ void bt_set_device_prop_action(void);
 void bt_create_bond_action(void);
 void bt_pin_reply_accept_action(void);
 void bt_ssp_reply_accept_action(void);
+void bt_cancel_bond_action(void);
+void bt_remove_bond_action(void);
-- 
1.9.1


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

* [PATCH 11/11] android/tester: Remove old bluetooth core test cases
  2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
                   ` (8 preceding siblings ...)
  2014-07-18 11:51 ` [PATCH 10/11] android/tester-ng: Add more bonding cases Jakub Tyszkowski
@ 2014-07-18 11:51 ` Jakub Tyszkowski
  9 siblings, 0 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-18 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

This removes few last bluetooth cases from the old tester.
All cases were ported to new testing framework.
---
 android/android-tester.c | 282 -----------------------------------------------
 1 file changed, 282 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 2b72bd8..ae86b87 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -263,36 +263,6 @@ static void test_update_state(void)
 	}
 }
 
-static void test_mgmt_settings_set(struct test_data *data)
-{
-	data->conditions_left--;
-
-	test_update_state();
-}
-
-static void command_generic_new_settings(uint16_t index, uint16_t length,
-					const void *param, void *user_data)
-{
-	struct test_data *data = tester_get_data();
-	const struct generic_data *test_data = data->test_data;
-	uint32_t settings;
-
-	if (length != 4) {
-		tester_warn("Invalid parameter size for new settings event");
-		tester_test_failed();
-		return;
-	}
-
-	settings = get_le32(param);
-
-	if ((settings & test_data->expect_settings_set) !=
-					test_data->expect_settings_set)
-		return;
-
-	test_mgmt_settings_set(data);
-	mgmt_unregister(data->mgmt, data->mgmt_settings_id);
-}
-
 static void check_cb_count(void)
 {
 	struct test_data *data = tester_get_data();
@@ -306,64 +276,6 @@ static void check_cb_count(void)
 	}
 }
 
-static void expected_cb_count_init(struct test_data *data)
-{
-	const struct generic_data *test_data = data->test_data;
-
-	data->cb_count = test_data->expected_cb_count;
-
-	check_cb_count();
-}
-
-static void mgmt_cb_init(struct test_data *data)
-{
-	const struct generic_data *test_data = data->test_data;
-
-	if (!test_data->expect_settings_set)
-		test_mgmt_settings_set(data);
-	else
-		data->mgmt_settings_id = mgmt_register(data->mgmt,
-				MGMT_EV_NEW_SETTINGS, data->mgmt_index,
-				command_generic_new_settings, NULL, NULL);
-}
-
-static void expected_status_init(struct test_data *data)
-{
-	const struct generic_data *test_data = data->test_data;
-
-	if (test_data->expected_adapter_status == BT_STATUS_NOT_EXPECTED)
-		data->conditions_left--;
-}
-
-static void test_property_init(struct test_data *data)
-{
-	const struct generic_data *test_data = data->test_data;
-	GSList *l = data->expected_properties_list;
-	int i;
-
-	if (!test_data->expected_properties_num) {
-		data->conditions_left--;
-		return;
-	}
-
-	for (i = 0; i < test_data->expected_properties_num; i++)
-		l = g_slist_prepend(l, &(test_data->expected_properties[i]));
-
-	data->expected_properties_list = l;
-}
-
-static void init_test_conditions(struct test_data *data)
-{
-	data->test_checks_valid = true;
-
-	data->conditions_left = 4;
-
-	expected_cb_count_init(data);
-	mgmt_cb_init(data);
-	expected_status_init(data);
-	test_property_init(data);
-}
-
 static void check_expected_status(uint8_t status)
 {
 	struct test_data *data = tester_get_data();
@@ -2110,28 +2022,6 @@ static bool setup(struct test_data *data)
 	return true;
 }
 
-static void setup_enabled_adapter(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;
-	}
-
-	status = data->if_bluetooth->enable();
-	if (status != BT_STATUS_SUCCESS)
-		tester_setup_failed();
-}
-
 static void teardown(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -2163,138 +2053,6 @@ static void test_dummy(const void *test_data)
 	tester_test_passed();
 }
 
-static void bond_device_auth_fail_callback(uint16_t index, uint16_t length,
-							const void *param,
-							void *user_data)
-{
-	const struct mgmt_ev_auth_failed *ev = param;
-
-	check_expected_status(ev->status);
-}
-
-static void test_bond_create_pin_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	static uint8_t pair_device_pin[] = { 0x30, 0x30, 0x30, 0x30 };
-	const void *pin = pair_device_pin;
-	uint8_t pin_len = 4;
-
-	init_test_conditions(data);
-
-	bthost_set_pin_code(bthost, pin, pin_len);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_bond_create_pin_fail(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	static uint8_t pair_device_pin[] = { 0x30, 0x30, 0x30, 0x30 };
-	const void *pin = pair_device_pin;
-	uint8_t pin_len = 4;
-
-	init_test_conditions(data);
-
-	mgmt_register(data->mgmt, MGMT_EV_AUTH_FAILED, data->mgmt_index,
-					bond_device_auth_fail_callback, data,
-					NULL);
-
-	bthost_set_pin_code(bthost, pin, pin_len);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_bond_create_ssp_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	init_test_conditions(data);
-
-	bthost_write_ssp_mode(bthost, 0x01);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_bond_create_ssp_fail(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	init_test_conditions(data);
-
-	mgmt_register(data->mgmt, MGMT_EV_AUTH_FAILED, data->mgmt_index,
-					bond_device_auth_fail_callback, data,
-					NULL);
-
-	bthost_write_ssp_mode(bthost, 0x01);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_bond_create_no_disc_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
-	bt_bdaddr_t remote_addr;
-	bt_status_t status;
-
-	init_test_conditions(data);
-
-	bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
-
-	bthost_write_ssp_mode(bthost, 0x01);
-
-	status = data->if_bluetooth->create_bond(&remote_addr);
-	check_expected_status(status);
-}
-
-static void test_bond_create_bad_addr_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	bt_bdaddr_t bad_addr = {
-		.address = { 0x12, 0x34, 0x56, 0x78, 0x90, 0x12 }
-	};
-
-	init_test_conditions(data);
-
-	mgmt_register(data->mgmt, MGMT_EV_CONNECT_FAILED, data->mgmt_index,
-					bond_device_auth_fail_callback, data,
-					NULL);
-
-	data->if_bluetooth->create_bond(&bad_addr);
-}
-
-static void test_bond_cancel_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	init_test_conditions(data);
-
-	bthost_write_ssp_mode(bthost, 0x01);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_bond_remove_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
-
-	init_test_conditions(data);
-
-	bthost_write_ssp_mode(bthost, 0x01);
-
-	data->if_bluetooth->start_discovery();
-}
-
 /* Test Socket HAL */
 
 static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -3376,46 +3134,6 @@ int main(int argc, char *argv[])
 
 	tester_init(&argc, &argv);
 
-	test_bredr("Bluetooth Create Bond PIN - Success",
-					&bt_bond_create_pin_success_test,
-					setup_enabled_adapter,
-					test_bond_create_pin_success, teardown);
-
-	test_bredr("Bluetooth Create Bond PIN - Bad PIN",
-					&bt_bond_create_pin_fail_test,
-					setup_enabled_adapter,
-					test_bond_create_pin_fail, teardown);
-
-	test_bredr("Bluetooth Create Bond SSP - Success",
-					&bt_bond_create_ssp_success_test,
-					setup_enabled_adapter,
-					test_bond_create_ssp_success, teardown);
-
-	test_bredr("Bluetooth Create Bond SSP - Negative reply",
-					&bt_bond_create_ssp_fail_test,
-					setup_enabled_adapter,
-					test_bond_create_ssp_fail, teardown);
-
-	test_bredrle("Bluetooth Create Bond - No Discovery",
-				&bt_bond_create_no_disc_success_test,
-				setup_enabled_adapter,
-				test_bond_create_no_disc_success, teardown);
-
-	test_bredrle("Bluetooth Create Bond - Bad Address",
-				&bt_bond_create_bad_addr_success_test,
-				setup_enabled_adapter,
-				test_bond_create_bad_addr_success, teardown);
-
-	test_bredr("Bluetooth Cancel Bonding - Success",
-					&bt_bond_cancel_success_test,
-					setup_enabled_adapter,
-					test_bond_cancel_success, teardown);
-
-	test_bredr("Bluetooth Remove Bond - Success",
-					&bt_bond_remove_success_test,
-					setup_enabled_adapter,
-					test_bond_remove_success, teardown);
-
 	test_bredrle("Socket Init", NULL, setup_socket_interface,
 						test_dummy, teardown);
 
-- 
1.9.1


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

end of thread, other threads:[~2014-07-18 11:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 11:51 [PATCH 01/11] android/tester-ng: Allow test framework user to choose emu type Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 02/11] android/tester-ng: Improve result print Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 03/11] android/tester-ng: Improve callback defining makro Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 04/11] android/tester-ng: Improve variable's names Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 05/11] android/tester-ng: Add missing check for callback status Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 06/11] android/tester-ng: Add pin request and bond state callbacks Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 07/11] android/tester-ng: Add BREDR pairing with pin test case Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 08/11] android/tester-ng: Add wrong PIN reply " Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 09/11] android/tester-ng: Add ssp confirmation cases Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 10/11] android/tester-ng: Add more bonding cases Jakub Tyszkowski
2014-07-18 11:51 ` [PATCH 11/11] android/tester: Remove old bluetooth core test cases Jakub Tyszkowski

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.