q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=db57523e7846a6729f0ca0681e7e998b537e5b81

commit db57523e7846a6729f0ca0681e7e998b537e5b81
Author: Daniel Kolesa <[email protected]>
Date:   Fri May 3 16:55:59 2019 +0200

    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
---
 src/bin/eolian/main.c                              |  2 +-
 src/bin/eolian_cxx/eolian_cxx.cc                   |  4 +-
 src/bin/eolian_mono/eolian_mono.cc                 |  2 +-
 src/bindings/luajit/eolian.lua                     | 15 +++-
 src/lib/eolian/Eolian.h                            | 23 +++++-
 src/lib/eolian/eolian_database.c                   | 88 +++++++++++++++++-----
 src/scripts/pyolian/eolian.py                      |  8 +-
 src/scripts/pyolian/eolian_lib.py                  |  6 +-
 src/tests/eolian/eolian_aux.c                      | 12 +--
 src/tests/eolian/eolian_parsing.c                  | 48 ++++++------
 src/tests/eolian_cxx/eolian_cxx_test_binding.cc    |  4 +-
 .../eolian_cxx/eolian_cxx_test_documentation.cc    |  2 +-
 src/tests/eolian_cxx/eolian_cxx_test_parse.cc      |  2 +-
 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)
           }
      }
 
-   if (!eolian_state_file_parse(eos, input))
+   if (!eolian_state_file_path_parse(eos, input))
      {
         fprintf(stderr, "eolian: could not parse file '%s'\n", input);
         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)
 
        for(auto&& name : opts.in_files)
          {
-           Eolian_Unit const* unit = ::eolian_state_file_parse(opts.state, 
name.c_str());
+           Eolian_Unit const* unit = 
::eolian_state_file_path_parse(opts.state, name.c_str());
            if(!unit)
              {
                EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
@@ -398,7 +398,7 @@ database_load(options_type const& opts)
          << "No input file.";
        assert(false && "Error parsing input file");
      }
-   if (!opts.main_header && !::eolian_state_file_parse(opts.state, 
opts.in_files[0].c_str()))
+   if (!opts.main_header && !::eolian_state_file_path_parse(opts.state, 
opts.in_files[0].c_str()))
      {
        EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
          << "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)
          << "No input file.";
        assert(false && "Error parsing input file");
      }
-   if (!::eolian_state_file_parse(opts.state, opts.in_file.c_str()))
+   if (!::eolian_state_file_path_parse(opts.state, opts.in_file.c_str()))
      {
        EINA_CXX_DOM_LOG_ERR(eolian_mono::domain)
          << "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 [[
     Eina_Iterator *eolian_state_eot_file_paths_get(const Eolian_State *state);
     Eina_Iterator *eolian_state_eo_files_get(const Eolian_State *state);
     Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state);
-    const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char 
*filepath);
+    const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char 
*filename);
+    const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const 
char *filepath);
     Eina_Bool eolian_state_all_eo_files_parse(Eolian_State *state);
     Eina_Bool eolian_state_all_eot_files_parse(Eolian_State *state);
     Eina_Bool eolian_state_check(const Eolian_State *state);
@@ -755,8 +756,16 @@ ffi.metatype("Eolian_State", {
             return eolian.eolian_state_system_directory_add(self) ~= 0
         end,
 
-        file_parse = function(self, fpath)
-            local v = eolian.eolian_state_file_parse(self, fpath)
+        file_parse = function(self, fname)
+            local v = eolian.eolian_state_file_parse(self, fname)
+            if v == nil then
+                return nil
+            end
+            return v
+        end,
+
+        file_path_parse = function(self, fpath)
+            local v = eolian.eolian_state_file_path_parse(self, fpath)
             if v == nil then
                 return nil
             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);
 /*
  * @brief Parse the given .eo or .eot file and fill the database.
  *
- * The input can be either a full path to the file or only a filename.
- * If it's a filename, it must be scanned for first.
+ * The input must be a file name from a directory that was previously
+ * scanned with eolian_state_directory_add().
+ *
+ * @param[in] state The Eolian state.
+ * @param[in] filename The name of the file to parse.
+ * @return The unit corresponding to the parsed file or NULL.
+ *
+ * @see eolian_state_directory_add
+ * @see eolian_state_file_path_parse
+ *
+ * @ingroup Eolian
+ */
+EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const 
char *filename);
+
+/*
+ * @brief Parse the given .eo or .eot file and fill the database.
+ *
+ * The input is a file path. Its directory is scanned first, and then
+ * the file itself is parsed and a unit handle is returned.
  *
  * @param[in] state The Eolian state.
  * @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);
  *
  * @ingroup Eolian
  */
-EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const 
char *filepath);
+EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, 
const char *filepath);
 
 /*
  * @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)
    return ret;
 }
 
+typedef struct _Scan_State
+{
+   Eolian_State *eos;
+   Eina_Bool succ;
+} Scan_State;
+
 static void
-_scan_cb(const char *name, const char *path, void *data EINA_UNUSED)
+_scan_cb(const char *name, const char *path, void *data)
 {
-   Eolian_State *state = data;
+   Scan_State *sst = data;
    Eina_Bool is_eo = eina_str_has_suffix(name, EO_SUFFIX);
    if (!is_eo && !eina_str_has_suffix(name, EOT_SUFFIX)) return;
-   eina_hash_add(is_eo ? state->filenames_eo : state->filenames_eot,
-                 eina_stringshare_add(name), join_path(path, name));
+   Eina_Hash *fh = is_eo ? sst->eos->filenames_eo : sst->eos->filenames_eot;
+   const char *origpath = eina_hash_find(fh, name);
+   char *newpath = join_path(path, name);
+   if (origpath)
+     {
+        if (strcmp(origpath, newpath))
+          {
+            eolian_state_log(sst->eos,
+                             "conflicting paths for '%s': '%s' -> '%s'",
+                             name, origpath, newpath);
+            sst->succ = EINA_FALSE;
+          }
+        free(newpath);
+     }
+   else
+     eina_hash_add(fh, name, newpath);
 }
 
 EAPI Eina_Bool
 eolian_state_directory_add(Eolian_State *state, const char *dir)
 {
    if (!dir || !state) return EINA_FALSE;
-   eina_file_dir_list(dir, EINA_TRUE, _scan_cb, state);
-   return EINA_TRUE;
+   Scan_State sst = { state, EINA_TRUE };
+   return eina_file_dir_list(dir, EINA_TRUE, _scan_cb, &sst);
 }
 
 EAPI Eina_Bool
@@ -818,25 +838,24 @@ eolian_state_eo_file_paths_get(const Eolian_State *state)
 }
 
 static Eolian_Unit *
-_eolian_file_parse_nodep(Eolian_Unit *parent, const char *filepath)
+_eolian_file_parse_nodep(Eolian_Unit *parent, const char *filename)
 {
    Eina_Bool is_eo;
-   const char *eopath;
-
-   is_eo = eina_str_has_suffix(filepath, EO_SUFFIX);
-   if (!is_eo && !eina_str_has_suffix(filepath, EOT_SUFFIX))
+   is_eo = eina_str_has_suffix(filename, EO_SUFFIX);
+   if (!is_eo && !eina_str_has_suffix(filename, EOT_SUFFIX))
      {
         eolian_state_log(parent->state,
                          "file '%s' doesn't have a correct extension",
-                         filepath);
+                         filename);
         return NULL;
      }
-   if (!(eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : 
parent->state->filenames_eot, filepath)))
+   const char *eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : 
parent->state->filenames_eot, filename);
+   if (!eopath)
      {
-        char *vpath = eina_file_path_sanitize(filepath);
-        Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo);
-        free(vpath);
-        return ret;
+        eolian_state_log(parent->state,
+                         "file '%s' is not registered in the database",
+                         filename);
+        return NULL;
      }
    return eo_parser_database_fill(parent, eopath, !is_eo);
 }
@@ -1027,13 +1046,13 @@ _merge_staging(Eolian_State *state)
 }
 
 EAPI const Eolian_Unit *
-eolian_state_file_parse(Eolian_State *state, const char *filepath)
+eolian_state_file_parse(Eolian_State *state, const char *filename)
 {
    if (!state)
      return NULL;
 
    _state_clean(state);
-   Eolian_Unit *ret = _eolian_file_parse_nodep(&state->staging.unit, filepath);
+   Eolian_Unit *ret = _eolian_file_parse_nodep(&state->staging.unit, filename);
    if (!ret)
      return NULL;
    if (!_parse_deferred(ret))
@@ -1045,6 +1064,37 @@ eolian_state_file_parse(Eolian_State *state, const char 
*filepath)
    return ret;
 }
 
+EAPI const Eolian_Unit *
+eolian_state_file_path_parse(Eolian_State *state, const char *filepath)
+{
+   if (!state)
+     return NULL;
+
+   char *mpath = strdup(filepath);
+   if (!mpath)
+     return NULL;
+
+   char *fname = strrchr(mpath, '/');
+   if (fname && strrchr(fname, '\\'))
+     fname = strrchr(fname, '\\');
+
+   const char *toscan = mpath;
+   if (!fname)
+     {
+        toscan = ".";
+        fname = mpath;
+     }
+   else
+     *fname++ = '\0';
+
+   if (!eolian_state_directory_add(state, toscan))
+     {
+        eolian_state_log(state, "could not scan directory '%s'", toscan);
+        return NULL;
+     }
+   return eolian_state_file_parse(state, fname);
+}
+
 typedef struct _Parse_Data
 {
    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):
     def __repr__(self):
         return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units))
 
-    def file_parse(self, filepath):
-        c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filepath))
+    def file_parse(self, filename):
+        c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filename))
+        return Eolian_Unit(c_unit) if c_unit else None
+
+    def file_path_parse(self, filepath):
+        c_unit = lib.eolian_state_file_path_parse(self, 
_str_to_bytes(filepath))
         return Eolian_Unit(c_unit) if c_unit else None
 
     @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
 lib.eolian_state_free.argtypes = (c_void_p,)
 lib.eolian_state_free.restype = None
 
-# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const 
char *filepath);
+# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const 
char *filename);
 lib.eolian_state_file_parse.argtypes = (c_void_p, c_char_p)
 lib.eolian_state_file_parse.restype = c_void_p
 
+# EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, 
const char *filepath);
+lib.eolian_state_file_path_parse.argtypes = (c_void_p, c_char_p)
+lib.eolian_state_file_path_parse.restype = c_void_p
+
 # EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State 
*state);
 lib.eolian_state_eo_file_paths_get.argtypes = (c_void_p,)
 lib.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)
    Eolian_State *eos = eolian_state_new();
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_b.eo"));
+   fail_if(!eolian_state_file_path_parse(eos, "aux_a.eo"));
+   fail_if(!eolian_state_file_parse(eos, "aux_b.eo"));
 
    Eina_Hash *chash = eolian_aux_state_class_children_find(eos);
    fail_if(!chash);
@@ -48,8 +48,8 @@ EFL_START_TEST(eolian_aux_implements)
    Eolian_State *eos = eolian_state_new();
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_b.eo"));
+   fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
+   fail_if(!eolian_state_file_parse(eos, "aux_b.eo"));
 
    Eina_Hash *chash = eolian_aux_state_class_children_find(eos);
    fail_if(!chash);
@@ -75,7 +75,7 @@ EFL_START_TEST(eolian_aux_callables)
    Eolian_State *eos = eolian_state_new();
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo"));
+   fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
 
    const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A");
    fail_if(!acl);
@@ -103,7 +103,7 @@ EFL_START_TEST(eolian_aux_implparent)
    Eolian_State *eos = eolian_state_new();
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data_aux"));
-   fail_if(!eolian_state_file_parse(eos, TESTS_SRC_DIR"/data_aux/aux_a.eo"));
+   fail_if(!eolian_state_file_parse(eos, "aux_a.eo"));
 
    const Eolian_Class *acl = eolian_state_class_by_name_get(eos, "Aux_A");
    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)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/nmsp1_class1.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "nmsp1_class1.eo")));
 
    /* Classes existence  */
    fail_if(!(class11 = eolian_unit_class_by_name_get(unit, "nmsp1.class1")));
