[tracker/miner-fs-refactor: 7/110] libtracker-miner, tests: avoid aligning backslash in Makefile.am



commit 3838a636ab1859677a1027c593f9f21da18b3ae3
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Wed Aug 3 12:18:10 2011 +0200

    libtracker-miner, tests: avoid aligning backslash in Makefile.am

 tests/libtracker-client/tracker-test               |  148 ++++++++++++++++++++
 tests/libtracker-miner/Makefile.am                 |   59 ++++----
 .../libtracker-miner/tracker-indexing-tree-test.c  |  113 +++++++++++++++
 3 files changed, 290 insertions(+), 30 deletions(-)
---
diff --git a/tests/libtracker-client/tracker-test b/tests/libtracker-client/tracker-test
new file mode 100755
index 0000000..2911e86
--- /dev/null
+++ b/tests/libtracker-client/tracker-test
@@ -0,0 +1,148 @@
+#! /bin/bash
+
+# tracker-test - temporary wrapper script for .libs/tracker-test
+# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3
+#
+# The tracker-test program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='/bin/sed -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command="(cd /home/aleksander/Development/gnome/tracker.upstream/tests/libtracker-client; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games; export PATH; gcc -ggdb -O0 -DMTIME_CACHE_ENABLE_TRACE -DEVENT_QUEUE_ENABLE_TRACE -o \$progdir/\$file tracker-test.o -pthread  ../../src/libtracker-client/.libs/libtracker-client-0.10.so ../../src/libtracker-common/.libs/libtracker-common.so -L/usr/lib/i386-linux-gnu /us
 r/lib/i386-linux-gnu/libgio-2.0.so /usr/lib/i386-linux-gnu/libgmodule-2.0.so -ldbus-glib-1 -ldbus-1 -lpthread /usr/lib/i386-linux-gnu/libgobject-2.0.so /usr/lib/i386-linux-gnu/libgthread-2.0.so -lrt /usr/lib/i386-linux-gnu/libglib-2.0.so -pthread -Wl,-rpath -Wl,/home/aleksander/Development/gnome/tracker.upstream/src/libtracker-client/.libs -Wl,-rpath -Wl,/home/aleksander/Development/gnome/tracker.upstream/src/libtracker-common/.libs -Wl,-rpath -Wl,/usr/lib/tracker-0.10)"
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='2.2.6b'
+  notinst_deplibs=' ../../src/libtracker-client/libtracker-client-0.10.la ../../src/libtracker-common/libtracker-common.la'
+else
+  # When we are sourced in execute mode, $file and $ECHO are already set.
+  if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+    ECHO="echo"
+    file="$0"
+    # Make sure echo works.
+    if test "X$1" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+      # Yippee, $ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe $ECHO will work.
+      exec /bin/bash "$0" --no-reexec ${1+"$@"}
+    fi
+  fi
+
+  # Find the directory that this script lives in.
+  thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+  test "x$thisdir" = "x$file" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
+  while test -n "$file"; do
+    destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+
+    # If there was a directory component, then change thisdir.
+    if test "x$destdir" != "x$file"; then
+      case "$destdir" in
+      [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+      *) thisdir="$thisdir/$destdir" ;;
+      esac
+    fi
+
+    file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
+    file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
+  done
+
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+  if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
+    # special case for '.'
+    if test "$thisdir" = "."; then
+      thisdir=`pwd`
+    fi
+    # remove .libs from thisdir
+    case "$thisdir" in
+    *[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
+    .libs )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=`cd "$thisdir" && pwd`
+  test -n "$absdir" && thisdir="$absdir"
+
+  program=lt-'tracker-test'
+  progdir="$thisdir/.libs"
+
+  if test ! -f "$progdir/$program" ||
+     { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \
+       test "X$file" != "X$progdir/$program"; }; then
+
+    file="$$-$program"
+
+    if test ! -d "$progdir"; then
+      mkdir "$progdir"
+    else
+      rm -f "$progdir/$file"
+    fi
+
+    # relink executable if necessary
+    if test -n "$relink_command"; then
+      if relink_command_output=`eval $relink_command 2>&1`; then :
+      else
+	echo "$relink_command_output" >&2
+	rm -f "$progdir/$file"
+	exit 1
+      fi
+    fi
+
+    mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
+    { rm -f "$progdir/$program";
+      mv -f "$progdir/$file" "$progdir/$program"; }
+    rm -f "$progdir/$file"
+  fi
+
+  if test -f "$progdir/$program"; then
+    if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+      # Run the actual program with our arguments.
+
+      exec "$progdir/$program" ${1+"$@"}
+
+      $ECHO "$0: cannot exec $program $*" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
+    $ECHO "This script is just a wrapper for $program." 1>&2
+    echo "See the libtool documentation for more information." 1>&2
+    exit 1
+  fi
+fi
diff --git a/tests/libtracker-miner/Makefile.am b/tests/libtracker-miner/Makefile.am
index 7dbf0ef..a6567a1 100644
--- a/tests/libtracker-miner/Makefile.am
+++ b/tests/libtracker-miner/Makefile.am
@@ -25,23 +25,23 @@ TEST_PROGS +=                                          \
 	tracker-priority-queue-test		       \
 	tracker-task-pool-test
 
