zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d0e10dd2734ce9d1cac6569e4c2c3975dbffcbe8
commit d0e10dd2734ce9d1cac6569e4c2c3975dbffcbe8 Author: Lauro Moura <[email protected]> Date: Tue Jul 30 15:22:03 2019 -0400 ecore: Fix download test. Summary: After ecore_main_loop_quit() changes, calling it from outside the main loop does not make the next iteration of the main loop quit, causing the original version of the test to deadlock. Also update the function documentation about it. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, felipealmeida, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9448 --- src/lib/ecore/Ecore_Common.h | 6 ++++-- src/tests/ecore/ecore_test_ecore_file.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h index 1530036e63..8f1a99bc04 100644 --- a/src/lib/ecore/Ecore_Common.h +++ b/src/lib/ecore/Ecore_Common.h @@ -317,8 +317,10 @@ EAPI void ecore_main_loop_begin(void); * Quits the main loop once all the events currently on the queue have * been processed. * - * This function returns immediately, but will mark the ecore_main_loop_begin() - * function to return at the end of the current main loop iteration. + * This function returns immediately, but if called inside the main loop + * it will mark the ecore_main_loop_begin() function to return at the + * end of the current main loop iteration. + * */ EAPI void ecore_main_loop_quit(void); diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c index fe0e73f3a8..3b6fcffff7 100644 --- a/src/tests/ecore/ecore_test_ecore_file.c +++ b/src/tests/ecore/ecore_test_ecore_file.c @@ -104,9 +104,13 @@ completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status) } void -err_completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status) +err_completion_cb(void *data, const char *file EINA_UNUSED, int status) { + if (data) + *((int*) data) = status; fail_if(status != 1); + // NOP if called from outside main loop. Keep it here if abort fails and + // we get called from there. ecore_main_loop_quit(); } @@ -521,12 +525,15 @@ EFL_START_TEST(ecore_test_ecore_file_download) progress_cb, NULL, &job); fail_if(res != EINA_FALSE); + int status = 0; res = ecore_file_download(download_url, dest_name, err_completion_cb, - progress_cb, NULL, &job); + progress_cb, &status, &job); fail_if(res != EINA_TRUE); fail_if(!job); ecore_file_download_abort(job); - ecore_main_loop_begin(); + fail_if(status != 1); + if (!status) + ecore_main_loop_begin(); if (timeout_reached) goto end; res = ecore_file_remove(dest_name); fail_if(res != EINA_TRUE); --
