Next action step might pass before the action was even called. This was
possible when not expected callback came. This patch forces check for
callback also on the incomming step and not only on the expected one.
---
android/tester-main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/tester-main.c b/android/tester-main.c
index 3206a54..42790b6 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -413,7 +413,7 @@ static bool match_data(struct step *step)
return false;
}
- if (exp->callback) {
+ if (exp->callback || step->callback) {
if (exp->callback != step->callback) {
tester_debug("Callback type don't match");
return false;
--
1.9.1
Hi Jakub,
On Fri, Jul 25, 2014, Jakub Tyszkowski wrote:
> This fixes 3 valgrind reports like:
>
> 8 bytes in 2 blocks are definitely lost in loss record 7 of 47
> ==8437== at 0x4C2AB80: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==8437== by 0x5089610: g_malloc (in
> /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
> ==8437== by 0x50A0B57: g_memdup (in
> /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
> ==8437== by 0x40E94E: create_property (tester-main.c:623)
> ==8437== by 0x40F96C: ssp_request_cb (tester-main.c:741)
> ==8437== by 0x5F70E5A: notification_handler (hal-ipc.c:125)
> ==8437== by 0x534B181: start_thread (pthread_create.c:312)
> ==8437== by 0x565C30C: clone (clone.S:111)
> ---
> android/tester-main.c | 3 +++
> 1 file changed, 3 insertions(+)
All patches in this set have been applied. Thanks.
Johan
This fixes 3 valgrind reports like:
8 bytes in 2 blocks are definitely lost in loss record 7 of 47
==8437== at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8437== by 0x5089610: g_malloc (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==8437== by 0x50A0B57: g_memdup (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==8437== by 0x40E94E: create_property (tester-main.c:623)
==8437== by 0x40F96C: ssp_request_cb (tester-main.c:741)
==8437== by 0x5F70E5A: notification_handler (hal-ipc.c:125)
==8437== by 0x534B181: start_thread (pthread_create.c:312)
==8437== by 0x565C30C: clone (clone.S:111)
---
android/tester-main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/tester-main.c b/android/tester-main.c
index 42790b6..abef822 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -744,8 +744,11 @@ static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr,
step->callback_result.num_properties = 3;
step->callback_result.properties = repack_properties(3, props);
+ g_free(props[0]->val);
g_free(props[0]);
+ g_free(props[1]->val);
g_free(props[1]);
+ g_free(props[2]->val);
g_free(props[2]);
schedule_callback_call(step);
--
1.9.1
---
android/tester-socket.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/android/tester-socket.c b/android/tester-socket.c
index f462bb0..c44fa28 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -21,8 +21,6 @@
#include "emulator/bthost.h"
#include "tester-main.h"
-#include "src/shared/util.h"
-
static struct queue *list; /* List of socket test cases */
static bt_bdaddr_t bdaddr_dummy = {
--
1.9.1
This fixes the following vagrind report:
==12708== 4 errors in context 1 of 1:
==12708== Conditional jump or move depends on uninitialised value(s)
==12708== at 0x40E359: verify_step (tester-main.c:416)
==12708== by 0x40E5FD: verify_action (tester-main.c:540)
==12708== by 0x5083CE4: g_main_context_dispatch (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==12708== by 0x5084047: ??? (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==12708== by 0x5084309: g_main_loop_run (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0)
==12708== by 0x40D51C: tester_run (tester.c:812)
==12708== by 0x40251E: main (tester-main.c:1496)
---
android/tester-socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/tester-socket.c b/android/tester-socket.c
index bd067ea..f462bb0 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -255,7 +255,7 @@ static void socket_verify_channel_action(void)
struct step *current_data_step = queue_peek_head(data->steps);
struct bt_action_data *action_data = current_data_step->set_data;
int channel, len;
- struct step *step = g_new(struct step, 1);
+ struct step *step = g_new0(struct step, 1);
if (!*action_data->fd) {
tester_warn("Ups no action_data->fd");
--
1.9.1
It's better to know what actually may change by looking at the structure
definitions. Some api calls can modify their parameters (returning file
descriptor in socket HAL API) but most of them don't.
This patch mostly applies to action_data and test_case structs that defines
the actual test case.
---
android/tester-main.h | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/android/tester-main.h b/android/tester-main.h
index 1bff9b3..e2ecaab 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -216,28 +216,28 @@ struct bt_action_data {
bt_bdaddr_t *addr;
/* Remote props action arguments */
- int prop_type;
- bt_property_t *prop;
+ const int prop_type;
+ const bt_property_t *prop;
/* Bonding requests parameters */
bt_pin_code_t *pin;
- uint8_t pin_len;
- uint8_t ssp_variant;
- bool accept;
+ const uint8_t pin_len;
+ const uint8_t ssp_variant;
+ const bool accept;
/* Socket HAL specific params */
- btsock_type_t sock_type;
- int channel;
+ const btsock_type_t sock_type;
+ const int channel;
const uint8_t *service_uuid;
const char *service_name;
- int flags;
+ const int flags;
int *fd;
};
/* bthost's l2cap server setup parameters */
struct emu_set_l2cap_data {
- uint16_t psm;
- bthost_l2cap_connect_cb func;
+ const uint16_t psm;
+ const bthost_l2cap_connect_cb func;
void *user_data;
};
@@ -271,9 +271,9 @@ struct step {
};
struct test_case {
- uint8_t emu_type;
- char *title;
- uint16_t step_num;
+ const uint8_t emu_type;
+ const char *title;
+ const uint16_t step_num;
const struct step const *step;
};
--
1.9.1