summaryrefslogtreecommitdiff
path: root/src/tests/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-06-20 09:38:11 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-06-20 09:40:34 -0400
commit42b293ae1f89aa3737fe7a4d81ebc3596fd2c631 (patch)
tree54a6e9351aff4fd74602856db9728658b130550c /src/tests/ecore
parentd46d1ed0181d787c84486e920b46b30b1af07bcd (diff)
ecore: do not rely on implicit rules for memory lifecycle during test.
Summary: alloca force the memory to be accessible for the entire duration of the scope of the function it is called from. This will garantee that the memory pointer are not recycled under our feet before we check them. T8020 Reviewers: zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8020 Differential Revision: https://phab.enlightenment.org/D9127
Diffstat (limited to 'src/tests/ecore')
-rw-r--r--src/tests/ecore/efl_app_test_promise.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/ecore/efl_app_test_promise.c b/src/tests/ecore/efl_app_test_promise.c
index 1a9019368d..8a7b3edd16 100644
--- a/src/tests/ecore/efl_app_test_promise.c
+++ b/src/tests/ecore/efl_app_test_promise.c
@@ -60,11 +60,14 @@ typedef struct _Race_Future_Ctx {
60 60
61#define LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, ...) \ 61#define LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, ...) \
62 do { \ 62 do { \
63 struct Func_Ctx tmp[] = { __VA_ARGS__, {NULL, NULL}}; \
64 \
65 _ctx.func_ctx = alloca(EINA_C_ARRAY_LENGTH(tmp) * sizeof (struct Func_Ctx)); \
66 memcpy(_ctx.func_ctx, tmp, sizeof (tmp)); \
63 _ctx.level = EINA_LOG_LEVEL_ERR; \ 67 _ctx.level = EINA_LOG_LEVEL_ERR; \
64 _ctx.did = EINA_FALSE; \ 68 _ctx.did = EINA_FALSE; \
65 _ctx.just_fmt = EINA_FALSE; \ 69 _ctx.just_fmt = EINA_FALSE; \
66 _ctx.func_ctx_idx = 0; \ 70 _ctx.func_ctx_idx = 0; \
67 _ctx.func_ctx = (struct Func_Ctx []){ __VA_ARGS__, {NULL, NULL}}; \
68 } while(0) 71 } while(0)
69 72
70#define LOG_CTX_SET(_ctx, _fnc, _msg) LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, {_fnc, _msg}) 73#define LOG_CTX_SET(_ctx, _fnc, _msg) LOG_CTX_MULTIPLE_FUNC_CTX_SET(_ctx, {_fnc, _msg})