summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-25 16:57:21 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-12 11:19:28 +0100
commit2373d5db5b4cd5dfe139aa2a10017ef61b28b5ce (patch)
treeb300fcd92062ba7291d9967afbee42a04a6f574d
parenta7eb0695b803713f8f8e69d33be0db1effb18da1 (diff)
ecore: here comes a env object
the env object can be used to alter and edit the content of environment variables. Additionally, the class efl.core.env can be used to to setup a not applied set of environment variables, which then can be applied later (in the future) to set it directly to a spawned process for example, or as a general key/data storage. A efl.core.env object can also be forked off, which makes it easy to customize predefined objects. ref T7514 Differential Revision: https://phab.enlightenment.org/D7510
-rw-r--r--header_checks/meson.build3
-rw-r--r--meson.build1
-rw-r--r--src/Makefile_Ecore.am7
-rw-r--r--src/lib/ecore/Ecore_Eo.h3
-rw-r--r--src/lib/ecore/efl_core_env.c107
-rw-r--r--src/lib/ecore/efl_core_env.eo57
-rw-r--r--src/lib/ecore/efl_core_proc_env.c145
-rw-r--r--src/lib/ecore/efl_core_proc_env.eo21
-rw-r--r--src/lib/ecore/meson.build6
-rw-r--r--src/tests/ecore/efl_app_suite.c2
-rw-r--r--src/tests/ecore/efl_app_suite.h1
-rw-r--r--src/tests/ecore/efl_app_test_env.c135
-rw-r--r--src/tests/ecore/meson.build3
13 files changed, 486 insertions, 5 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build
index b23e774ec1..066d228a83 100644
--- a/header_checks/meson.build
+++ b/header_checks/meson.build
@@ -53,7 +53,8 @@ header_checks = [
53 'langinfo.h', 53 'langinfo.h',
54 'locale.h', 54 'locale.h',
55 'uv.h', 55 'uv.h',
56 'ws2tcpip.h' 56 'ws2tcpip.h',
57 'crt_externs.h'
57] 58]
58 59
59function_checks = [ 60function_checks = [
diff --git a/meson.build b/meson.build
index 0e2a50c2c9..d6b9b6074d 100644
--- a/meson.build
+++ b/meson.build
@@ -210,6 +210,7 @@ elif sys_osx == true
210 sys_lib_extension = 'dylib' 210 sys_lib_extension = 'dylib'
211 sys_exe_extension = '' 211 sys_exe_extension = ''
212 sys_mod_extension = 'dylib' 212 sys_mod_extension = 'dylib'
213 config_h.set('environ', '(*_NSGetEnviron())')
213else 214else
214 error('System '+host_machine.system()+' not known') 215 error('System '+host_machine.system()+' not known')
215endif 216endif
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 7bc8e43b74..5f10ea7f2e 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -49,7 +49,9 @@ ecore_eolian_files_public = \
49 lib/ecore/efl_boolean_model.eo \ 49 lib/ecore/efl_boolean_model.eo \
50 lib/ecore/efl_select_model.eo \ 50 lib/ecore/efl_select_model.eo \
51 lib/ecore/efl_composite_model.eo \ 51 lib/ecore/efl_composite_model.eo \
52 lib/ecore/efl_view_model.eo 52 lib/ecore/efl_view_model.eo \
53 lib/ecore/efl_core_env.eo \
54 lib/ecore/efl_core_proc_env.eo \
53 55
54ecore_eolian_files = \ 56ecore_eolian_files = \
55 $(ecore_eolian_files_legacy) \ 57 $(ecore_eolian_files_legacy) \
@@ -98,6 +100,8 @@ lib/ecore/ecore_job.c \
98lib/ecore/ecore_main.c \ 100lib/ecore/ecore_main.c \
99lib/ecore/ecore_event_message.c \ 101lib/ecore/ecore_event_message.c \
100lib/ecore/ecore_event_message_handler.c \ 102lib/ecore/ecore_event_message_handler.c \
103lib/ecore/efl_core_env.c \
104lib/ecore/efl_core_proc_env.c \
101lib/ecore/efl_app.c \ 105lib/ecore/efl_app.c \
102lib/ecore/efl_loop.c \ 106lib/ecore/efl_loop.c \
103lib/ecore/efl_loop_consumer.c \ 107lib/ecore/efl_loop_consumer.c \
@@ -335,6 +339,7 @@ tests/ecore/efl_app_test_loop.c \
335tests/ecore/efl_app_test_loop_fd.c \ 339tests/ecore/efl_app_test_loop_fd.c \
336tests/ecore/efl_app_test_loop_timer.c \ 340tests/ecore/efl_app_test_loop_timer.c \
337tests/ecore/efl_app_test_promise.c \ 341tests/ecore/efl_app_test_promise.c \
342tests/ecore/efl_app_test_env.c \
338tests/ecore/efl_app_suite.c \ 343tests/ecore/efl_app_suite.c \
339tests/ecore/efl_app_suite.h 344tests/ecore/efl_app_suite.h
340 345
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index 6a21ff5ea7..348b0f5b6d 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -26,6 +26,9 @@
26 * @{ 26 * @{
27 */ 27 */
28 28
29#include "efl_core_env.eo.h"
30#include "efl_core_proc_env.eo.h"
31
29#include "efl_loop_message.eo.h" 32#include "efl_loop_message.eo.h"
30#include "efl_loop_message_handler.eo.h" 33#include "efl_loop_message_handler.eo.h"
31 34
diff --git a/src/lib/ecore/efl_core_env.c b/src/lib/ecore/efl_core_env.c
new file mode 100644
index 0000000000..38fc9ba1a9
--- /dev/null
+++ b/src/lib/ecore/efl_core_env.c
@@ -0,0 +1,107 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include <ctype.h>
7
8#include "ecore_private.h"
9
10#define MY_CLASS EFL_CORE_ENV_CLASS
11
12extern char **environ;
13
14typedef struct {
15 Eina_Hash *env;
16} Efl_Core_Env_Data;
17
18static inline Eina_Bool
19str_valid(const char *var)
20{
21 return var && var[0] != '\0';
22}
23
24static inline Eina_Bool
25key_valid(const char *key)
26{
27 if (!key || key[0] == '\0') return EINA_FALSE;
28
29 if isdigit(key[0]) return EINA_FALSE;
30
31 for (int i = 0; key[i] != '\0'; ++i) {
32 if (!isalnum(key[i]) && key[i] != '_') return EINA_FALSE;
33 }
34
35 return EINA_TRUE;
36}
37
38EOLIAN static void
39_efl_core_env_env_set(Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd, const char *var, const char *value)
40{
41 EINA_SAFETY_ON_FALSE_RETURN(key_valid(var));
42 if (str_valid(value))
43 {
44 Eina_Stringshare *share;
45 share = eina_hash_set(pd->env, var, eina_stringshare_add(value));
46 if (share) eina_stringshare_del(share);
47 }
48 else
49 eina_hash_del(pd->env, var, NULL);
50}
51
52EOLIAN static const char*
53_efl_core_env_env_get(const Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd, const char *var)
54{
55 EINA_SAFETY_ON_FALSE_RETURN_VAL(key_valid(var), NULL);
56
57 return eina_hash_find(pd->env, var);
58}
59
60EOLIAN static void
61_efl_core_env_unset(Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd, const char *var)
62{
63 EINA_SAFETY_ON_FALSE_RETURN(key_valid(var));
64 eina_hash_del_by_key(pd->env, var);
65}
66
67EOLIAN static void
68_efl_core_env_clear(Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd)
69{
70 eina_hash_free_buckets(pd->env);
71}
72
73EOLIAN static Efl_Core_Env*
74_efl_core_env_efl_duplicate_duplicate(const Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd)
75{
76 Efl_Core_Env *fork = efl_add_ref(MY_CLASS, NULL);
77 Eina_Iterator *iter;
78 Eina_Hash_Tuple *tuple;
79
80 iter = eina_hash_iterator_tuple_new(pd->env);
81
82 EINA_ITERATOR_FOREACH(iter, tuple)
83 {
84 efl_core_env_set(fork, tuple->key, tuple->data);
85 }
86
87 eina_iterator_free(iter);
88 return fork;
89}
90
91EOLIAN static Efl_Object*
92_efl_core_env_efl_object_constructor(Eo *obj, Efl_Core_Env_Data *pd)
93{
94 pd->env = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del);
95
96 return efl_constructor(efl_super(obj, MY_CLASS));
97}
98
99EOLIAN static Eina_Iterator*
100_efl_core_env_content_get(const Eo *obj EINA_UNUSED, Efl_Core_Env_Data *pd)
101{
102 Eina_Iterator *iter = eina_hash_iterator_key_new(pd->env);
103 return iter;
104}
105
106
107#include "efl_core_env.eo.c"
diff --git a/src/lib/ecore/efl_core_env.eo b/src/lib/ecore/efl_core_env.eo
new file mode 100644
index 0000000000..86da8c14ff
--- /dev/null
+++ b/src/lib/ecore/efl_core_env.eo
@@ -0,0 +1,57 @@
1class Efl.Core.Env extends Efl.Object implements Efl.Duplicate {
2 [[This object can maintain a set of key value pairs
3
4 A object of this type alone does not apply the object to the system.
5 For getting the value into the system, see @Efl.Core.Proc_Env.
6
7 A object can be forked, which will only copy its values, changes to the returned object will not change the object where it is forked off.
8 ]]
9 methods {
10 @property env {
11 [[ Stored var value pairs of this object.
12
13 Var must contain only: underscores ('_'), letters ('a-z', 'A-Z'),
14 numbers ('0-9'), but the first character may not be a number.
15 ]]
16 set {
17 [[ Add a new pair to this object ]]
18 }
19 get {
20 [[ Get the value of the $var, or $null if no such $var exists in the object]]
21 }
22 keys {
23 var: string; [[ The name of the variable ]]
24 }
25 values {
26 value: string; [[ Set var to this value if not $NULL,
27 otherwise clear this env value if value
28 is $NULL or if it is an empty string ]]
29 }
30 }
31 unset {
32 [[ Remove the pair with the matching $var from this object]]
33 params {
34 var : string; [[ The name of the variable ]]
35 }
36 }
37 clear {
38 [[ Remove all pairs from this object]]
39 }
40 @property content {
41 [[ Get the content of this object.
42
43 This will return a iterator that contains all keys that are part of this object.
44 ]]
45 get {
46
47 }
48 values {
49 iter : iterator<string>;
50 }
51 }
52 }
53 implements {
54 Efl.Object.constructor;
55 Efl.Duplicate.duplicate;
56 }
57}
diff --git a/src/lib/ecore/efl_core_proc_env.c b/src/lib/ecore/efl_core_proc_env.c
new file mode 100644
index 0000000000..846b69a350
--- /dev/null
+++ b/src/lib/ecore/efl_core_proc_env.c
@@ -0,0 +1,145 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#ifdef HAVE_CRT_EXTERNS_H
7# include <crt_externs.h>
8#endif
9#include "ecore_private.h"
10
11#define MY_CLASS EFL_CORE_PROC_ENV_CLASS
12
13static Efl_Core_Env *env = NULL;
14
15typedef struct {
16 Eina_Bool in_sync;
17} Efl_Core_Proc_Env_Data;
18
19static void
20_sync(Efl_Core_Env *obj, Efl_Core_Proc_Env_Data *pd)
21{
22 Eina_List *existing_keys = NULL, *n;
23 Eina_Iterator *content;
24 const char *key;
25
26 pd->in_sync = EINA_TRUE;
27 content = efl_core_env_content_get(obj);
28
29 EINA_ITERATOR_FOREACH(content, key)
30 {
31 existing_keys = eina_list_append(existing_keys, key);
32 }
33
34 if (environ)
35 {
36 char **p;
37
38 for (p = environ; *p; p++)
39 {
40 char **values;
41
42 values = eina_str_split(*p, "=", 2);
43 efl_core_env_set(obj, values[0], values[1]);
44
45 EINA_LIST_FOREACH(existing_keys, n, key)
46 {
47 if (!strcmp(key, values[0]))
48 {
49 existing_keys = eina_list_remove_list(existing_keys, n);
50 break;
51 }
52 }
53 }
54 }
55 EINA_LIST_FOREACH(existing_keys, n, key)
56 {
57 efl_core_env_unset(obj, key);
58 }
59 pd->in_sync = EINA_FALSE;
60}
61
62EOLIAN static const char*
63_efl_core_proc_env_efl_core_env_env_get(const Eo *obj, Efl_Core_Proc_Env_Data *pd, const char *var)
64{
65 if (!pd->in_sync)
66 _sync((Eo*)obj, pd);
67 return efl_core_env_get(efl_super(obj, MY_CLASS), var);
68}
69
70EOLIAN static void
71_efl_core_proc_env_efl_core_env_env_set(Eo *obj, Efl_Core_Proc_Env_Data *pd, const char *var, const char *value)
72{
73 efl_core_env_set(efl_super(obj, MY_CLASS), var, value);
74 if (!pd->in_sync)
75 {
76 if (value)
77 setenv(var, value, 1);
78 else
79 unsetenv(var);
80 }
81}
82
83EOLIAN static void
84_efl_core_proc_env_efl_core_env_unset(Eo *obj, Efl_Core_Proc_Env_Data *pd, const char *key)
85{
86 efl_core_env_unset(efl_super(obj, MY_CLASS), key);
87 if (!pd->in_sync)
88 {
89 unsetenv(key);
90 }
91}
92
93EOLIAN static void
94_efl_core_proc_env_efl_core_env_clear(Eo *obj, Efl_Core_Proc_Env_Data *pd)
95{
96 efl_core_env_clear(efl_super(obj, MY_CLASS));
97 if (!pd->in_sync)
98 {
99#ifdef HAVE_CLEARENV
100 clearenv();
101#else
102 environ = NULL;
103#endif
104 }
105}
106
107
108EOLIAN static Efl_Duplicate*
109_efl_core_proc_env_efl_duplicate_duplicate(const Eo *obj, Efl_Core_Proc_Env_Data *pd)
110{
111 if (!pd->in_sync)
112 _sync((Eo*) obj, pd);
113 return efl_duplicate(efl_super(obj, MY_CLASS));
114}
115
116EOLIAN static Eina_Iterator*
117_efl_core_proc_env_efl_core_env_content_get(const Eo *obj, Efl_Core_Proc_Env_Data *pd)
118{
119 if (!pd->in_sync)
120 _sync((Eo*) obj, pd);
121 return efl_core_env_content_get(efl_super(obj, MY_CLASS));
122}
123
124EOLIAN static Efl_Object*
125_efl_core_proc_env_efl_object_constructor(Eo *obj, Efl_Core_Proc_Env_Data *pd EINA_UNUSED)
126{
127 EINA_SAFETY_ON_TRUE_RETURN_VAL(!!env, NULL);
128
129 obj = efl_constructor(efl_super(obj, MY_CLASS));
130 return obj;
131}
132
133EOLIAN static Efl_Core_Env*
134_efl_core_proc_env_self(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
135{
136 if (!env)
137 {
138 env = efl_add_ref(EFL_CORE_PROC_ENV_CLASS, NULL);
139 efl_wref_add(env, &env);
140 }
141
142 return env;
143}
144
145#include "efl_core_proc_env.eo.c"
diff --git a/src/lib/ecore/efl_core_proc_env.eo b/src/lib/ecore/efl_core_proc_env.eo
new file mode 100644
index 0000000000..23c2c67d75
--- /dev/null
+++ b/src/lib/ecore/efl_core_proc_env.eo
@@ -0,0 +1,21 @@
1class Efl.Core.Proc_Env extends Efl.Core.Env
2{
3 eo_prefix : efl_env;
4 methods {
5 self @class {
6 [[Get a instance of this object
7
8 The object will apply the environment operations onto this process.
9 ]]
10 return : Efl.Core.Env;
11 }
12 }
13 implements {
14 Efl.Core.Env.env { set; get; }
15 Efl.Core.Env.content { get; }
16 Efl.Core.Env.unset;
17 Efl.Core.Env.clear;
18 Efl.Duplicate.duplicate;
19 Efl.Object.constructor;
20 }
21}
diff --git a/src/lib/ecore/meson.build b/src/lib/ecore/meson.build
index baa5263698..98909cb618 100644
--- a/src/lib/ecore/meson.build
+++ b/src/lib/ecore/meson.build
@@ -74,7 +74,9 @@ pub_eo_files = [
74 'efl_boolean_model.eo', 74 'efl_boolean_model.eo',
75 'efl_select_model.eo', 75 'efl_select_model.eo',
76 'efl_composite_model.eo', 76 'efl_composite_model.eo',
77 'efl_view_model.eo' 77 'efl_view_model.eo',
78 'efl_core_env.eo',
79 'efl_core_proc_env.eo'
78] 80]
79 81
80foreach eo_file : pub_eo_files 82foreach eo_file : pub_eo_files
@@ -180,6 +182,8 @@ ecore_src = [
180 'efl_thread.c', 182 'efl_thread.c',
181 'efl_threadio.c', 183 'efl_threadio.c',
182 'efl_appthread.c', 184 'efl_appthread.c',
185 'efl_core_env.c',
186 'efl_core_proc_env.c',
183] 187]
184 188
185if sys_windows == true 189if sys_windows == true
diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c
index b3be09915a..cd26e2d95e 100644
--- a/src/tests/ecore/efl_app_suite.c
+++ b/src/tests/ecore/efl_app_suite.c
@@ -9,7 +9,6 @@
9#include "efl_app_suite.h" 9#include "efl_app_suite.h"
10#include "../efl_check.h" 10#include "../efl_check.h"
11 11
12
13EFL_START_TEST(efl_app_test_efl_build_version) 12EFL_START_TEST(efl_app_test_efl_build_version)
14{ 13{
15 const Efl_Version *ver; 14 const Efl_Version *ver;
@@ -53,6 +52,7 @@ static const Efl_Test_Case etc[] = {
53 { "Promise", efl_app_test_promise_2 }, 52 { "Promise", efl_app_test_promise_2 },
54 { "Promise", efl_app_test_promise_3 }, 53 { "Promise", efl_app_test_promise_3 },
55 { "Promise", efl_app_test_promise_safety }, 54 { "Promise", efl_app_test_promise_safety },
55 { "Env", efl_test_efl_env },
56 { NULL, NULL } 56 { NULL, NULL }
57}; 57};
58 58
diff --git a/src/tests/ecore/efl_app_suite.h b/src/tests/ecore/efl_app_suite.h
index 29ed8f031f..3a66dcdfcf 100644
--- a/src/tests/ecore/efl_app_suite.h
+++ b/src/tests/ecore/efl_app_suite.h
@@ -11,5 +11,6 @@ void efl_app_test_promise(TCase *tc);
11void efl_app_test_promise_2(TCase *tc); 11void efl_app_test_promise_2(TCase *tc);
12void efl_app_test_promise_3(TCase *tc); 12void efl_app_test_promise_3(TCase *tc);
13void efl_app_test_promise_safety(TCase *tc); 13void efl_app_test_promise_safety(TCase *tc);
14void efl_test_efl_env(TCase *tc);
14 15
15#endif /* _EFL_APP_SUITE_H */ 16#endif /* _EFL_APP_SUITE_H */
diff --git a/src/tests/ecore/efl_app_test_env.c b/src/tests/ecore/efl_app_test_env.c
new file mode 100644
index 0000000000..63bad166a2
--- /dev/null
+++ b/src/tests/ecore/efl_app_test_env.c
@@ -0,0 +1,135 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#define EFL_NOLEGACY_API_SUPPORT
8#include <Efl_Core.h>
9#include "efl_app_suite.h"
10#include "../efl_check.h"
11
12EFL_START_TEST(efl_core_env_test_set_get)
13{
14 Efl_Core_Env *env = efl_add_ref(EFL_CORE_ENV_CLASS, NULL);
15
16 efl_core_env_set(env, "FOO", "bar");
17 efl_core_env_set(env, "going", "home");
18 efl_core_env_set(env, "Merry", "christmas");
19
20 ck_assert_str_eq(efl_core_env_get(env, "FOO"), "bar");
21 ck_assert_str_eq(efl_core_env_get(env, "going"), "home");
22 ck_assert_str_eq(efl_core_env_get(env, "Merry"), "christmas");
23
24 efl_core_env_unset(env, "Merry");
25
26 ck_assert_str_eq(efl_core_env_get(env, "FOO"), "bar");
27 ck_assert_str_eq(efl_core_env_get(env, "going"), "home");
28 ck_assert_ptr_eq(efl_core_env_get(env, "Merry"), NULL);
29
30 efl_unref(env);
31}
32EFL_END_TEST
33
34EFL_START_TEST(efl_core_env_test_invalid_keys)
35{
36 Efl_Core_Env *env = efl_add_ref(EFL_CORE_ENV_CLASS, NULL);
37
38#define CHECK(val) \
39 efl_core_env_set(env, val, "TEST"); \
40 ck_assert_ptr_eq(efl_core_env_get(env, val), NULL);
41
42 CHECK("0foo");
43 CHECK("foo bar");
44 CHECK("foo!bar");
45
46#undef CHECK
47
48
49#define CHECK(val) \
50 efl_core_env_set(env, val, "TEST"); \
51 ck_assert_str_eq(efl_core_env_get(env, val), "TEST");
52
53 CHECK("foo0");
54 CHECK("foo_bar");
55
56#undef CHECK
57
58}
59EFL_END_TEST
60
61EFL_START_TEST(efl_core_env_test_clear)
62{
63 Efl_Core_Env *env = efl_add_ref(EFL_CORE_ENV_CLASS, NULL);
64
65 efl_core_env_set(env, "FOO", "bar");
66 efl_core_env_set(env, "going", "home");
67 efl_core_env_set(env, "Merry", "christmas");
68
69 efl_core_env_clear(env);
70
71 ck_assert_ptr_eq(efl_core_env_get(env, "FOO"), NULL);
72 ck_assert_ptr_eq(efl_core_env_get(env, "going"), NULL);
73 ck_assert_ptr_eq(efl_core_env_get(env, "Merry"), NULL);
74
75 efl_unref(env);
76}
77EFL_END_TEST
78
79EFL_START_TEST(efl_core_env_test_fork)
80{
81 Efl_Core_Env *env_fork, *env = efl_add_ref(EFL_CORE_ENV_CLASS, NULL);
82
83 efl_core_env_set(env, "FOO", "bar");
84 efl_core_env_set(env, "going", "home");
85 efl_core_env_set(env, "Merry", "christmas");
86
87 env_fork = efl_duplicate(env);
88
89 ck_assert_str_eq(efl_core_env_get(env_fork, "FOO"), "bar");
90 ck_assert_str_eq(efl_core_env_get(env_fork, "going"), "home");
91 ck_assert_str_eq(efl_core_env_get(env_fork, "Merry"), "christmas");
92
93 efl_unref(env);
94}
95EFL_END_TEST
96
97EFL_START_TEST(efl_core_env_test_process)
98{
99 Efl_Core_Env *env_fork, *env = efl_env_self(EFL_CORE_PROC_ENV_CLASS);
100
101 ck_assert(env);
102
103 ck_assert_str_eq(efl_core_env_get(env, "PATH"), getenv("PATH"));
104 env_fork = efl_duplicate(env);
105 ck_assert_str_eq(efl_core_env_get(env_fork, "PATH"), getenv("PATH"));
106
107 efl_unref(env);
108}
109EFL_END_TEST
110
111EFL_START_TEST(efl_core_env_test_undepend_fork)
112{
113 Efl_Core_Env *env_fork, *env = efl_env_self(EFL_CORE_PROC_ENV_CLASS);
114
115 ck_assert(env);
116
117 ck_assert_str_eq(efl_core_env_get(env, "PATH"), getenv("PATH"));
118 env_fork = efl_duplicate(env);
119 efl_core_env_set(env_fork, "PATH", "abc");
120 ck_assert_str_eq(efl_core_env_get(env, "PATH"), getenv("PATH"));
121
122 efl_unref(env);
123 efl_unref(env_fork);
124}
125EFL_END_TEST
126
127void efl_test_efl_env(TCase *tc)
128{
129 tcase_add_test(tc, efl_core_env_test_set_get);
130 tcase_add_test(tc, efl_core_env_test_invalid_keys);
131 tcase_add_test(tc, efl_core_env_test_clear);
132 tcase_add_test(tc, efl_core_env_test_fork);
133 tcase_add_test(tc, efl_core_env_test_process);
134 tcase_add_test(tc, efl_core_env_test_undepend_fork);
135}
diff --git a/src/tests/ecore/meson.build b/src/tests/ecore/meson.build
index 4b46814bbe..e3b4f6c851 100644
--- a/src/tests/ecore/meson.build
+++ b/src/tests/ecore/meson.build
@@ -75,7 +75,8 @@ efl_app_suite_src = [
75 'efl_app_test_loop.c', 75 'efl_app_test_loop.c',
76 'efl_app_test_loop_fd.c', 76 'efl_app_test_loop_fd.c',
77 'efl_app_test_loop_timer.c', 77 'efl_app_test_loop_timer.c',
78 'efl_app_test_promise.c' 78 'efl_app_test_promise.c',
79 'efl_app_test_env.c'
79] 80]
80 81
81efl_app_suite_deps = [m] 82efl_app_suite_deps = [m]