summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-03 16:55:59 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-03 17:06:49 +0200
commitdb57523e7846a6729f0ca0681e7e998b537e5b81 (patch)
tree8c424d54c287ec05a65530f56dfb2f507cba12a7
parent767631e304b7142669d4f44f13cb97010348de11 (diff)
eolian: refactor parsing API and path handling
This splits the eolian_file_parse API into two, one for parsing files already present in the database (always by filename) and one for parsing paths. It fixes several bugs/leaks on the way (incorrect use of stringshare etc.) as well as adds checking for whether there are no conflicting filenames at scan time, for free. That means it is now no longer possible to scan two paths which have an eo or eot file of the same name in them. It should also be faster now. It also fixes T7820. @fix
-rw-r--r--src/bin/eolian/main.c2
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc4
-rw-r--r--src/bin/eolian_mono/eolian_mono.cc2
-rw-r--r--src/bindings/luajit/eolian.lua15
-rw-r--r--src/lib/eolian/Eolian.h23
-rw-r--r--src/lib/eolian/eolian_database.c88
-rw-r--r--src/scripts/pyolian/eolian.py8
-rw-r--r--src/scripts/pyolian/eolian_lib.py6
-rw-r--r--src/tests/eolian/eolian_aux.c12
-rw-r--r--src/tests/eolian/eolian_parsing.c48
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_binding.cc4
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_documentation.cc2
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_parse.cc2
13 files changed, 149 insertions, 67 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 691881f160..0545430eb5 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -618,7 +618,7 @@ main(int argc, char **argv)
618 } 618 }
619 } 619 }
620 620
621 if (!eolian_state_file_parse(eos, input)) 621 if (!eolian_state_file_path_parse(eos, input))
622 { 622 {
623 fprintf(stderr, "eolian: could not parse file '%s'\n", input); 623 fprintf(stderr, "eolian: could not parse file '%s'\n", input);
624 goto end; 624 goto end;
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index d5e42de830..3774c497a6 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -315,7 +315,7 @@ run(options_type const& opts)
315 315
316 for(auto&& name : opts.in_files) 316 for(auto&& name : opts.in_files)
317 { 317 {
318 Eolian_Unit const* unit = ::eolian_state_file_parse(opts.state, name.c_str()); 318 Eolian_Unit const* unit = ::eolian_state_file_path_parse(opts.state, name.c_str());
319 if(!unit) 319 if(!unit)
320 { 320 {
321 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) 321 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
@@ -398,7 +398,7 @@ database_load(options_type const& opts)
398 << "No input file."; 398 << "No input file.";
399 assert(false && "Error parsing input file"); 399 assert(false && "Error parsing input file");
400 } 400 }
401 if (!opts.main_header && !::eolian_state_file_parse(opts.state, opts.in_files[0].c_str())) 401 if (!opts.main_header && !::eolian_state_file_path_parse(opts.state, opts.in_files[0].c_str()))
402 { 402 {
403 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) 403 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
404 << "Failed parsing: " << opts.in_files[0] << "."; 404 << "Failed parsing: " << opts.in_files[0] << ".";
diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc
index 8f24f762f0..e22acb9ce1 100644
--- a/src/bin/eolian_mono/eolian_mono.cc
+++ b/src/bin/eolian_mono/eolian_mono.cc
@@ -261,7 +261,7 @@ database_load(options_type const& opts)
261 << "No input file."; 261 << "No input file.";
262 assert(false && "Error parsing input file"); 262 assert(false && "Error parsing input file");
263 } 263 }
264 if (!::eolian_state_file_parse(opts.state, opts.in_file.c_str())) 264 if (!::eolian_state_file_path_parse(opts.state, opts.in_file.c_str()))
265 { 265 {
266 EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) 266 EINA_CXX_DOM_LOG_ERR(eolian_mono::domain)
267 << "Failed parsing: " << opts.in_file << "."; 267 << "Failed parsing: " << opts.in_file << ".";
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 0b99715ed9..a89946c1eb 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -310,7 +310,8 @@ ffi.cdef [[
310 Eina_Iterator *eolian_state_eot_file_paths_get(const Eolian_State *state); 310 Eina_Iterator *eolian_state_eot_file_paths_get(const Eolian_State *state);
311 Eina_Iterator *eolian_state_eo_files_get(const Eolian_State *state); 311 Eina_Iterator *eolian_state_eo_files_get(const Eolian_State *state);
312 Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state); 312 Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state);
313 const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filepath); 313 const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filename);
314 const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const char *filepath);
314 Eina_Bool eolian_state_all_eo_files_parse(Eolian_State *state); 315 Eina_Bool eolian_state_all_eo_files_parse(Eolian_State *state);
315 Eina_Bool eolian_state_all_eot_files_parse(Eolian_State *state); 316 Eina_Bool eolian_state_all_eot_files_parse(Eolian_State *state);
316 Eina_Bool eolian_state_check(const Eolian_State *state); 317 Eina_Bool eolian_state_check(const Eolian_State *state);
@@ -755,8 +756,16 @@ ffi.metatype("Eolian_State", {
755 return eolian.eolian_state_system_directory_add(self) ~= 0 756 return eolian.eolian_state_system_directory_add(self) ~= 0
756 end, 757 end,
757 758
758 file_parse = function(self, fpath) 759 file_parse = function(self, fname)
759 local v = eolian.eolian_state_file_parse(self, fpath) 760 local v = eolian.eolian_state_file_parse(self, fname)
761 if v == nil then
762 return nil
763 end
764 return v
765 end,
766
767 file_path_parse = function(self, fpath)
768 local v = eolian.eolian_state_file_path_parse(self, fpath)
760 if v == nil then 769 if v == nil then
761 return nil 770 return nil
762 end 771 end
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index c60272ef56..72018e7f83 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -804,8 +804,25 @@ EAPI Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state);
804/* 804/*
805 * @brief Parse the given .eo or .eot file and fill the database. 805 * @brief Parse the given .eo or .eot file and fill the database.
806 * 806 *
807 * The input can be either a full path to the file or only a filename. 807 * The input must be a file name from a directory that was previously
808 * If it's a filename, it must be scanned for first. 808 * scanned with eolian_state_directory_add().
809 *
810 * @param[in] state The Eolian state.
811 * @param[in] filename The name of the file to parse.
812 * @return The unit corresponding to the parsed file or NULL.
813 *
814 * @see eolian_state_directory_add
815 * @see eolian_state_file_path_parse
816 *
817 * @ingroup Eolian
818 */
819EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filename);
820
821/*
822 * @brief Parse the given .eo or .eot file and fill the database.
823 *
824 * The input is a file path. Its directory is scanned first, and then
825 * the file itself is parsed and a unit handle is returned.
809 * 826 *
810 * @param[in] state The Eolian state. 827 * @param[in] state The Eolian state.
811 * @param[in] filepath Path to the file to parse. 828 * @param[in] filepath Path to the file to parse.
@@ -815,7 +832,7 @@ EAPI Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state);
815 * 832 *
816 * @ingroup Eolian 833 * @ingroup Eolian
817 */ 834 */
818EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filepath); 835EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const char *filepath);
819 836
820/* 837/*
821 * @brief Parse all known eo files. 838 * @brief Parse all known eo files.
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 4ce5b00f63..79da362e0a 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -759,22 +759,42 @@ join_path(const char *path, const char *file)
759 return ret; 759 return ret;
760} 760}
761 761
762typedef struct _Scan_State
763{
764 Eolian_State *eos;
765 Eina_Bool succ;
766} Scan_State;
767
762static void 768static void
763_scan_cb(const char *name, const char *path, void *data EINA_UNUSED) 769_scan_cb(const char *name, const char *path, void *data)
764{ 770{
765 Eolian_State *state = data; 771 Scan_State *sst = data;
766 Eina_Bool is_eo = eina_str_has_suffix(name, EO_SUFFIX); 772 Eina_Bool is_eo = eina_str_has_suffix(name, EO_SUFFIX);
767 if (!is_eo && !eina_str_has_suffix(name, EOT_SUFFIX)) return; 773 if (!is_eo && !eina_str_has_suffix(name, EOT_SUFFIX)) return;
768 eina_hash_add(is_eo ? state->filenames_eo : state->filenames_eot, 774 Eina_Hash *fh = is_eo ? sst->eos->filenames_eo : sst->eos->filenames_eot;
769 eina_stringshare_add(name), join_path(path, name)); 775 const char *origpath = eina_hash_find(fh, name);
776 char *newpath = join_path(path, name);
777 if (origpath)
778 {
779 if (strcmp(origpath, newpath))
780 {
781 eolian_state_log(sst->eos,
782 "conflicting paths for '%s': '%s' -> '%s'",
783 name, origpath, newpath);
784 sst->succ = EINA_FALSE;
785 }
786 free(newpath);
787 }
788 else
789 eina_hash_add(fh, name, newpath);
770} 790}
771 791
772EAPI Eina_Bool 792EAPI Eina_Bool
773eolian_state_directory_add(Eolian_State *state, const char *dir) 793eolian_state_directory_add(Eolian_State *state, const char *dir)
774{ 794{
775 if (!dir || !state) return EINA_FALSE; 795 if (!dir || !state) return EINA_FALSE;
776 eina_file_dir_list(dir, EINA_TRUE, _scan_cb, state); 796 Scan_State sst = { state, EINA_TRUE };
777 return EINA_TRUE; 797 return eina_file_dir_list(dir, EINA_TRUE, _scan_cb, &sst);
778} 798}
779 799
780EAPI Eina_Bool 800EAPI Eina_Bool
@@ -818,25 +838,24 @@ eolian_state_eo_file_paths_get(const Eolian_State *state)
818} 838}
819 839
820static Eolian_Unit * 840static Eolian_Unit *
821_eolian_file_parse_nodep(Eolian_Unit *parent, const char *filepath) 841_eolian_file_parse_nodep(Eolian_Unit *parent, const char *filename)
822{ 842{
823 Eina_Bool is_eo; 843 Eina_Bool is_eo;
824 const char *eopath; 844 is_eo = eina_str_has_suffix(filename, EO_SUFFIX);
825 845 if (!is_eo && !eina_str_has_suffix(filename, EOT_SUFFIX))
826 is_eo = eina_str_has_suffix(filepath, EO_SUFFIX);
827 if (!is_eo && !eina_str_has_suffix(filepath, EOT_SUFFIX))
828 { 846 {
829 eolian_state_log(parent->state, 847 eolian_state_log(parent->state,
830 "file '%s' doesn't have a correct extension", 848 "file '%s' doesn't have a correct extension",
831 filepath); 849 filename);
832 return NULL; 850 return NULL;
833 } 851 }
834 if (!(eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : parent->state->filenames_eot, filepath))) 852 const char *eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : parent->state->filenames_eot, filename);
853 if (!eopath)
835 { 854 {
836 char *vpath = eina_file_path_sanitize(filepath); 855 eolian_state_log(parent->state,
837 Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo); 856 "file '%s' is not registered in the database",
838 free(vpath); 857 filename);
839 return ret; 858 return NULL;
840 } 859 }
841 return eo_parser_database_fill(parent, eopath, !is_eo); 860 return eo_parser_database_fill(parent, eopath, !is_eo);
842} 861}
@@ -1027,13 +1046,13 @@ _merge_staging(Eolian_State *state)
1027} 1046}
1028 1047
1029EAPI const Eolian_Unit * 1048EAPI const Eolian_Unit *
1030eolian_state_file_parse(Eolian_State *state, const char *filepath) 1049eolian_state_file_parse(Eolian_State *state, const char *filename)
1031{ 1050{
1032 if (!state) 1051 if (!state)
1033 return NULL; 1052 return NULL;
1034 1053
1035 _state_clean(state); 1054 _state_clean(state);
1036 Eolian_Unit *ret = _eolian_file_parse_nodep(&state->staging.unit, filepath); 1055 Eolian_Unit *ret = _eolian_file_parse_nodep(&state->staging.unit, filename);
1037 if (!ret) 1056 if (!ret)
1038 return NULL; 1057 return NULL;
1039 if (!_parse_deferred(ret)) 1058 if (!_parse_deferred(ret))
@@ -1045,6 +1064,37 @@ eolian_state_file_parse(Eolian_State *state, const char *filepath)
1045 return ret; 1064 return ret;
1046} 1065}
1047 1066
1067EAPI const Eolian_Unit *
1068eolian_state_file_path_parse(Eolian_State *state, const char *filepath)
1069{
1070 if (!state)
1071 return NULL;
1072
1073 char *mpath = strdup(filepath);
1074 if (!mpath)
1075 return NULL;
1076
1077 char *fname = strrchr(mpath, '/');
1078 if (fname && strrchr(fname, '\\'))
1079 fname = strrchr(fname, '\\');
1080
1081 const char *toscan = mpath;
1082 if (!fname)
1083 {
1084 toscan = ".";
1085 fname = mpath;
1086 }
1087 else
1088 *fname++ = '\0';
1089
1090 if (!eolian_state_directory_add(state, toscan))
1091 {
1092 eolian_state_log(state, "could not scan directory '%s'", toscan);
1093 return NULL;
1094 }
1095 return eolian_state_file_parse(state, fname);
1096}
1097
1048typedef struct _Parse_Data 1098typedef struct _Parse_Data
1049{ 1099{
1050 Eolian_State *state; 1100 Eolian_State *state;
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 70ab733ce5..84e3f480ed 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -422,8 +422,12 @@ class Eolian_State(Eolian_Unit):
422 def __repr__(self): 422 def __repr__(self):
423 return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units)) 423 return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units))
424 424
425 def file_parse(self, filepath): 425 def file_parse(self, filename):
426 c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filepath)) 426 c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filename))
427 return Eolian_Unit(c_unit) if c_unit else None
428
429 def file_path_parse(self, filepath):
430 c_unit = lib.eolian_state_file_path_parse(self, _str_to_bytes(filepath))
427 return Eolian_Unit(c_unit) if c_unit else None 431 return Eolian_Unit(c_unit) if c_unit else None
428 432
429 @property 433 @property
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 9edebd0199..6e9f9cb1a6 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -52,10 +52,14 @@ lib.eolian_state_new.restype = c_void_p
52lib.eolian_state_free.argtypes = (c_void_p,) 52lib.eolian_state_free.argtypes = (c_void_p,)
53lib.eolian_state_free.restype = None 53lib.eolian_state_free.restype = None
54 54
55# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filepath); 55# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filename);
56lib.eolian_state_file_parse.argtypes = (c_void_p, c_char_p) 56lib.eolian_state_file_parse.argtypes = (c_void_p, c_char_p)
57lib.eolian_state_file_parse.restype = c_void_p 57lib.eolian_state_file_parse.restype = c_void_p
58 58
59# EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const char *filepath);
60lib.eolian_state_file_path_parse.argtypes = (c_void_p, c_char_p)
61lib.eolian_state_file_path_parse.restype = c_void_p
62
59# EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state); 63# EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state);
60lib.eolian_state_eo_file_paths_get.argtypes = (c_void_p,) 64lib.eolian_state_eo_file_paths_get.argtypes = (c_void_p,)
61lib.eolian_state_eo_file_paths_get.restype = c_void_p 65lib.eolian_state_eo_file_paths_get.restype = c_void_p
diff --git a/src/tests/eolian/eolian_aux.c b/src/tests/eolian/eolian_aux.c
index 10f562b301..6c668c924a 100644
--- a/src/tests/eolian/eolian_aux.c
+++ b/src/tests/eolian/eolian_aux.c
@@ -11,8 +11,8 @@ EFL_START_TEST(eolian_aux_children)
11 Eolian_State *eos = eolian_state_new(); 11 Eolian_State *eos = eolian_state_new();
12 12
13 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux")); 13 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
14 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo")); 14 fail_if(!eolian_state_file_path_parse(eos, "aux_a.eo"));
15 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_b.eo")); 15 fail_if(!eolian_state_file_parse(eos, "aux_b.eo"));
16 16
17 Eina_Hash *chash = eolian_aux_state_class_children_find(eos); 17 Eina_Hash *chash = eolian_aux_state_class_children_find(eos);
18 fail_if(!chash); 18 fail_if(!chash);
@@ -48,8 +48,8 @@ EFL_START_TEST(eolian_aux_implements)
48 Eolian_State *eos = eolian_state_new(); 48 Eolian_State *eos = eolian_state_new();
49 49
50 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux")); 50 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
51 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo")); 51 fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
52 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_b.eo")); 52 fail_if(!eolian_state_file_parse(eos, "aux_b.eo"));
53 53
54 Eina_Hash *chash = eolian_aux_state_class_children_find(eos); 54 Eina_Hash *chash = eolian_aux_state_class_children_find(eos);
55 fail_if(!chash); 55 fail_if(!chash);
@@ -75,7 +75,7 @@ EFL_START_TEST(eolian_aux_callables)
75 Eolian_State *eos = eolian_state_new(); 75 Eolian_State *eos = eolian_state_new();
76 76
77 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux")); 77 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
78 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo")); 78 fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
79 79
80 const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A"); 80 const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A");
81 fail_if(!acl); 81 fail_if(!acl);
@@ -103,7 +103,7 @@ EFL_START_TEST(eolian_aux_implparent)
103 Eolian_State *eos = eolian_state_new(); 103 Eolian_State *eos = eolian_state_new();
104 104
105 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux")); 105 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
106 fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo")); 106 fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
107 107
108 const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A"); 108 const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A");
109 fail_if(!acl); 109 fail_if(!acl);
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index de1a740aa5..cf8fcf4d63 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -25,7 +25,7 @@ EFL_START_TEST(eolian_namespaces)
25 Eolian_State *eos = eolian_state_new(); 25 Eolian_State *eos = eolian_state_new();
26 /* Parsing */ 26 /* Parsing */
27 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 27 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
28 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/nmsp1_class1.eo"))); 28 fail_if(!(unit = eolian_state_file_parse(eos, "nmsp1_class1.eo")));
29 29
30 /* Classes existence */ 30 /* Classes existence */
31 fail_if(!(class11 = eolian_unit_class_by_name_get(unit, "nmsp1.class1"))); 31 fail_if(!(class11 = eolian_unit_class_by_name_get(unit, "nmsp1.class1")));
@@ -105,7 +105,7 @@ EFL_START_TEST(eolian_events)
105 Eolian_State *eos = eolian_state_new(); 105 Eolian_State *eos = eolian_state_new();
106 /* Parsing */ 106 /* Parsing */
107 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 107 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
108 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/events.eo"))); 108 fail_if(!(unit = eolian_state_file_parse(eos, "events.eo")));
109 109
110 /* Class */ 110 /* Class */
111 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Events"))); 111 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Events")));
@@ -178,7 +178,7 @@ EFL_START_TEST(eolian_override)
178 Eolian_State *eos = eolian_state_new(); 178 Eolian_State *eos = eolian_state_new();
179 /* Parsing */ 179 /* Parsing */
180 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 180 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
181 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/override.eo"))); 181 fail_if(!(unit = eolian_state_file_parse(eos, "override.eo")));
182 182
183 /* Class */ 183 /* Class */
184 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Override"))); 184 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Override")));
@@ -236,7 +236,7 @@ EFL_START_TEST(eolian_consts)
236 Eolian_State *eos = eolian_state_new(); 236 Eolian_State *eos = eolian_state_new();
237 /* Parsing */ 237 /* Parsing */
238 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 238 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
239 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/consts.eo"))); 239 fail_if(!(unit = eolian_state_file_parse(eos, "consts.eo")));
240 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Consts"))); 240 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Consts")));
241 241
242 /* Method */ 242 /* Method */
@@ -261,7 +261,7 @@ EFL_START_TEST(eolian_ctor_dtor)
261 Eolian_State *eos = eolian_state_new(); 261 Eolian_State *eos = eolian_state_new();
262 /* Parsing */ 262 /* Parsing */
263 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 263 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
264 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/ctor_dtor.eo"))); 264 fail_if(!(unit = eolian_state_file_parse(eos, "ctor_dtor.eo")));
265 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Ctor_Dtor"))); 265 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Ctor_Dtor")));
266 fail_if(!(base = eolian_unit_class_by_name_get(unit, "Base"))); 266 fail_if(!(base = eolian_unit_class_by_name_get(unit, "Base")));
267 267
@@ -337,7 +337,7 @@ EFL_START_TEST(eolian_typedef)
337 Eolian_State *eos = eolian_state_new(); 337 Eolian_State *eos = eolian_state_new();
338 /* Parsing */ 338 /* Parsing */
339 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 339 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
340 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/typedef.eo"))); 340 fail_if(!(unit = eolian_state_file_parse(eos, "typedef.eo")));
341 341
342 /* Check that the class Dummy is still readable */ 342 /* Check that the class Dummy is still readable */
343 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Typedef"))); 343 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Typedef")));
@@ -420,7 +420,7 @@ EFL_START_TEST(eolian_complex_type)
420 Eolian_State *eos = eolian_state_new(); 420 Eolian_State *eos = eolian_state_new();
421 /* Parsing */ 421 /* Parsing */
422 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 422 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
423 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/complex_type.eo"))); 423 fail_if(!(unit = eolian_state_file_parse(eos, "complex_type.eo")));
424 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Complex_Type"))); 424 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Complex_Type")));
425 425
426 /* Properties return type */ 426 /* Properties return type */
@@ -513,7 +513,7 @@ EFL_START_TEST(eolian_scope)
513 Eolian_State *eos = eolian_state_new(); 513 Eolian_State *eos = eolian_state_new();
514 /* Parsing */ 514 /* Parsing */
515 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 515 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
516 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/scope.eo"))); 516 fail_if(!(unit = eolian_state_file_parse(eos, "scope.eo")));
517 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Scope"))); 517 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Scope")));
518 518
519 /* Property scope */ 519 /* Property scope */
@@ -554,7 +554,7 @@ EFL_START_TEST(eolian_simple_parsing)
554 Eolian_State *eos = eolian_state_new(); 554 Eolian_State *eos = eolian_state_new();
555 /* Parsing */ 555 /* Parsing */
556 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 556 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
557 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/class_simple.eo"))); 557 fail_if(!(unit = eolian_state_file_parse(eos, "class_simple.eo")));
558 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Simple"))); 558 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Simple")));
559 fail_if(eolian_state_class_by_file_get(eos, "class_simple.eo") != class); 559 fail_if(eolian_state_class_by_file_get(eos, "class_simple.eo") != class);
560 fail_if(strcmp(eolian_object_file_get((const Eolian_Object *)class), "class_simple.eo")); 560 fail_if(strcmp(eolian_object_file_get((const Eolian_Object *)class), "class_simple.eo"));
@@ -677,7 +677,7 @@ EFL_START_TEST(eolian_struct)
677 677
678 /* Parsing */ 678 /* Parsing */
679 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 679 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
680 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/struct.eo"))); 680 fail_if(!(unit = eolian_state_file_parse(eos, "struct.eo")));
681 681
682 /* Check that the class Dummy is still readable */ 682 /* Check that the class Dummy is still readable */
683 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Struct"))); 683 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Struct")));
@@ -746,7 +746,7 @@ EFL_START_TEST(eolian_extern)
746 746
747 /* Parsing */ 747 /* Parsing */
748 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 748 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
749 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/extern.eo"))); 749 fail_if(!(unit = eolian_state_file_parse(eos, "extern.eo")));
750 750
751 /* Check that the class Dummy is still readable */ 751 /* Check that the class Dummy is still readable */
752 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Extern"))); 752 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Extern")));
@@ -786,7 +786,7 @@ EFL_START_TEST(eolian_var)
786 786
787 /* Parsing */ 787 /* Parsing */
788 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 788 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
789 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/var.eo"))); 789 fail_if(!(unit = eolian_state_file_parse(eos, "var.eo")));
790 790
791 /* Check that the class Dummy is still readable */ 791 /* Check that the class Dummy is still readable */
792 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Var"))); 792 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Var")));
@@ -855,7 +855,7 @@ EFL_START_TEST(eolian_enum)
855 855
856 /* Parsing */ 856 /* Parsing */
857 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 857 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
858 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/enum.eo"))); 858 fail_if(!(unit = eolian_state_file_parse(eos, "enum.eo")));
859 859
860 /* Check that the class Dummy is still readable */ 860 /* Check that the class Dummy is still readable */
861 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Enum"))); 861 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Enum")));
@@ -949,7 +949,7 @@ EFL_START_TEST(eolian_class_funcs)
949 Eolian_State *eos = eolian_state_new(); 949 Eolian_State *eos = eolian_state_new();
950 /* Parsing */ 950 /* Parsing */
951 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 951 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
952 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/class_funcs.eo"))); 952 fail_if(!(unit = eolian_state_file_parse(eos, "class_funcs.eo")));
953 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Funcs"))); 953 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Funcs")));
954 954
955 /* Class properties */ 955 /* Class properties */
@@ -987,7 +987,7 @@ EFL_START_TEST(eolian_free_func)
987 987
988 /* Parsing */ 988 /* Parsing */
989 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 989 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
990 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/free_func.eo"))); 990 fail_if(!(unit = eolian_state_file_parse(eos, "free_func.eo")));
991 991
992 /* Check that the class Dummy is still readable */ 992 /* Check that the class Dummy is still readable */
993 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Free_Func"))); 993 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Free_Func")));
@@ -1021,7 +1021,7 @@ EFL_START_TEST(eolian_null)
1021 1021
1022 /* Parsing */ 1022 /* Parsing */
1023 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1023 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1024 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/null.eo"))); 1024 fail_if(!(unit = eolian_state_file_parse(eos, "null.eo")));
1025 1025
1026 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Null"))); 1026 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Null")));
1027 fail_if(!(func = eolian_class_function_by_name_get(class, "foo", EOLIAN_METHOD))); 1027 fail_if(!(func = eolian_class_function_by_name_get(class, "foo", EOLIAN_METHOD)));
@@ -1069,7 +1069,7 @@ EFL_START_TEST(eolian_import)
1069 1069
1070 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1070 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1071 1071
1072 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/import.eo"))); 1072 fail_if(!(unit = eolian_state_file_parse(eos, "import.eo")));
1073 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Import"))); 1073 fail_if(!(class = eolian_unit_class_by_name_get(unit, "Import")));
1074 1074
1075 fail_if(!(tdl = eolian_unit_alias_by_name_get(unit, "Imported"))); 1075 fail_if(!(tdl = eolian_unit_alias_by_name_get(unit, "Imported")));
@@ -1100,7 +1100,7 @@ EFL_START_TEST(eolian_docs)
1100 1100
1101 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1101 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1102 1102
1103 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/docs.eo"))); 1103 fail_if(!(unit = eolian_state_file_parse(eos, "docs.eo")));
1104 1104
1105 fail_if(!(tdl = eolian_unit_struct_by_name_get(unit, "Foo"))); 1105 fail_if(!(tdl = eolian_unit_struct_by_name_get(unit, "Foo")));
1106 fail_if(!(doc = eolian_typedecl_documentation_get(tdl))); 1106 fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
@@ -1343,7 +1343,7 @@ EFL_START_TEST(eolian_function_types)
1343 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1343 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1344 1344
1345 /* Parsing */ 1345 /* Parsing */
1346 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/function_types.eot"))); 1346 fail_if(!(unit = eolian_state_file_parse(eos, "function_types.eot")));
1347 1347
1348 /* void func(void); */ 1348 /* void func(void); */
1349 fail_if(!(decl = eolian_unit_alias_by_name_get(unit, "VoidFunc"))); 1349 fail_if(!(decl = eolian_unit_alias_by_name_get(unit, "VoidFunc")));
@@ -1468,7 +1468,7 @@ EFL_START_TEST(eolian_function_as_arguments)
1468 1468
1469 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1469 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1470 1470
1471 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/function_as_argument.eo"))); 1471 fail_if(!(unit = eolian_state_file_parse(eos, "function_as_argument.eo")));
1472 1472
1473 fail_if(!(cls = eolian_unit_class_by_name_get(unit, "Function_As_Argument"))); 1473 fail_if(!(cls = eolian_unit_class_by_name_get(unit, "Function_As_Argument")));
1474 1474
@@ -1508,7 +1508,7 @@ EFL_START_TEST(eolian_parts)
1508 1508
1509 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1509 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1510 1510
1511 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/parts.eo"))); 1511 fail_if(!(unit = eolian_state_file_parse(eos, "parts.eo")));
1512 1512
1513 fail_if(!(cls = eolian_unit_class_by_name_get(unit, "Parts"))); 1513 fail_if(!(cls = eolian_unit_class_by_name_get(unit, "Parts")));
1514 1514
@@ -1547,7 +1547,7 @@ EFL_START_TEST(eolian_mixins_require)
1547 1547
1548 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1548 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1549 1549
1550 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/mixins_require.eo"))); 1550 fail_if(!(unit = eolian_state_file_parse(eos, "mixins_require.eo")));
1551 1551
1552 fail_if (!(cl = eolian_state_class_by_name_get(eos, "Mixins.Require"))); 1552 fail_if (!(cl = eolian_state_class_by_name_get(eos, "Mixins.Require")));
1553 fail_if (!(base = eolian_state_class_by_name_get(eos, "Base"))); 1553 fail_if (!(base = eolian_state_class_by_name_get(eos, "Base")));
@@ -1610,7 +1610,7 @@ EFL_START_TEST(eolian_class_requires_classes)
1610 1610
1611 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1611 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1612 1612
1613 fail_if(!(unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/class_requires.eo"))); 1613 fail_if(!(unit = eolian_state_file_parse(eos, "class_requires.eo")));
1614 1614
1615 fail_if (!(cl = eolian_state_class_by_name_get(eos, "Class.Requires"))); 1615 fail_if (!(cl = eolian_state_class_by_name_get(eos, "Class.Requires")));
1616 1616
@@ -1625,7 +1625,7 @@ EFL_START_TEST(eolian_class_unimpl)
1625 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); 1625 fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
1626 1626
1627 setenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN", "1", 1); 1627 setenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN", "1", 1);
1628 const Eolian_Unit *unit = eolian_state_file_parse(eos, TESTS_SRC_DIR"/data/unimpl.eo"); 1628 const Eolian_Unit *unit = eolian_state_file_parse(eos, "unimpl.eo");
1629 unsetenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN"); 1629 unsetenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN");
1630 fail_if(!unit); 1630 fail_if(!unit);
1631 1631
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
index 069e876ba5..faa161bb9e 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
@@ -240,9 +240,7 @@ klass_def init_test_data(std::string const target_file, std::string const target
240 ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR)); 240 ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
241 ck_assert(::eolian_state_directory_add(state.value, EO_SRC_DIR)); 241 ck_assert(::eolian_state_directory_add(state.value, EO_SRC_DIR));
242 ck_assert(::eolian_state_all_eot_files_parse(state.value)); 242 ck_assert(::eolian_state_all_eot_files_parse(state.value));
243 std::string filename = TESTS_SRC_DIR; 243 ck_assert(::eolian_state_file_parse(state.value, target_file.c_str()));
244 filename += "/" + target_file;
245 ck_assert(::eolian_state_file_parse(state.value, filename.c_str()));
246 244
247 const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, target_klass.c_str()); 245 const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, target_klass.c_str());
248 ck_assert_ptr_ne(c_klass, NULL); 246 ck_assert_ptr_ne(c_klass, NULL);
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
index d3908ffb42..9c8e38c0e9 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc
@@ -24,7 +24,7 @@ klass_def init_test_data(efl::eolian::eolian_state const& state)
24{ 24{
25 ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR)); 25 ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
26 ck_assert(::eolian_state_all_eot_files_parse(state.value)); 26 ck_assert(::eolian_state_all_eot_files_parse(state.value));
27 ck_assert(::eolian_state_file_parse(state.value, TESTS_SRC_DIR"/docs.eo")); 27 ck_assert(::eolian_state_file_parse(state.value, "docs.eo"));
28 28
29 const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, "Docs"); 29 const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, "Docs");
30 ck_assert_ptr_ne(c_klass, NULL); 30 ck_assert_ptr_ne(c_klass, NULL);
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_parse.cc b/src/tests/eolian_cxx/eolian_cxx_test_parse.cc
index aa1297a0ba..6692108ee0 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_parse.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_parse.cc
@@ -15,7 +15,7 @@ EFL_START_TEST(eolian_cxx_test_parse_complex_types)
15 efl::eolian::eolian_state state; 15 efl::eolian::eolian_state state;
16 fail_if(!::eolian_state_directory_add(state.value, EO_SRC_DIR)); 16 fail_if(!::eolian_state_directory_add(state.value, EO_SRC_DIR));
17 fail_if(!::eolian_state_directory_add(state.value, TESTS_SRC_DIR)); 17 fail_if(!::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
18 fail_if(!::eolian_state_file_parse(state.value, TESTS_SRC_DIR"/complex.eo")); 18 fail_if(!::eolian_state_file_parse(state.value, "complex.eo"));
19 // TODO finish 19 // TODO finish
20} 20}
21EFL_END_TEST 21EFL_END_TEST