gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23351 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r23351 - Extractor/src/plugins
Date: Tue, 21 Aug 2012 20:26:43 +0200

Author: grothoff
Date: 2012-08-21 20:26:43 +0200 (Tue, 21 Aug 2012)
New Revision: 23351

Modified:
   Extractor/src/plugins/test_exiv2.c
   Extractor/src/plugins/test_lib.c
Log:
run in-process and out-of-process

Modified: Extractor/src/plugins/test_exiv2.c
===================================================================
--- Extractor/src/plugins/test_exiv2.c  2012-08-21 16:12:29 UTC (rev 23350)
+++ Extractor/src/plugins/test_exiv2.c  2012-08-21 18:26:43 UTC (rev 23351)
@@ -175,6 +175,14 @@
        0 
       },
       { 
+       EXTRACTOR_METATYPE_LOCATION_CITY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Los Verdes",
+       strlen ("Los Verdes") + 1,
+       0 
+      },
+      { 
        EXTRACTOR_METATYPE_LOCATION_SUBLOCATION,
        EXTRACTOR_METAFORMAT_UTF8,
        "text/plain",
@@ -191,6 +199,14 @@
        0 
       },
       { 
+       EXTRACTOR_METATYPE_LOCATION_COUNTRY,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Spain",
+       strlen ("Spain") + 1,
+       0 
+      },
+      { 
        EXTRACTOR_METATYPE_KEYWORDS,
        EXTRACTOR_METAFORMAT_UTF8,
        "text/plain",
@@ -270,6 +286,46 @@
        strlen ("Wo?") + 1,
        0 
       },
+      { 
+       EXTRACTOR_METATYPE_RATING,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "3",
+       strlen ("3") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_RATING,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "50",
+       strlen ("50") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "ES",
+       strlen ("ES") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Optio W30 Ver 1.00",
+       strlen ("Optio W30 Ver 1.00") + 1,
+       0 
+      },
+      { 
+       EXTRACTOR_METATYPE_SUBJECT,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "Wo?, Wo?|Fuerteventura, Was?, Was?|Anlass]|Urlaub, 
Was?|Aufnahme]|Landschaftsbild, Was?|Natur]|Wind, Was?|Natur]|Sand, 
Wo?|Fuerteventura|ProCenter Rene Egli, Was?|Sport, Was?|Sport|Windsurfen",
+       strlen ("Wo?, Wo?|Fuerteventura, Was?, Was?|Anlass]|Urlaub, 
Was?|Aufnahme]|Landschaftsbild, Was?|Natur]|Wind, Was?|Natur]|Sand, 
Wo?|Fuerteventura|ProCenter Rene Egli, Was?|Sport, Was?|Sport|Windsurfen") + 1,
+       0 
+      },
       { 0, 0, NULL, NULL, 0, -1 }
     };
   struct ProblemSet ps[] =

Modified: Extractor/src/plugins/test_lib.c
===================================================================
--- Extractor/src/plugins/test_lib.c    2012-08-21 16:12:29 UTC (rev 23350)
+++ Extractor/src/plugins/test_lib.c    2012-08-21 18:26:43 UTC (rev 23351)
@@ -86,32 +86,27 @@
 
 
 /**
- * Main function to be called to test a plugin.
+ * Run a test for the given plugin, problem set and options.
  *
  * @param plugin_name name of the plugin to load
  * @param ps array of problems the plugin should solve;
  *        NULL in filename terminates the array. 
+ * @param opt options to use for loading the plugin
  * @return 0 on success, 1 on failure
  */
-int 
-ET_main (const char *plugin_name,
-        struct ProblemSet *ps)
+static int 
+run (const char *plugin_name,
+     struct ProblemSet *ps,
+     enum EXTRACTOR_Options opt)
 {
   struct EXTRACTOR_PluginList *pl;
   unsigned int i;
   unsigned int j;
   int ret;
-  
-  /* change environment to find plugins which may not yet be
-     not installed but should be in the current directory (or .libs)
-     on 'make check' */
-  if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/"))
-    fprintf (stderr, 
-            "Failed to update my environment, plugin loading may fail: %s\n",
-            strerror (errno));    
+
   pl = EXTRACTOR_plugin_add_config (NULL, 
                                    plugin_name,
-                                   EXTRACTOR_OPTION_IN_PROCESS);
+                                   opt);
   for (i=0; NULL != ps[i].filename; i++)
     EXTRACTOR_extract (pl,
                       ps[i].filename,
@@ -122,7 +117,7 @@
   ret = 0;
   for (i=0; NULL != ps[i].filename; i++)    
     for (j=0; -1 != ps[i].solution[j].solved; j++)
-      if (0 == ps[i].solution[j].solved)
+      if (0 == ps[i].solution[j].solved)       
       {
        ret = 1;
         fprintf (stderr,
@@ -133,9 +128,41 @@
           ps[i].solution[j].data,
           plugin_name);
       }
+      else
+       ps[i].solution[j].solved = 0;
   return ret;
 }
 
 
+/**
+ * Main function to be called to test a plugin.
+ *
+ * @param plugin_name name of the plugin to load
+ * @param ps array of problems the plugin should solve;
+ *        NULL in filename terminates the array. 
+ * @return 0 on success, 1 on failure
+ */
+int 
+ET_main (const char *plugin_name,
+        struct ProblemSet *ps)
+{
+  int ret;
+  
+  /* change environment to find plugins which may not yet be
+     not installed but should be in the current directory (or .libs)
+     on 'make check' */
+  if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/"))
+    fprintf (stderr, 
+            "Failed to update my environment, plugin loading may fail: %s\n",
+            strerror (errno));    
+  ret = run (plugin_name, ps, EXTRACTOR_OPTION_IN_PROCESS);
+  if (0 != ret)
+    return ret;
+  ret = run (plugin_name, ps, EXTRACTOR_OPTION_DEFAULT_POLICY);
+  if (0 != ret)
+    return ret;
+  return 0;
+}
 
+
 /* end of test_lib.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]