tracker r3183 - in trunk: . tests/tracker-extract tests/tracker-extract/data/mp3
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r3183 - in trunk: . tests/tracker-extract tests/tracker-extract/data/mp3
- Date: Tue, 7 Apr 2009 11:10:38 +0000 (UTC)
Author: mottela
Date: Tue Apr 7 11:10:37 2009
New Revision: 3183
URL: http://svn.gnome.org/viewvc/tracker?rev=3183&view=rev
Log:
Load the extractors as modules for tests instead of directly linking
Modified:
trunk/ChangeLog
trunk/tests/tracker-extract/Makefile.am
trunk/tests/tracker-extract/data/mp3/access_1.mp3
trunk/tests/tracker-extract/data/mp3/access_2.mp3
trunk/tests/tracker-extract/data/mp3/access_3.mp3
trunk/tests/tracker-extract/data/mp3/access_4.mp3
trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c
trunk/tests/tracker-extract/tracker-extract-jpeg-test.c
trunk/tests/tracker-extract/tracker-extract-mp3-test.c
trunk/tests/tracker-extract/tracker-extract-png-test.c
trunk/tests/tracker-extract/tracker-extract-test-utils.c
trunk/tests/tracker-extract/tracker-extract-test-utils.h
trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c
trunk/tests/tracker-extract/tracker-extract-testsuite-generic.h
trunk/tests/tracker-extract/tracker-extract-tiff-test.c
Modified: trunk/tests/tracker-extract/Makefile.am
==============================================================================
--- trunk/tests/tracker-extract/Makefile.am (original)
+++ trunk/tests/tracker-extract/Makefile.am Tue Apr 7 11:10:37 2009
@@ -1,5 +1,7 @@
include $(top_srcdir)/Makefile.decl
+modulesdir = $(libdir)/tracker/extract-modules
+
noinst_PROGRAMS = $(TEST_PROGS)
TEST_PROGS += \
@@ -23,6 +25,7 @@
INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
+ -DMODULESDIR=\"$(modulesdir)\" \
-DTEST_DATA_DIR=\""$(abs_top_builddir)/tests/tracker-extract/data"\"\
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
@@ -56,7 +59,6 @@
$(TEST_UTILS_SOURCES)
test_tracker_extract_mp3_LDADD = \
- $(top_builddir)/src/tracker-extract/libextract-mp3.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(GMODULE_LIBS) \
$(GCOV_LIBS) \
@@ -68,7 +70,6 @@
$(TEST_UTILS_SOURCES)
test_tracker_extract_gstreamer_LDADD = \
- $(top_builddir)/src/tracker-extract/libextract-gstreamer.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(GMODULE_LIBS) \
$(GCOV_LIBS) \
@@ -81,7 +82,6 @@
$(TEST_UTILS_SOURCES)
test_tracker_extract_jpeg_LDADD = \
- $(top_builddir)/src/tracker-extract/libextract-jpeg.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
@@ -96,7 +96,6 @@
$(TEST_UTILS_SOURCES)
test_tracker_extract_tiff_LDADD = \
- $(top_builddir)/src/tracker-extract/libextract-tiff.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
@@ -110,7 +109,6 @@
$(TEST_UTILS_SOURCES)
test_tracker_extract_png_LDADD = \
- $(top_builddir)/src/tracker-extract/libextract-png.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
Modified: trunk/tests/tracker-extract/data/mp3/access_1.mp3
==============================================================================
Binary files. No diff available.
Modified: trunk/tests/tracker-extract/data/mp3/access_2.mp3
==============================================================================
Binary files. No diff available.
Modified: trunk/tests/tracker-extract/data/mp3/access_3.mp3
==============================================================================
Binary files. No diff available.
Modified: trunk/tests/tracker-extract/data/mp3/access_4.mp3
==============================================================================
Binary files. No diff available.
Modified: trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c Tue Apr 7 11:10:37 2009
@@ -33,6 +33,8 @@
int
main (int argc, char **argv) {
+ TrackerExtractData *data;
+ gchar *path;
gint result;
g_type_init ();
@@ -40,13 +42,15 @@
g_test_init (&argc, &argv, NULL);
g_test_message ("Testing extract functionality");
- g_test_add_func ("/tracker-extract/tracker-extract-gstreamer/check-extract-data",
- test_tracker_extract_check_extract_data);
-#if 1
- TrackerExtractData *data;
-
- data = tracker_test_extract_get_extract ("audio/mpeg");
+ path = g_build_filename (MODULESDIR, "libextract-gstreamer", NULL);
+ data = tracker_test_extract_get_extract (path, "audio/mpeg");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/check-extract-data",
+ data, test_tracker_extract_check_extract_data);
+
+#if 1
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/mp3/id3v1_basic",
data, test_tracker_extract_mp3_id3v1_basic);
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/mp3/id3v23_basic",
@@ -58,15 +62,18 @@
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/mp3/header_sampling",
data, test_tracker_extract_mp3_header_sampling);
- data = tracker_test_extract_get_extract ("video/avi");
-
- g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/avi/basic_tags",
- data, test_tracker_extract_avi_basic_tags);
-
if (g_test_perf()) {
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/mp3/performance_cbr",
data, test_tracker_extract_mp3_performance);
}
+
+ path = g_build_filename (MODULESDIR, "libextract-gstreamer", NULL);
+ data = tracker_test_extract_get_extract (path, "video/avi");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/avi/basic_tags",
+ data, test_tracker_extract_avi_basic_tags);
+
#endif
Modified: trunk/tests/tracker-extract/tracker-extract-jpeg-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-jpeg-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-jpeg-test.c Tue Apr 7 11:10:37 2009
@@ -32,6 +32,8 @@
int
main (int argc, char **argv) {
+ TrackerExtractData *data;
+ gchar *path;
gint result;
g_type_init ();
@@ -39,12 +41,15 @@
g_test_init (&argc, &argv, NULL);
g_test_message ("Testing extract functionality");
- g_test_add_func ("/tracker-extract/tracker-extract-jpeg/check-extract-data",
- test_tracker_extract_check_extract_data);
-
-#if 0
- data = tracker_test_extract_get_extract ("image/jpeg");
+ path = g_build_filename (MODULESDIR, "libextract-jpeg", NULL);
+ data = tracker_test_extract_get_extract (path, "image/jpeg");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/check-extract-data",
+ data, test_tracker_extract_check_extract_data);
+
+#if 1
g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/basic_size",
data, test_tracker_extract_jpeg_basic_size);
@@ -62,7 +67,7 @@
if (g_test_perf()) {
g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/performance",
- data, performance_tracker_extract_jpeg);
+ data, test_tracker_extract_jpeg_performance);
}
#endif
Modified: trunk/tests/tracker-extract/tracker-extract-mp3-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-mp3-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-mp3-test.c Tue Apr 7 11:10:37 2009
@@ -34,6 +34,7 @@
main (int argc, char **argv) {
TrackerExtractData *data;
+ gchar *path;
gint result;
g_type_init ();
@@ -41,16 +42,18 @@
g_test_init (&argc, &argv, NULL);
g_test_message ("Testing extract functionality");
- g_test_add_func ("/tracker-extract/tracker-extract-mp3/check-extract-data",
- test_tracker_extract_check_extract_data);
- data = tracker_test_extract_get_extract ("audio/mpeg");
+ path = g_build_filename (MODULESDIR, "libextract-mp3", NULL);
+ data = tracker_test_extract_get_extract (path, "audio/mpeg");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/check-extract-data",
+ data, test_tracker_extract_check_extract_data);
g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/access",
- data,
- test_tracker_extract_mp3_access);
+ data, test_tracker_extract_mp3_access);
-#if 0
+#if 1
g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v1_basic",
data, test_tracker_extract_mp3_id3v1_basic);
Modified: trunk/tests/tracker-extract/tracker-extract-png-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-png-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-png-test.c Tue Apr 7 11:10:37 2009
@@ -32,6 +32,8 @@
int
main (int argc, char **argv) {
+ TrackerExtractData *data;
+ gchar *path;
gint result;
g_type_init ();
@@ -39,12 +41,15 @@
g_test_init (&argc, &argv, NULL);
g_test_message ("Testing extract functionality");
- g_test_add_func ("/tracker-extract/tracker-extract-png/check-extract-data",
- test_tracker_extract_check_extract_data);
-#if 0
- data = tracker_test_extract_get_extract ("image/png");
+ path = g_build_filename (MODULESDIR, "libextract-png", NULL);
+ data = tracker_test_extract_get_extract (path, "image/png");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-png/check-extract-data",
+ data, test_tracker_extract_check_extract_data);
+#if 0
g_test_add_data_func ("/tracker-extract/tracker-extract-png/basic_size",
data, test_tracker_extract_png_basic_size);
Modified: trunk/tests/tracker-extract/tracker-extract-test-utils.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-test-utils.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-test-utils.c Tue Apr 7 11:10:37 2009
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <glib/gstdio.h>
+#include <gmodule.h>
#include "tracker-extract-test-utils.h"
@@ -148,26 +149,52 @@
}
TrackerExtractData *
-tracker_test_extract_get_extract (const gchar *mime)
+tracker_test_extract_get_extract (const gchar *path, const gchar *mime)
{
TrackerExtractData *data;
-
+ TrackerExtractData *data_iter;
+ GModule *module;
+ TrackerExtractDataFunc func;
+ GError *error;
+
+ if (!g_module_supported ()) {
+ g_error ("Modules are not supported for this platform");
+ return NULL;
+ }
+
+ error = NULL;
+
+ module = g_module_open (path, G_MODULE_BIND_LOCAL);
+ if (!module) {
+ g_error ("Could not load module '%s': %s", path, g_module_error ());
+ return NULL;
+ }
+
+ g_module_make_resident (module);
+
+ if (g_module_symbol (module, "tracker_get_extract_data", (gpointer *) &func)) {
+ data = (func) ();
+ } else {
+ g_error ("Could not get accesspoint to the module");
+ return;
+ }
+
/* Search for exact match first */
- data = tracker_get_extract_data ();
- while (data->mime) {
- if (strcmp (data->mime, mime) == 0) {
- return data;
+ data_iter = data;
+ while (data_iter->mime) {
+ if (strcmp (data_iter->mime, mime) == 0) {
+ return data_iter;
}
- data++;
+ data_iter++;
}
/* Search for generic */
- data = tracker_get_extract_data ();
- while (data->mime) {
- if (g_pattern_match_simple (data->mime, mime)) {
- return data;
+ data_iter = data;
+ while (data_iter->mime) {
+ if (g_pattern_match_simple (data_iter->mime, mime)) {
+ return data_iter;
}
- data++;
+ data_iter++;
}
return NULL;
Modified: trunk/tests/tracker-extract/tracker-extract-test-utils.h
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-test-utils.h (original)
+++ trunk/tests/tracker-extract/tracker-extract-test-utils.h Tue Apr 7 11:10:37 2009
@@ -29,7 +29,8 @@
#include <tracker-extract/tracker-main.h>
-TrackerExtractData *tracker_test_extract_get_extract (const gchar *mime);
+TrackerExtractData *tracker_test_extract_get_extract (const gchar *path,
+ const gchar *mime);
void tracker_test_extract_file (const TrackerExtractData *data,
const gchar *file,
const gchar *testdatafile);
Modified: trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c Tue Apr 7 11:10:37 2009
@@ -24,13 +24,11 @@
#include "tracker-extract-testsuite-generic.h"
void
-test_tracker_extract_check_extract_data (void)
+test_tracker_extract_check_extract_data (gconstpointer extract)
{
- TrackerExtractData *data;
+ const TrackerExtractData *data = extract;
guint extractors = 0;
- data = tracker_get_extract_data ();
-
while (data->mime) {
if (data->extract == NULL) {
g_error ("Extractor for mime '%s' declared NULL", data->mime);
Modified: trunk/tests/tracker-extract/tracker-extract-testsuite-generic.h
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-testsuite-generic.h (original)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-generic.h Tue Apr 7 11:10:37 2009
@@ -23,6 +23,6 @@
#include <tracker-extract/tracker-extract.h>
-void test_tracker_extract_check_extract_data (void);
+void test_tracker_extract_check_extract_data (gconstpointer data);
#endif
Modified: trunk/tests/tracker-extract/tracker-extract-tiff-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-tiff-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-tiff-test.c Tue Apr 7 11:10:37 2009
@@ -32,6 +32,8 @@
int
main (int argc, char **argv) {
+ TrackerExtractData *data;
+ gchar *path;
gint result;
g_type_init ();
@@ -39,12 +41,15 @@
g_test_init (&argc, &argv, NULL);
g_test_message ("Testing extract functionality");
- g_test_add_func ("/tracker-extract/tracker-extract-tiff/check-extract-data",
- test_tracker_extract_check_extract_data);
-
-#if 0
- data = tracker_test_extract_get_extract ("image/tiff");
+ path = g_build_filename (MODULESDIR, "libextract-tiff", NULL);
+ data = tracker_test_extract_get_extract (path, "image/tiff");
+ g_free (path);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-tiff/check-extract-data",
+ data, test_tracker_extract_check_extract_data);
+
+#if 1
g_test_add_data_func ("/tracker-extract/tracker-extract-tiff/basic_size",
data, test_tracker_extract_tiff_basic_size);
@@ -56,7 +61,7 @@
if (g_test_perf()) {
g_test_add_data_func ("/tracker-extract/tracker-extract-tiff/performance",
- data, performance_tracker_extract_tiff);
+ data, test_tracker_extract_tiff_performance);
}
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]