testing: avoid false warning
authorPatrick Ohly <patrick.ohly@intel.com>
Mon, 25 Mar 2013 13:37:26 +0000 (14:37 +0100)
committerPatrick Ohly <patrick.ohly@intel.com>
Tue, 26 Mar 2013 14:13:39 +0000 (15:13 +0100)
When FOLKS_BACKEND_PATH is set to the build dirs during testing, the
"content type of '%s' appears to be '%s' which looks suspicious. Have
you installed shared-mime-info?" warning gets triggered repeatedly,
because these dirs contain all kinds of files (executables, compiler
dependency files, etc.) which are not expected in the normal install
location.

This is annoying when running a test with "make <test>.gdb" because
gdb stops on a glib trace point for each warning. Therefore disable
the warning when FOLKS_BACKEND_PATH is set. Extending the whitelist
has the drawback that it might not catch all files that can appear
there in the future.

folks/backend-store.vala

index d80eceb..e7b5d69 100644 (file)
@@ -632,6 +632,7 @@ public class Folks.BackendStore : Object {
 
       var modules_final = new HashMap<string, File> ();
 
+      string? _path = Environment.get_variable ("FOLKS_BACKEND_PATH");
       foreach (var info in infos)
         {
           var file = dir.get_child (info.get_name ());
@@ -668,8 +669,12 @@ public class Folks.BackendStore : Object {
                   "The content type of '%s' could not be determined. Have you installed shared-mime-info?",
                   file.get_path ());
             }
-          /* We should have only .la .so and sub-directories */
-          else if (mime != "application/x-sharedlib" &&
+          /*
+           * We should have only .la .so and sub-directories, except if FOLKS_BACKEND_PATH is set.
+           * Then we will run into all kinds of files.
+           */
+          else if (_path == null &&
+                   mime != "application/x-sharedlib" &&
                    mime != "application/x-shared-library-la" &&
                    mime != "inode/directory")
             {