summaryrefslogtreecommitdiff
path: root/src/tests/eio/eio_test_xattr.c
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2016-04-12 16:00:23 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-25 21:32:03 -0300
commit7241b7375de1eb4327f5bca21dcfc5a889b9eb72 (patch)
treececbe8991d1b38db8f8c67965ae2a5e6cf2aa503 /src/tests/eio/eio_test_xattr.c
parentde9be13d458f2739a536e5863aa8caddd3f7f715 (diff)
eio: Adds Eo-based Eio API
The legacy Eio_File factory functions are replaced by an Eo object called Eo_Job that return promises wrapping the async file operations. With this commit, the legacy Eio callbacks are replaced by the following Eo/Promises counterparts : * Done_Cb -> Promise then success callback * Error_Cb -> Promise then error callback * Main_Cb -> Promise progress callback * Filter_Cb -> Job object event (more below) Events are used to deliver and get the filter data. To differentiate between the named and direct versions, they come in "filter,direct" and "filter,name" versions. Monitors were wrapped inside a new class Eo_Sentry. The user creates a sentry object and adds monitoring targets to it, listening to events on it. The sentry event info is composed of two strings. The source string is the path being monitored, i.e. the one passed to eio_sentry_add, and the trigger string is the path that actually triggered the event, e.g. a new file created in a monitored directory.
Diffstat (limited to '')
-rw-r--r--src/tests/eio/eio_test_xattr.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/tests/eio/eio_test_xattr.c b/src/tests/eio/eio_test_xattr.c
index 1a50c125e5..b4a843ea10 100644
--- a/src/tests/eio/eio_test_xattr.c
+++ b/src/tests/eio/eio_test_xattr.c
@@ -12,6 +12,7 @@
12#include <Eio.h> 12#include <Eio.h>
13 13
14#include "eio_suite.h" 14#include "eio_suite.h"
15#include "eio_test_common.h"
15 16
16 17
17#ifdef XATTR_TEST_DIR 18#ifdef XATTR_TEST_DIR
@@ -23,27 +24,19 @@ static int int_data = 1234;
23static char *double_attr = "user.size"; 24static char *double_attr = "user.size";
24static double double_data = 123.456; 25static double double_data = 123.456;
25 26
26const char *attribute[] = 27static const char *attribute[] =
27 { 28 {
28 "user.comment1", 29 "user.comment1",
29 "user.comment2", 30 "user.comment2",
30 "user.comment3" 31 "user.comment3"
31 }; 32 };
32const char *attr_data[] = 33static const char *attr_data[] =
33 { 34 {
34 "This is a test file", 35 "This is a test file",
35 "This line is a comment", 36 "This line is a comment",
36 "This file has extra attributes" 37 "This file has extra attributes"
37 }; 38 };
38 39
39Eina_Tmpstr*
40get_file_path(const char* tmpdirname, const char* filename)
41{
42 char file_path[PATH_MAX] = "";
43 eina_str_join(file_path, sizeof(file_path), '/', tmpdirname, filename);
44 return eina_tmpstr_add(file_path);
45}
46
47static Eina_Bool 40static Eina_Bool
48_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const char *attr EINA_UNUSED) 41_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const char *attr EINA_UNUSED)
49{ 42{
@@ -149,7 +142,7 @@ START_TEST(eio_test_xattr_set)
149 eina_init(); 142 eina_init();
150 eio_init(); 143 eio_init();
151 144
152 test_file_path = get_file_path(XATTR_TEST_DIR, filename); 145 test_file_path = get_full_path(XATTR_TEST_DIR, filename);
153 fd = open(test_file_path, 146 fd = open(test_file_path,
154 O_WRONLY | O_CREAT | O_TRUNC, 147 O_WRONLY | O_CREAT | O_TRUNC,
155 S_IRWXU | S_IRWXG | S_IRWXO); 148 S_IRWXU | S_IRWXG | S_IRWXO);
@@ -207,7 +200,7 @@ START_TEST(eio_test_xattr_types_set)
207 eina_init(); 200 eina_init();
208 eio_init(); 201 eio_init();
209 202
210 test_file_path = get_file_path(XATTR_TEST_DIR, filename); 203 test_file_path = get_full_path(XATTR_TEST_DIR, filename);
211 fd = open(test_file_path, 204 fd = open(test_file_path,
212 O_WRONLY | O_CREAT | O_TRUNC, 205 O_WRONLY | O_CREAT | O_TRUNC,
213 S_IRWXU | S_IRWXG | S_IRWXO); 206 S_IRWXU | S_IRWXG | S_IRWXO);