2014-09-02 09:34:43

by Marcin Kraglak

[permalink] [raw]
Subject: [PATCH] shared/tester: Change handling of tester_setup_failed event

If tester_setup_failed() was called, execute post_teardown() to clean
data created in pre_setup phase. In some cases android-tester
couldn't start daemon, and setup failed, but hciemu created in
pre_setup was not removed.
---
src/shared/tester.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 95b4682..fb645a0 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -447,9 +447,9 @@ void tester_pre_setup_failed(void)
if (test->stage != TEST_STAGE_PRE_SETUP)
return;

- test->stage = TEST_STAGE_SETUP;
+ print_progress(test->name, COLOR_RED, "pre setup failed");

- tester_setup_failed();
+ g_idle_add(done_callback, test);
}

void tester_setup_complete(void)
@@ -481,14 +481,17 @@ void tester_setup_failed(void)
if (test->stage != TEST_STAGE_SETUP)
return;

+ test->stage = TEST_STAGE_POST_TEARDOWN;
+
if (test->timeout_id > 0) {
g_source_remove(test->timeout_id);
test->timeout_id = 0;
}

print_progress(test->name, COLOR_RED, "setup failed");
+ print_progress(test->name, COLOR_MAGENTA, "teardown");

- g_idle_add(done_callback, test);
+ test->post_teardown_func(test->test_data);
}

void tester_test_passed(void)
--
1.9.0



2014-09-05 20:31:46

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] shared/tester: Change handling of tester_setup_failed event

Hi Marcin,

On Tue, Sep 02, 2014, Marcin Kraglak wrote:
> If tester_setup_failed() was called, execute post_teardown() to clean
> data created in pre_setup phase. In some cases android-tester
> couldn't start daemon, and setup failed, but hciemu created in
> pre_setup was not removed.
> ---
> src/shared/tester.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan