aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-08-02 19:59:13 +0000
committerChristian Grothoff <christian@grothoff.org>2012-08-02 19:59:13 +0000
commitb014ab4deffd627b55f654a07408c13c9e7a5b96 (patch)
treeee5272bd8c2d7f4f5c6f4417da8c4b4b420fd4fc
parent15d3cc42d0780fb0178c2d0073d38e500890a836 (diff)
downloadlibextractor-b014ab4deffd627b55f654a07408c13c9e7a5b96.tar.gz
libextractor-b014ab4deffd627b55f654a07408c13c9e7a5b96.zip
-make tests less verbose if they pass, also remove dependency on src/plugins/
-rw-r--r--src/main/extractor_ipc_gnu.c5
-rw-r--r--src/main/extractor_plugpath.c21
-rw-r--r--src/main/test_ipc.c4
-rw-r--r--src/main/test_plugin_load_multi.c7
-rw-r--r--src/main/test_plugin_loading.c27
-rw-r--r--src/main/test_trivial.c8
6 files changed, 35 insertions, 37 deletions
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c
index 6803381..06e2ad3 100644
--- a/src/main/extractor_ipc_gnu.c
+++ b/src/main/extractor_ipc_gnu.c
@@ -154,9 +154,6 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size)
154 "%slibextractor-shm-%u-%u", 154 "%slibextractor-shm-%u-%u",
155 tpath, getpid (), 155 tpath, getpid (),
156 (unsigned int) RANDOM()); 156 (unsigned int) RANDOM());
157 LOG ("Creating shared memory `%s' with %u bytes capacity\n",
158 shm->shm_name,
159 (unsigned int) size);
160 if (-1 == (shm->shm_id = shm_open (shm->shm_name, 157 if (-1 == (shm->shm_id = shm_open (shm->shm_name,
161 O_RDWR | O_CREAT, S_IRUSR | S_IWUSR))) 158 O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)))
162 { 159 {
@@ -207,8 +204,6 @@ EXTRACTOR_IPC_shared_memory_change_rc_ (struct EXTRACTOR_SharedMemory *shm,
207void 204void
208EXTRACTOR_IPC_shared_memory_destroy_ (struct EXTRACTOR_SharedMemory *shm) 205EXTRACTOR_IPC_shared_memory_destroy_ (struct EXTRACTOR_SharedMemory *shm)
209{ 206{
210 LOG ("Destroying shared memory `%s'\n",
211 shm->shm_name);
212 munmap (shm->shm_ptr, shm->shm_size); 207 munmap (shm->shm_ptr, shm->shm_size);
213 (void) close (shm->shm_id); 208 (void) close (shm->shm_id);
214 (void) shm_unlink (shm->shm_name); 209 (void) shm_unlink (shm->shm_name);
diff --git a/src/main/extractor_plugpath.c b/src/main/extractor_plugpath.c
index 17859c1..c8abff9 100644
--- a/src/main/extractor_plugpath.c
+++ b/src/main/extractor_plugpath.c
@@ -501,7 +501,6 @@ find_plugin_in_path (void *cls,
501 struct SearchContext *sc = cls; 501 struct SearchContext *sc = cls;
502 DIR *dir; 502 DIR *dir;
503 struct dirent *ent; 503 struct dirent *ent;
504 const char *la;
505 const char *sym_name; 504 const char *sym_name;
506 char *sym; 505 char *sym;
507 char *dot; 506 char *dot;
@@ -514,12 +513,8 @@ find_plugin_in_path (void *cls,
514 { 513 {
515 if ('.' == ent->d_name[0]) 514 if ('.' == ent->d_name[0])
516 continue; 515 continue;
517 if ( ( (NULL != (la = strstr (ent->d_name, ".la"))) && 516 if ( (NULL == strstr (ent->d_name, ".so")) &&
518 ('\0' == la[3]) ) || 517 (NULL == strstr (ent->d_name, ".dll")) )
519 ( (NULL != (la = strstr (ent->d_name, ".ver"))) &&
520 (la[4] == '\0') ) ||
521 ( (NULL != (la = strstr (ent->d_name, ".a"))) &&
522 (la[2] == '\0') ) )
523 continue; /* only load '.so' and '.dll' */ 518 continue; /* only load '.so' and '.dll' */
524 if (NULL == (sym_name = strrchr (ent->d_name, '_'))) 519 if (NULL == (sym_name = strrchr (ent->d_name, '_')))
525 continue; 520 continue;
@@ -592,7 +587,6 @@ load_plugins_from_dir (void *cls,
592 struct DefaultLoaderContext *dlc = cls; 587 struct DefaultLoaderContext *dlc = cls;
593 DIR *dir; 588 DIR *dir;
594 struct dirent *ent; 589 struct dirent *ent;
595 const char *la;
596 const char *sym_name; 590 const char *sym_name;
597 char *sym; 591 char *sym;
598 char *dot; 592 char *dot;
@@ -603,14 +597,9 @@ load_plugins_from_dir (void *cls,
603 { 597 {
604 if (ent->d_name[0] == '.') 598 if (ent->d_name[0] == '.')
605 continue; 599 continue;
606 if ( ( (NULL != (la = strstr (ent->d_name, ".la"))) && 600 if ( (NULL == strstr (ent->d_name, ".so")) &&
607 (la[3] == '\0') ) || 601 (NULL == strstr (ent->d_name, ".dll")) )
608 ( (NULL != (la = strstr (ent->d_name, ".ver"))) &&
609 (la[4] == '\0') ) ||
610 ( (NULL != (la = strstr (ent->d_name, ".a"))) &&
611 (la[2] == '\0')) )
612 continue; /* only load '.so' and '.dll' */ 602 continue; /* only load '.so' and '.dll' */
613
614 if (NULL == (sym_name = strrchr (ent->d_name, '_'))) 603 if (NULL == (sym_name = strrchr (ent->d_name, '_')))
615 continue; 604 continue;
616 sym_name++; 605 sym_name++;
@@ -622,8 +611,6 @@ load_plugins_from_dir (void *cls,
622 } 611 }
623 if (NULL != (dot = strchr (sym, '.'))) 612 if (NULL != (dot = strchr (sym, '.')))
624 *dot = '\0'; 613 *dot = '\0';
625 LOG ("Adding default plugin `%s'\n",
626 sym);
627 dlc->res = EXTRACTOR_plugin_add (dlc->res, 614 dlc->res = EXTRACTOR_plugin_add (dlc->res,
628 sym, 615 sym,
629 NULL, 616 NULL,
diff --git a/src/main/test_ipc.c b/src/main/test_ipc.c
index 3f263be..f50b453 100644
--- a/src/main/test_ipc.c
+++ b/src/main/test_ipc.c
@@ -96,7 +96,9 @@ process_replies (void *cls,
96 HLO, 96 HLO,
97 strlen (HLO))) ) 97 strlen (HLO))) )
98 { 98 {
99#if 0
99 fprintf (stderr, "Received '%s'\n", HLO); 100 fprintf (stderr, "Received '%s'\n", HLO);
101#endif
100 ret = 1; 102 ret = 1;
101 return 0; 103 return 0;
102 } 104 }
@@ -106,7 +108,9 @@ process_replies (void *cls,
106 GOB, 108 GOB,
107 strlen (GOB))) ) 109 strlen (GOB))) )
108 { 110 {
111#if 0
109 fprintf (stderr, "Received '%s'\n", GOB); 112 fprintf (stderr, "Received '%s'\n", GOB);
113#endif
110 ret = 0; 114 ret = 0;
111 return 1; 115 return 1;
112 } 116 }
diff --git a/src/main/test_plugin_load_multi.c b/src/main/test_plugin_load_multi.c
index 6fc064f..77646f6 100644
--- a/src/main/test_plugin_load_multi.c
+++ b/src/main/test_plugin_load_multi.c
@@ -57,6 +57,13 @@ main (int argc, char *argv[])
57{ 57{
58 int ret = 0; 58 int ret = 0;
59 59
60 /* change environment to find 'extractor_test' plugin which is
61 not installed but should be in the current directory (or .libs)
62 on 'make check' */
63 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/"))
64 fprintf (stderr,
65 "Failed to update my environment, plugin loading may fail: %s\n",
66 strerror (errno));
60 ret += testLoadPlugins (); 67 ret += testLoadPlugins ();
61 ret += testLoadPlugins (); 68 ret += testLoadPlugins ();
62 return ret; 69 return ret;
diff --git a/src/main/test_plugin_loading.c b/src/main/test_plugin_loading.c
index b789b08..f20f4b3 100644
--- a/src/main/test_plugin_loading.c
+++ b/src/main/test_plugin_loading.c
@@ -30,25 +30,22 @@ main (int argc, char *argv[])
30{ 30{
31 struct EXTRACTOR_PluginList *arg; 31 struct EXTRACTOR_PluginList *arg;
32 32
33 /* change environment to find 'extractor_test' plugin which is
34 not installed but should be in the current directory (or .libs)
35 on 'make check' */
36 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/"))
37 fprintf (stderr,
38 "Failed to update my environment, plugin loading may fail: %s\n",
39 strerror (errno));
40
33 /* do some load/unload tests */ 41 /* do some load/unload tests */
34 arg = EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); 42 arg = EXTRACTOR_plugin_add (NULL, "test", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
35 arg = EXTRACTOR_plugin_add (arg, "png", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); 43 if (arg != EXTRACTOR_plugin_add (arg, "test", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY))
36 arg = EXTRACTOR_plugin_add (arg, "zip", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
37 arg = EXTRACTOR_plugin_remove (arg, "mime");
38 arg = EXTRACTOR_plugin_remove (arg, "zip");
39 arg = EXTRACTOR_plugin_remove (arg, "png");
40 if (NULL != arg)
41 { 44 {
42 fprintf (stderr, 45 fprintf (stderr,
43 "add-remove test failed!\n"); 46 "Could load plugin twice, that should not be allowed\n");
44 return -1;
45 } 47 }
46 arg = EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY); 48 arg = EXTRACTOR_plugin_remove (arg, "test");
47 arg = EXTRACTOR_plugin_add (arg, "png", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
48 arg = EXTRACTOR_plugin_add (arg, "zip", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
49 arg = EXTRACTOR_plugin_remove (arg, "zip");
50 arg = EXTRACTOR_plugin_remove (arg, "mime");
51 arg = EXTRACTOR_plugin_remove (arg, "png");
52 if (NULL != arg) 49 if (NULL != arg)
53 { 50 {
54 fprintf (stderr, 51 fprintf (stderr,
diff --git a/src/main/test_trivial.c b/src/main/test_trivial.c
index ba699bf..e30e443 100644
--- a/src/main/test_trivial.c
+++ b/src/main/test_trivial.c
@@ -46,6 +46,14 @@ main (int argc, char *argv[])
46{ 46{
47 int ret = 0; 47 int ret = 0;
48 48
49
50 /* change environment to find 'extractor_test' plugin which is
51 not installed but should be in the current directory (or .libs)
52 on 'make check' */
53 if (0 != putenv ("LIBEXTRACTOR_PREFIX=." PATH_SEPARATOR_STR ".libs/"))
54 fprintf (stderr,
55 "Failed to update my environment, plugin loading may fail: %s\n",
56 strerror (errno));
49 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY); 57 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY);
50 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY); 58 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY);
51 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY); 59 ret += testLoadPlugins (EXTRACTOR_OPTION_DEFAULT_POLICY);