-AM_CPPFLAGS =                                          \
-	$(BUILD_CFLAGS)                                \
-	-DTEST                                         \
-	-DLIBEXEC_PATH=\""$(libexecdir)"\"             \
+AM_CPPFLAGS = \
+	$(BUILD_CFLAGS) \
+	-DTEST \
+	-DLIBEXEC_PATH=\""$(libexecdir)"\" \
 	-DTEST_DATA_DIR=\""$(abs_top_srcdir)/tests/libtracker-miner/data"\" \
 	-DTEST_MINERS_DIR=\""$(abs_top_srcdir)/tests/libtracker-miner/mock-miners"\" \
-	-I$(top_srcdir)/src                            \
-	-I$(top_builddir)/src                          \
-	-I$(top_srcdir)/tests/common                   \
+	-I$(top_srcdir)/src \
+	-I$(top_builddir)/src \
+	-I$(top_srcdir)/tests/common \
 	$(LIBTRACKER_MINER_CFLAGS)
 
-LDADD =                                                \
+LDADD = \
 	$(top_builddir)/src/libtracker-miner/libtracker-miner- TRACKER_API_VERSION@.la \
 	$(top_builddir)/src/libtracker-miner/libtracker-miner-private.la \
 	$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql- TRACKER_API_VERSION@.la \
 	$(top_builddir)/src/libtracker-common/libtracker-common.la \
-	$(BUILD_LIBS)                                  \
+	$(BUILD_LIBS) \
 	$(LIBTRACKER_MINER_LIBS)
 
 libtracker_miner_tests_la_VALAFLAGS =                  \
@@ -63,29 +63,28 @@ libtracker_miner_tests_la_LIBADD = 		       \
 	$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql- TRACKER_API_VERSION@.la \
 	$(BUILD_LIBS)
 
-
-tracker_crawler_test_SOURCES =                         \
+tracker_crawler_test_SOURCES = \
 	tracker-crawler-test.c
 
-tracker_miner_manager_test_SOURCES =                   \
-	tracker-miner-manager-test.c                   \
-	miners-mock.c                                  \
+tracker_miner_manager_test_SOURCES = \
+	tracker-miner-manager-test.c \
+	miners-mock.c \
 	empty-gobject.c
 
-tracker_miner_manager_test_LDADD =                     \
-	libtracker-miner-tests.la                      \
+tracker_miner_manager_test_LDADD = \
+	libtracker-miner-tests.la \
 	$(LDADD)
 
-tracker_password_provider_test_SOURCES =               \
+tracker_password_provider_test_SOURCES = \
 	tracker-password-provider-test.c
 
-tracker_password_provider_test_LDADD =                 \
-	libtracker-miner-tests.la                      \
+tracker_password_provider_test_LDADD = \
+	libtracker-miner-tests.la \
 	$(LDADD)
 
-tracker_thumbnailer_test_SOURCES =                     \
-	tracker-thumbnailer-test.c                     \
-	thumbnailer-mock.c                             \
+tracker_thumbnailer_test_SOURCES = \
+	tracker-thumbnailer-test.c \
+	thumbnailer-mock.c \
 	empty-gobject.c
 
 tracker_monitor_test_SOURCES =                         \
@@ -111,14 +110,14 @@ noinst_HEADERS =                                       \
 	miners-mock.h                                  \
 	empty-gobject.h
 
-BUILT_SOURCES =                                        \
+BUILT_SOURCES = \
 	libtracker_miner_tests_la_vala.stamp
 
-EXTRA_DIST =                                           \
-	data/empty-dir/.hidden                         \
-	data/file1                                     \
-	data/dir/empty-dir/.hidden                     \
-	data/dir/file1                                 \
-	data/dir/file2                                 \
-	mock-miners/mock-miner-1.desktop               \
+EXTRA_DIST = \
+	data/empty-dir/.hidden \
+	data/file1 \
+	data/dir/empty-dir/.hidden \
+	data/dir/file1 \
+	data/dir/file2 \
+	mock-miners/mock-miner-1.desktop \
 	mock-miners/mock-miner-2.desktop
diff --git a/tests/libtracker-miner/tracker-indexing-tree-test.c b/tests/libtracker-miner/tracker-indexing-tree-test.c
new file mode 100644
index 0000000..9bac491
--- /dev/null
+++ b/tests/libtracker-miner/tracker-indexing-tree-test.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2011, Nokia <ivan frade nokia com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <tracker-indexing-tree.h>
+
+static void
+test_indexing_tree_recursive (void)
+{
+	TrackerIndexingTree *tree;
+	GFile *recursive;
+	GFile *aux;
+
+	tree = tracker_indexing_tree_new ();
+
+	recursive = g_file_new_for_path ("/home/user/Music");
+	tracker_indexing_tree_add (tree,
+	                           recursive,
+	                           (TRACKER_DIRECTORY_FLAG_MONITOR | TRACKER_DIRECTORY_FLAG_RECURSE));
+
+	aux = g_file_new_for_path ("/home/user/Music/Album");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/File.mp3");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/Album/Artist");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/Artist/File.mp3");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+	g_object_unref (aux);
+
+
+	g_object_unref (aux);
+	g_object_unref (tree);
+}
+
+static void
+test_indexing_tree_non_recursive (void)
+{
+	TrackerIndexingTree *tree;
+	GFile *recursive;
+	GFile *aux;
+
+	tree = tracker_indexing_tree_new ();
+
+	recursive = g_file_new_for_path ("/home/user/Music");
+	tracker_indexing_tree_add (tree,
+	                           recursive,
+	                           (TRACKER_DIRECTORY_FLAG_MONITOR);
+
+	aux = g_file_new_for_path ("/home/user/Music/Album");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/File.mp3");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/Album/Artist");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == FALSE);
+	g_object_unref (aux);
+
+	aux = g_file_new_for_path ("/home/user/Music/Artist/File.mp3");
+	g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == FALSE);
+	g_object_unref (aux);
+
+	g_object_unref (aux);
+	g_object_unref (tree);
+}
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+	g_thread_init (NULL);
+	g_type_init ();
+	g_test_init (&argc, &argv, NULL);
+
+	g_test_message ("Testing indexing tree");
+
+	g_test_add_func ("/libtracker-miner/tracker-indexing-tree/recursive",
+	                 test_indexing_tree_recursive);
+	g_test_add_func ("/libtracker-miner/tracker-indexing-tree/non-recursive",
+	                 test_indexing_tree_non_recursive);
+
+	return g_test_run ();
+}



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