@@ -105,7 +105,7 @@ EFL_START_TEST(eolian_events)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/events.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "events.eo")));
 
    /* Class */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Events")));
@@ -178,7 +178,7 @@ EFL_START_TEST(eolian_override)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/override.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "override.eo")));
 
    /* Class */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Override")));
@@ -236,7 +236,7 @@ EFL_START_TEST(eolian_consts)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/consts.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "consts.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Consts")));
 
    /* Method */
@@ -261,7 +261,7 @@ EFL_START_TEST(eolian_ctor_dtor)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/ctor_dtor.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "ctor_dtor.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Ctor_Dtor")));
    fail_if(!(base = eolian_unit_class_by_name_get(unit, "Base")));
 
@@ -337,7 +337,7 @@ EFL_START_TEST(eolian_typedef)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/typedef.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "typedef.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Typedef")));
@@ -420,7 +420,7 @@ EFL_START_TEST(eolian_complex_type)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/complex_type.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "complex_type.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Complex_Type")));
 
    /* Properties return type */
@@ -513,7 +513,7 @@ EFL_START_TEST(eolian_scope)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/scope.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "scope.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Scope")));
 
    /* Property scope */
@@ -554,7 +554,7 @@ EFL_START_TEST(eolian_simple_parsing)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/class_simple.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "class_simple.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Simple")));
    fail_if(eolian_state_class_by_file_get(eos, "class_simple.eo") != class);
    fail_if(strcmp(eolian_object_file_get((const Eolian_Object *)class), 
"class_simple.eo"));
@@ -677,7 +677,7 @@ EFL_START_TEST(eolian_struct)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/struct.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "struct.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Struct")));
@@ -746,7 +746,7 @@ EFL_START_TEST(eolian_extern)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/extern.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "extern.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Extern")));
@@ -786,7 +786,7 @@ EFL_START_TEST(eolian_var)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/var.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "var.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Var")));
@@ -855,7 +855,7 @@ EFL_START_TEST(eolian_enum)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/enum.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "enum.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Enum")));
@@ -949,7 +949,7 @@ EFL_START_TEST(eolian_class_funcs)
    Eolian_State *eos = eolian_state_new();
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/class_funcs.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "class_funcs.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Class_Funcs")));
 
    /* Class properties */
