gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35541 - Extractor/src/plugins
Date: Mon, 20 Apr 2015 11:49:45 +0200

Author: LRN
Date: 2015-04-20 11:49:45 +0200 (Mon, 20 Apr 2015)
New Revision: 35541

Modified:
   Extractor/src/plugins/test_mime.c
Log:
Adapt mime test to work with different libmagic versions

Modified: Extractor/src/plugins/test_mime.c
===================================================================
--- Extractor/src/plugins/test_mime.c   2015-04-19 14:15:29 UTC (rev 35540)
+++ Extractor/src/plugins/test_mime.c   2015-04-20 09:49:45 UTC (rev 35541)
@@ -37,7 +37,10 @@
 int
 main (int argc, char *argv[])
 {
-  struct SolutionData courseclear_sol[] =
+  int result = 0;
+  int test_result;
+  int test_result_around_19, test_result_around_22;
+  struct SolutionData courseclear_file_around_19_sol[] =
     {
       {
        EXTRACTOR_METATYPE_MIMETYPE,
@@ -59,6 +62,18 @@
       },
       { 0, 0, NULL, NULL, 0, -1 }
     };
+  struct SolutionData courseclear_file_around_22_sol[] =
+    {
+      {
+       EXTRACTOR_METATYPE_MIMETYPE,
+       EXTRACTOR_METAFORMAT_UTF8,
+       "text/plain",
+       "audio/ogg",
+       strlen ("audio/ogg") + 1,
+       0
+      },
+      { 0, 0, NULL, NULL, 0, -1 }
+    };
   struct SolutionData gif_image_sol[] =
     {
       {
@@ -71,15 +86,40 @@
       },
       { 0, 0, NULL, NULL, 0, -1 }
     };
-  struct ProblemSet ps[] =
+  struct ProblemSet ps_gif[] =
     {
-      { "testdata/ogg_courseclear.ogg",
-       courseclear_sol },
       { "testdata/gif_image.gif",
        gif_image_sol },
       { NULL, NULL }
     };
-  return ET_main ("mime", ps);
+  struct ProblemSet ps_ogg_around_19[] =
+    {
+      { "testdata/ogg_courseclear.ogg",
+       courseclear_file_around_19_sol },
+      { NULL, NULL }
+    };
+  struct ProblemSet ps_ogg_around_22[] =
+    {
+      { "testdata/ogg_courseclear.ogg",
+       courseclear_file_around_22_sol },
+      { NULL, NULL }
+    };
+  printf ("Running gif test on libmagic:\n");
+  test_result = (0 == ET_main ("mime", ps_gif) ? 0 : 1);
+  printf ("gif libmagic test result: %s\n", test_result == 0 ? "OK" : 
"FAILED");
+  result += test_result;
+
+  printf ("Running ogg test on libmagic, assuming version ~5.19:\n");
+  test_result_around_19 = (0 == ET_main ("mime", ps_ogg_around_19) ? 0 : 1);
+  printf ("ogg libmagic test result: %s\n", test_result_around_19 == 0 ? "OK" 
: "FAILED");
+
+  printf ("Running ogg test on libmagic, assuming version ~5.22:\n");
+  test_result_around_22 = (0 == ET_main ("mime", ps_ogg_around_22) ? 0 : 1);
+  printf ("ogg libmagic test result: %s\n", test_result_around_22 == 0 ? "OK" 
: "FAILED");
+
+  if ((test_result_around_19 != 0) && (test_result_around_22 != 0))
+    result++;
+  return result;
 }
 
 /* end of test_mime.c */




reply via email to

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