diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/Makefile.am | 6 | ||||
-rw-r--r-- | src/main/extractor_plugins.c | 1 | ||||
-rw-r--r-- | src/main/test_plugin_load_multi.c | 29 | ||||
-rw-r--r-- | src/main/test_plugin_loading.c | 27 | ||||
-rw-r--r-- | src/main/test_trivial.c | 25 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 6 | ||||
-rwxr-xr-x | src/plugins/fuzz_default.sh (renamed from src/main/fuzz_default.sh) | 0 | ||||
-rwxr-xr-x | src/plugins/fuzz_thumbnail.sh (renamed from src/main/fuzz_thumbnail.sh) | 0 |
8 files changed, 81 insertions, 13 deletions
diff --git a/src/main/Makefile.am b/src/main/Makefile.am index 207fda2..1fe415d 100644 --- a/src/main/Makefile.am +++ b/src/main/Makefile.am | |||
@@ -58,10 +58,6 @@ extract_SOURCES = \ | |||
58 | LDADD = \ | 58 | LDADD = \ |
59 | $(top_builddir)/src/main/libextractor.la | 59 | $(top_builddir)/src/main/libextractor.la |
60 | 60 | ||
61 | if HAVE_ZZUF | ||
62 | fuzz_tests=fuzz_default.sh fuzz_thumbnail.sh | ||
63 | endif | ||
64 | |||
65 | TESTS_ENVIRONMENT = testdatadir=$(top_srcdir)/test | 61 | TESTS_ENVIRONMENT = testdatadir=$(top_srcdir)/test |
66 | TESTS_ENVIRONMENT += bindir=${bindir} | 62 | TESTS_ENVIRONMENT += bindir=${bindir} |
67 | 63 | ||
@@ -70,7 +66,7 @@ check_PROGRAMS = \ | |||
70 | test_plugin_loading \ | 66 | test_plugin_loading \ |
71 | test_plugin_load_multi | 67 | test_plugin_load_multi |
72 | 68 | ||
73 | TESTS = $(check_PROGRAMS) $(fuzz_tests) | 69 | TESTS = $(check_PROGRAMS) |
74 | 70 | ||
75 | test_trivial_SOURCES = \ | 71 | test_trivial_SOURCES = \ |
76 | test_trivial.c | 72 | test_trivial.c |
diff --git a/src/main/extractor_plugins.c b/src/main/extractor_plugins.c index 7f43808..8ebd32c 100644 --- a/src/main/extractor_plugins.c +++ b/src/main/extractor_plugins.c | |||
@@ -237,6 +237,7 @@ EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList *prev, | |||
237 | } | 237 | } |
238 | if (NULL == (result = malloc (sizeof (struct EXTRACTOR_PluginList)))) | 238 | if (NULL == (result = malloc (sizeof (struct EXTRACTOR_PluginList)))) |
239 | return prev; | 239 | return prev; |
240 | memset (result, 0, sizeof (struct EXTRACTOR_PluginList)); | ||
240 | result->next = prev; | 241 | result->next = prev; |
241 | if (NULL == (result->short_libname = strdup (library))) | 242 | if (NULL == (result->short_libname = strdup (library))) |
242 | { | 243 | { |
diff --git a/src/main/test_plugin_load_multi.c b/src/main/test_plugin_load_multi.c index 28a9aae..6fc064f 100644 --- a/src/main/test_plugin_load_multi.c +++ b/src/main/test_plugin_load_multi.c | |||
@@ -1,3 +1,22 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2002, 2003, 2004, 2005, 2006, 2009 Vidyut Samanta and Christian Grothoff | ||
4 | |||
5 | libextractor is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libextractor is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with libextractor; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
1 | /** | 20 | /** |
2 | * @file main/test_plugin_load_multi.c | 21 | * @file main/test_plugin_load_multi.c |
3 | * @brief testcase for libextractor plugin loading that loads the same | 22 | * @brief testcase for libextractor plugin loading that loads the same |
@@ -8,6 +27,7 @@ | |||
8 | #include "platform.h" | 27 | #include "platform.h" |
9 | #include "extractor.h" | 28 | #include "extractor.h" |
10 | 29 | ||
30 | |||
11 | static int | 31 | static int |
12 | testLoadPlugins () | 32 | testLoadPlugins () |
13 | { | 33 | { |
@@ -16,13 +36,13 @@ testLoadPlugins () | |||
16 | 36 | ||
17 | el1 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); | 37 | el1 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); |
18 | el2 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); | 38 | el2 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); |
19 | if ((el1 == NULL) || (el2 == NULL)) | 39 | if ((NULL == el1) || (NULL == el2)) |
20 | { | 40 | { |
21 | fprintf (stderr, | 41 | fprintf (stderr, |
22 | "Failed to load default plugins!\n"); | 42 | "Failed to load default plugins!\n"); |
23 | if (el1 != NULL) | 43 | if (NULL != el1) |
24 | EXTRACTOR_plugin_remove_all (el1); | 44 | EXTRACTOR_plugin_remove_all (el1); |
25 | if (el2 != NULL) | 45 | if (NULL != el2) |
26 | EXTRACTOR_plugin_remove_all (el2); | 46 | EXTRACTOR_plugin_remove_all (el2); |
27 | return 1; | 47 | return 1; |
28 | } | 48 | } |
@@ -31,6 +51,7 @@ testLoadPlugins () | |||
31 | return 0; | 51 | return 0; |
32 | } | 52 | } |
33 | 53 | ||
54 | |||
34 | int | 55 | int |
35 | main (int argc, char *argv[]) | 56 | main (int argc, char *argv[]) |
36 | { | 57 | { |
@@ -40,3 +61,5 @@ main (int argc, char *argv[]) | |||
40 | ret += testLoadPlugins (); | 61 | ret += testLoadPlugins (); |
41 | return ret; | 62 | return ret; |
42 | } | 63 | } |
64 | |||
65 | /* end of test_plugin_load_multi.c */ | ||
diff --git a/src/main/test_plugin_loading.c b/src/main/test_plugin_loading.c index 1b6eaee..b789b08 100644 --- a/src/main/test_plugin_loading.c +++ b/src/main/test_plugin_loading.c | |||
@@ -1,3 +1,23 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2002, 2003, 2004, 2005, 2006, 2009 Vidyut Samanta and Christian Grothoff | ||
4 | |||
5 | libextractor is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libextractor is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with libextractor; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
1 | /** | 21 | /** |
2 | * @file main/test_plugin_loading.c | 22 | * @file main/test_plugin_loading.c |
3 | * @brief testcase for dynamic loading and unloading of plugins | 23 | * @brief testcase for dynamic loading and unloading of plugins |
@@ -17,20 +37,19 @@ main (int argc, char *argv[]) | |||
17 | arg = EXTRACTOR_plugin_remove (arg, "mime"); | 37 | arg = EXTRACTOR_plugin_remove (arg, "mime"); |
18 | arg = EXTRACTOR_plugin_remove (arg, "zip"); | 38 | arg = EXTRACTOR_plugin_remove (arg, "zip"); |
19 | arg = EXTRACTOR_plugin_remove (arg, "png"); | 39 | arg = EXTRACTOR_plugin_remove (arg, "png"); |
20 | if (arg != NULL) | 40 | if (NULL != arg) |
21 | { | 41 | { |
22 | fprintf (stderr, | 42 | fprintf (stderr, |
23 | "add-remove test failed!\n"); | 43 | "add-remove test failed!\n"); |
24 | return -1; | 44 | return -1; |
25 | } | 45 | } |
26 | |||
27 | arg = EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); | 46 | arg = EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); |
28 | arg = EXTRACTOR_plugin_add (arg, "png", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); | 47 | arg = EXTRACTOR_plugin_add (arg, "png", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); |
29 | arg = EXTRACTOR_plugin_add (arg, "zip", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); | 48 | arg = EXTRACTOR_plugin_add (arg, "zip", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); |
30 | arg = EXTRACTOR_plugin_remove (arg, "zip"); | 49 | arg = EXTRACTOR_plugin_remove (arg, "zip"); |
31 | arg = EXTRACTOR_plugin_remove (arg, "mime"); | 50 | arg = EXTRACTOR_plugin_remove (arg, "mime"); |
32 | arg = EXTRACTOR_plugin_remove (arg, "png"); | 51 | arg = EXTRACTOR_plugin_remove (arg, "png"); |
33 | if (arg != NULL) | 52 | if (NULL != arg) |
34 | { | 53 | { |
35 | fprintf (stderr, | 54 | fprintf (stderr, |
36 | "add-remove test failed!\n"); | 55 | "add-remove test failed!\n"); |
@@ -38,3 +57,5 @@ main (int argc, char *argv[]) | |||
38 | } | 57 | } |
39 | return 0; | 58 | return 0; |
40 | } | 59 | } |
60 | |||
61 | /* end of test_plugin_loading.c */ | ||
diff --git a/src/main/test_trivial.c b/src/main/test_trivial.c index fc23f0c..ba699bf 100644 --- a/src/main/test_trivial.c +++ b/src/main/test_trivial.c | |||
@@ -1,3 +1,23 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2002, 2003, 2004, 2005, 2006, 2009 Vidyut Samanta and Christian Grothoff | ||
4 | |||
5 | libextractor is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libextractor is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with libextractor; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
1 | /** | 21 | /** |
2 | * @file main/test_trivial.c | 22 | * @file main/test_trivial.c |
3 | * @brief trivial testcase for libextractor plugin loading | 23 | * @brief trivial testcase for libextractor plugin loading |
@@ -11,8 +31,7 @@ testLoadPlugins (enum EXTRACTOR_Options policy) | |||
11 | { | 31 | { |
12 | struct EXTRACTOR_PluginList *pl; | 32 | struct EXTRACTOR_PluginList *pl; |
13 | 33 | ||
14 | pl = EXTRACTOR_plugin_add_defaults (policy); | 34 | if (NULL == (pl = EXTRACTOR_plugin_add_defaults (policy))) |
15 | if (pl == NULL) | ||
16 | { | 35 | { |
17 | fprintf (stderr, | 36 | fprintf (stderr, |
18 | "Failed to load default plugins!\n"); | 37 | "Failed to load default plugins!\n"); |
@@ -33,3 +52,5 @@ main (int argc, char *argv[]) | |||
33 | ret += testLoadPlugins (EXTRACTOR_OPTION_OUT_OF_PROCESS_NO_RESTART); | 52 | ret += testLoadPlugins (EXTRACTOR_OPTION_OUT_OF_PROCESS_NO_RESTART); |
34 | return ret; | 53 | return ret; |
35 | } | 54 | } |
55 | |||
56 | /* end of test_trivial.c */ | ||
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 1167545..186f12c 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am | |||
@@ -82,3 +82,9 @@ libextractor_png_la_LIBADD = \ | |||
82 | $(top_builddir)/src/common/libextractor_common.la | 82 | $(top_builddir)/src/common/libextractor_common.la |
83 | 83 | ||
84 | EXTRA_DIST = template_extractor.c | 84 | EXTRA_DIST = template_extractor.c |
85 | |||
86 | if HAVE_ZZUF | ||
87 | fuzz_tests=fuzz_default.sh fuzz_thumbnail.sh | ||
88 | endif | ||
89 | |||
90 | TESTS = $(fuzz_tests) \ No newline at end of file | ||
diff --git a/src/main/fuzz_default.sh b/src/plugins/fuzz_default.sh index 2387bd6..2387bd6 100755 --- a/src/main/fuzz_default.sh +++ b/src/plugins/fuzz_default.sh | |||
diff --git a/src/main/fuzz_thumbnail.sh b/src/plugins/fuzz_thumbnail.sh index 3de22c3..3de22c3 100755 --- a/src/main/fuzz_thumbnail.sh +++ b/src/plugins/fuzz_thumbnail.sh | |||