@@ -987,7 +987,7 @@ EFL_START_TEST(eolian_free_func)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/free_func.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "free_func.eo")));
 
    /* Check that the class Dummy is still readable */
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Free_Func")));
@@ -1021,7 +1021,7 @@ EFL_START_TEST(eolian_null)
 
    /* Parsing */
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/null.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "null.eo")));
 
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Null")));
    fail_if(!(func = eolian_class_function_by_name_get(class, "foo", 
EOLIAN_METHOD)));
@@ -1069,7 +1069,7 @@ EFL_START_TEST(eolian_import)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/import.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "import.eo")));
    fail_if(!(class = eolian_unit_class_by_name_get(unit, "Import")));
 
    fail_if(!(tdl = eolian_unit_alias_by_name_get(unit, "Imported")));
@@ -1100,7 +1100,7 @@ EFL_START_TEST(eolian_docs)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/docs.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "docs.eo")));
 
    fail_if(!(tdl = eolian_unit_struct_by_name_get(unit, "Foo")));
    fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
@@ -1343,7 +1343,7 @@ EFL_START_TEST(eolian_function_types)
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
    /* Parsing */
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/function_types.eot")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "function_types.eot")));
 
    /* void func(void); */
    fail_if(!(decl = eolian_unit_alias_by_name_get(unit, "VoidFunc")));
@@ -1468,7 +1468,7 @@ EFL_START_TEST(eolian_function_as_arguments)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/function_as_argument.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "function_as_argument.eo")));
 
    fail_if(!(cls = eolian_unit_class_by_name_get(unit, 
"Function_As_Argument")));
 
@@ -1508,7 +1508,7 @@ EFL_START_TEST(eolian_parts)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/parts.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "parts.eo")));
 
    fail_if(!(cls = eolian_unit_class_by_name_get(unit, "Parts")));
 
@@ -1547,7 +1547,7 @@ EFL_START_TEST(eolian_mixins_require)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/mixins_require.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "mixins_require.eo")));
 
    fail_if (!(cl = eolian_state_class_by_name_get(eos, "Mixins.Require")));
    fail_if (!(base = eolian_state_class_by_name_get(eos, "Base")));
@@ -1610,7 +1610,7 @@ EFL_START_TEST(eolian_class_requires_classes)
 
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
-   fail_if(!(unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/class_requires.eo")));
+   fail_if(!(unit = eolian_state_file_parse(eos, "class_requires.eo")));
 
    fail_if (!(cl = eolian_state_class_by_name_get(eos, "Class.Requires")));
 
@@ -1625,7 +1625,7 @@ EFL_START_TEST(eolian_class_unimpl)
    fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
 
    setenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN", "1", 1);
-   const Eolian_Unit *unit = eolian_state_file_parse(eos, 
TESTS_SRC_DIR"/data/unimpl.eo");
+   const Eolian_Unit *unit = eolian_state_file_parse(eos, "unimpl.eo");
    unsetenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN");
    fail_if(!unit);
 
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
    ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
    ck_assert(::eolian_state_directory_add(state.value, EO_SRC_DIR));
    ck_assert(::eolian_state_all_eot_files_parse(state.value));
-   std::string filename = TESTS_SRC_DIR;
-   filename += "/" + target_file;
-   ck_assert(::eolian_state_file_parse(state.value, filename.c_str()));
+   ck_assert(::eolian_state_file_parse(state.value, target_file.c_str()));
 
    const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, 
target_klass.c_str());
    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)
 {
    ck_assert(::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
    ck_assert(::eolian_state_all_eot_files_parse(state.value));
-   ck_assert(::eolian_state_file_parse(state.value, TESTS_SRC_DIR"/docs.eo"));
+   ck_assert(::eolian_state_file_parse(state.value, "docs.eo"));
 
    const Eolian_Class *c_klass = ::eolian_state_class_by_name_get(state.value, 
"Docs");
    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)
    efl::eolian::eolian_state state;
    fail_if(!::eolian_state_directory_add(state.value, EO_SRC_DIR));
    fail_if(!::eolian_state_directory_add(state.value, TESTS_SRC_DIR));
-   fail_if(!::eolian_state_file_parse(state.value, 
TESTS_SRC_DIR"/complex.eo"));
+   fail_if(!::eolian_state_file_parse(state.value, "complex.eo"));
    // TODO finish
 }
 EFL_END_TEST

-- 


Reply via email to