* [PATCH 1/5] android/tester: Add property check and bdname set success test case
@ 2013-12-12 17:14 Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 2/5] android/tester: Add scan mode set prop " Grzegorz Kolodziejczyk
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2013-12-12 17:14 UTC (permalink / raw)
To: linux-bluetooth
This adds handling of property check, bdname set property success.
---
android/android-tester.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index a50ed7b..dcc0e33 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -63,6 +63,7 @@ enum hal_bluetooth_callbacks_id {
struct generic_data {
uint8_t expected_adapter_status;
uint32_t expect_settings_set;
+ bt_property_t expected_property;
uint8_t expected_hal_callbacks[];
};
@@ -93,7 +94,9 @@ struct test_data {
bool mgmt_settings_set;
bool hal_cb_called;
bool status_checked;
+ bool property_checked;
+ bt_property_t test_property;
GSList *expected_callbacks;
};
@@ -109,6 +112,8 @@ static void test_update_state(void)
return;
if (!(data->status_checked))
return;
+ if (!(data->property_checked))
+ return;
tester_test_passed();
}
@@ -175,11 +180,20 @@ static void expected_status_init(struct test_data *data)
data->status_checked = true;
}
+static void test_property_init(struct test_data *data)
+{
+ const struct generic_data *test_data = data->test_data;
+
+ if (!(test_data->expected_property.type))
+ data->property_checked = true;
+}
+
static void init_test_conditions(struct test_data *data)
{
hal_cb_init(data);
mgmt_cb_init(data);
expected_status_init(data);
+ test_property_init(data);
}
static void check_expected_status(uint8_t status)
@@ -195,6 +209,33 @@ static void check_expected_status(uint8_t status)
test_update_state();
}
+static void check_test_property(void)
+{
+ struct test_data *data = tester_get_data();
+ bt_property_t expected_prop = data->test_property;
+ const struct generic_data *test_data = data->test_data;
+ bt_property_t test_prop = test_data->expected_property;
+
+ if (test_prop.type && (expected_prop.type != test_prop.type)) {
+ tester_test_failed();
+ return;
+ }
+
+ if (test_prop.len && (expected_prop.len != test_prop.len)) {
+ tester_test_failed();
+ return;
+ }
+
+ if (test_prop.val && memcmp(expected_prop.val, test_prop.val,
+ expected_prop.len)) {
+ tester_test_failed();
+ return;
+ }
+
+ data->property_checked = true;
+ test_update_state();
+}
+
static int get_expected_hal_cb(void)
{
struct test_data *data = tester_get_data();
@@ -446,6 +487,7 @@ static void adapter_properties_cb(bt_status_t status, int num_properties,
bt_property_t *properties)
{
enum hal_bluetooth_callbacks_id hal_cb;
+ struct test_data *data = tester_get_data();
int i;
for (i = 0; i < num_properties; i++) {
@@ -454,6 +496,12 @@ static void adapter_properties_cb(bt_status_t status, int num_properties,
if (hal_cb == adapter_test_setup_mode)
break;
+ data->test_property = *properties;
+
+ if (g_slist_next(data->expected_callbacks) ==
+ adapter_test_end)
+ check_test_property();
+
switch (properties[i].type) {
case BT_PROPERTY_BDADDR:
if (hal_cb != adapter_prop_bdaddr) {
@@ -538,6 +586,14 @@ static const struct generic_data bluetooth_disable_success_test = {
.expected_hal_callbacks = {adapter_state_changed_off, adapter_test_end}
};
+static const struct generic_data bluetooth_setprop_bdname_success_test = {
+ .expected_hal_callbacks = {adapter_prop_bdname, adapter_test_end},
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+ .expected_property.type = BT_PROPERTY_BDNAME,
+ .expected_property.val = "test_bdname",
+ .expected_property.len = 11
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -754,6 +810,20 @@ clean:
close(sock_fd);
}
+static void test_setprop_bdname_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ const bt_property_t *prop = &test->expected_property;
+ bt_status_t adapter_status;
+
+ init_test_conditions(data);
+
+ adapter_status = data->if_bluetooth->set_adapter_property(prop);
+
+ check_expected_status(adapter_status);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -784,6 +854,11 @@ int main(int argc, char *argv[])
test_bredrle("Test Disable - Success", &bluetooth_disable_success_test,
setup_enabled_adapter, test_disable, teardown);
+ test_bredrle("Test Set BDNAME - Success",
+ &bluetooth_setprop_bdname_success_test,
+ setup_enabled_adapter,
+ test_setprop_bdname_success, teardown);
+
test_bredrle("Test Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/5] android/tester: Add scan mode set prop success test case
2013-12-12 17:14 [PATCH 1/5] android/tester: Add property check and bdname set success test case Grzegorz Kolodziejczyk
@ 2013-12-12 17:14 ` Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 3/5] android/tester: Add discovery timeout " Grzegorz Kolodziejczyk
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2013-12-12 17:14 UTC (permalink / raw)
To: linux-bluetooth
This adds scan mode set property success test case.
---
android/android-tester.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index dcc0e33..d2c0e2f 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -40,6 +40,9 @@
adapter_prop_uuids, adapter_prop_cod, \
adapter_prop_scan_mode, adapter_prop_disc_timeout
+static bt_scan_mode_t test_setprop_scanmode_val =
+ BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
+
/*
* those are assigned to HAL methods and callbacks, we use ID later
* on mapped in switch-case due to different functions prototypes.
@@ -594,6 +597,15 @@ static const struct generic_data bluetooth_setprop_bdname_success_test = {
.expected_property.len = 11
};
+static const struct generic_data bluetooth_setprop_scanmode_success_test = {
+ .expected_hal_callbacks = {adapter_prop_scan_mode,
+ adapter_prop_scan_mode, adapter_test_end},
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+ .expected_property.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
+ .expected_property.val = &test_setprop_scanmode_val,
+ .expected_property.len = sizeof(bt_scan_mode_t)
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -824,6 +836,19 @@ static void test_setprop_bdname_success(const void *test_data)
check_expected_status(adapter_status);
}
+static void test_setprop_scanmode_succes(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ const bt_property_t *prop = &test->expected_property;
+ bt_status_t adapter_status;
+
+ init_test_conditions(data);
+
+ adapter_status = data->if_bluetooth->set_adapter_property(prop);
+ check_expected_status(adapter_status);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -859,6 +884,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_setprop_bdname_success, teardown);
+ test_bredrle("Test Set SCAN_MODE - Success",
+ &bluetooth_setprop_scanmode_success_test,
+ setup_enabled_adapter,
+ test_setprop_scanmode_succes, teardown);
+
test_bredrle("Test Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/5] android/tester: Add discovery timeout set prop success test case
2013-12-12 17:14 [PATCH 1/5] android/tester: Add property check and bdname set success test case Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 2/5] android/tester: Add scan mode set prop " Grzegorz Kolodziejczyk
@ 2013-12-12 17:14 ` Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 4/5] android/tester: Add bdaddr get " Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 5/5] android/tester: Add bdname " Grzegorz Kolodziejczyk
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2013-12-12 17:14 UTC (permalink / raw)
To: linux-bluetooth
This adds discovery timeout set property success test case.
---
android/android-tester.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index d2c0e2f..5b7082a 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -42,6 +42,7 @@
static bt_scan_mode_t test_setprop_scanmode_val =
BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
+static uint32_t test_setprop_disctimeout_val = 120;
/*
* those are assigned to HAL methods and callbacks, we use ID later
@@ -606,6 +607,14 @@ static const struct generic_data bluetooth_setprop_scanmode_success_test = {
.expected_property.len = sizeof(bt_scan_mode_t)
};
+static const struct generic_data bluetooth_setprop_disctimeout_success_test = {
+ .expected_hal_callbacks = {adapter_prop_disc_timeout, adapter_test_end},
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+ .expected_property.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+ .expected_property.val = &test_setprop_disctimeout_val,
+ .expected_property.len = sizeof(test_setprop_disctimeout_val)
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -849,6 +858,19 @@ static void test_setprop_scanmode_succes(const void *test_data)
check_expected_status(adapter_status);
}
+static void test_setprop_disctimeout_succes(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ const bt_property_t *prop = &test->expected_property;
+ bt_status_t adapter_status;
+
+ init_test_conditions(data);
+
+ adapter_status = data->if_bluetooth->set_adapter_property(prop);
+ check_expected_status(adapter_status);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -889,6 +911,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_setprop_scanmode_succes, teardown);
+ test_bredrle("Test Set DISCOVERY_TIMEOUT - Success",
+ &bluetooth_setprop_disctimeout_success_test,
+ setup_enabled_adapter,
+ test_setprop_disctimeout_succes, teardown);
+
test_bredrle("Test Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/5] android/tester: Add bdaddr get prop success test case
2013-12-12 17:14 [PATCH 1/5] android/tester: Add property check and bdname set success test case Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 2/5] android/tester: Add scan mode set prop " Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 3/5] android/tester: Add discovery timeout " Grzegorz Kolodziejczyk
@ 2013-12-12 17:14 ` Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 5/5] android/tester: Add bdname " Grzegorz Kolodziejczyk
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2013-12-12 17:14 UTC (permalink / raw)
To: linux-bluetooth
This adds bdaddr set property success test case.
---
android/android-tester.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index 5b7082a..407bfbe 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -615,6 +615,14 @@ static const struct generic_data bluetooth_setprop_disctimeout_success_test = {
.expected_property.len = sizeof(test_setprop_disctimeout_val)
};
+static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
+ .expected_hal_callbacks = {adapter_prop_bdaddr, adapter_test_end},
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+ .expected_property.type = BT_PROPERTY_BDADDR,
+ .expected_property.val = NULL,
+ .expected_property.len = sizeof(bt_bdaddr_t)
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -871,6 +879,19 @@ static void test_setprop_disctimeout_succes(const void *test_data)
check_expected_status(adapter_status);
}
+static void test_getprop_bdaddr_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ const bt_property_t prop = test->expected_property;
+ bt_status_t adapter_status;
+
+ init_test_conditions(data);
+
+ adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
+ check_expected_status(adapter_status);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -916,6 +937,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_setprop_disctimeout_succes, teardown);
+ test_bredrle("Test Get BDADDR - Success",
+ &bluetooth_getprop_bdaddr_success_test,
+ setup_enabled_adapter,
+ test_getprop_bdaddr_success, teardown);
+
test_bredrle("Test Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/5] android/tester: Add bdname get prop success test case
2013-12-12 17:14 [PATCH 1/5] android/tester: Add property check and bdname set success test case Grzegorz Kolodziejczyk
` (2 preceding siblings ...)
2013-12-12 17:14 ` [PATCH 4/5] android/tester: Add bdaddr get " Grzegorz Kolodziejczyk
@ 2013-12-12 17:14 ` Grzegorz Kolodziejczyk
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2013-12-12 17:14 UTC (permalink / raw)
To: linux-bluetooth
This adds bdname set property success test case. First bdname is set and
then is read.
---
android/android-tester.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index 407bfbe..280870a 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -623,6 +623,15 @@ static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
.expected_property.len = sizeof(bt_bdaddr_t)
};
+static const struct generic_data bluetooth_getprop_bdname_success_test = {
+ .expected_hal_callbacks = {adapter_prop_bdname, adapter_prop_bdname,
+ adapter_test_end},
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+ .expected_property.type = BT_PROPERTY_BDNAME,
+ .expected_property.val = "test_bdname_setget",
+ .expected_property.len = 17
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -892,6 +901,22 @@ static void test_getprop_bdaddr_success(const void *test_data)
check_expected_status(adapter_status);
}
+static void test_getprop_bdname_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ const bt_property_t *prop = &test->expected_property;
+ bt_status_t adapter_status;
+
+ init_test_conditions(data);
+
+ adapter_status = data->if_bluetooth->set_adapter_property(prop);
+ check_expected_status(adapter_status);
+
+ adapter_status = data->if_bluetooth->get_adapter_property((*prop).type);
+ check_expected_status(adapter_status);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
@@ -942,6 +967,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_getprop_bdaddr_success, teardown);
+ test_bredrle("Test Get BDNAME - Success",
+ &bluetooth_getprop_bdname_success_test,
+ setup_enabled_adapter,
+ test_getprop_bdname_success, teardown);
+
test_bredrle("Test Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-12 17:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-12 17:14 [PATCH 1/5] android/tester: Add property check and bdname set success test case Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 2/5] android/tester: Add scan mode set prop " Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 3/5] android/tester: Add discovery timeout " Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 4/5] android/tester: Add bdaddr get " Grzegorz Kolodziejczyk
2013-12-12 17:14 ` [PATCH 5/5] android/tester: Add bdname " Grzegorz Kolodziejczyk
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.