beagle r4616 - trunk/testsuite/bludgeon



Author: dbera
Date: Tue Mar 18 19:04:33 2008
New Revision: 4616
URL: http://svn.gnome.org/viewvc/beagle?rev=4616&view=rev

Log:
Merge bludgeon changes made in trunk:4611. Detect whether beagled is local or global in the bludgeon shell script and use the local one, if available (remember, bludgeon is _not_ installed).


Modified:
   trunk/testsuite/bludgeon/Bludgeon.cs
   trunk/testsuite/bludgeon/Bzip2FileObject.cs
   trunk/testsuite/bludgeon/Daemon.cs
   trunk/testsuite/bludgeon/DirectoryObject.cs
   trunk/testsuite/bludgeon/FileSystemObject.cs
   trunk/testsuite/bludgeon/GzipFileObject.cs
   trunk/testsuite/bludgeon/SanityCheck.cs
   trunk/testsuite/bludgeon/TarFileObject.cs
   trunk/testsuite/bludgeon/TextFileObject.cs
   trunk/testsuite/bludgeon/ZipFileObject.cs
   trunk/testsuite/bludgeon/beagled.dummy
   trunk/testsuite/bludgeon/bludgeon.in

Modified: trunk/testsuite/bludgeon/Bludgeon.cs
==============================================================================
--- trunk/testsuite/bludgeon/Bludgeon.cs	(original)
+++ trunk/testsuite/bludgeon/Bludgeon.cs	Tue Mar 18 19:04:33 2008
@@ -159,10 +159,10 @@
 
 			root = CreateTestRoot ();
 			TreeBuilder.Build (root,
-					   30,    // three directories
-					   100,   // ten files
-					   0.1,   // no archives
-					   0.5,   // archive decay, which does nothing here
+					   30,    // number of directories
+					   100,   // number of files
+					   0, //0.1,   // no archives
+					   0, //0.5,   // archive decay, which does nothing here
 					   false, // build all directories first, not in random order
 					   null); // no need to track events
 			if (! root.VerifyOnDisk ())

Modified: trunk/testsuite/bludgeon/Bzip2FileObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/Bzip2FileObject.cs	(original)
+++ trunk/testsuite/bludgeon/Bzip2FileObject.cs	Tue Mar 18 19:04:33 2008
@@ -20,10 +20,10 @@
 			AddChild (bzip2ed_file, null);
 		}
 
-		override protected string GetChildUri (FileSystemObject children)
+		override protected Uri GetChildUri (FileSystemObject children)
 		{
 			// FIXME: What is the uri scheme for bzip2 files?
-			return this.Uri + "#" + children.Name;
+			return new Uri (this.Uri.ToString () + "#" + children.Name);
 		}
 
 		override public string MimeType {
@@ -40,7 +40,7 @@
 				throw new Exception ("Bzip2 file " + Uri + " has " + ChildCount + " children");
 
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 
 			UnclosableStream unclosable;
 			unclosable = new UnclosableStream (stream);

Modified: trunk/testsuite/bludgeon/Daemon.cs
==============================================================================
--- trunk/testsuite/bludgeon/Daemon.cs	(original)
+++ trunk/testsuite/bludgeon/Daemon.cs	Tue Mar 18 19:04:33 2008
@@ -128,7 +128,7 @@
 			beagled = Environment.GetEnvironmentVariable ("BEAGLED_COMMAND");
 
 			string args;
-			args = "--debug-memory --bg --allow-backend files";
+			args = "--debug-memory --bg --backend Files";
 
 			if (UseHeapBuddy)
 				args += " --heap-buddy";

Modified: trunk/testsuite/bludgeon/DirectoryObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/DirectoryObject.cs	(original)
+++ trunk/testsuite/bludgeon/DirectoryObject.cs	Tue Mar 18 19:04:33 2008
@@ -47,15 +47,17 @@
 			}
 		}
 
-		override protected string GetChildUri (FileSystemObject child)
+		override protected Uri GetChildUri (FileSystemObject child)
 		{
-			return Path.Combine (this.Uri, child.Name);
+			string s = Path.Combine (UriFu.UriToEscapedString (this.Uri), child.Name);
+			//Console.WriteLine ("Asked to combine {0} and {1} = {2}", UriFu.UriToEscapedString (this.Uri), child.Name, s);
+			return UriFu.EscapedStringToUri (s);
 		}
 
-		override public string Uri {
+		override public Uri Uri {
 			get {
 				if (is_root)
-					return "file://" + root_path;
+					return UriFu.PathToFileUri (root_path);
 				return base.Uri;
 			}
 		}
@@ -164,7 +166,7 @@
 			}
 
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 
 			// Recursively add the children
 			foreach (FileSystemObject fso in children.Values)

Modified: trunk/testsuite/bludgeon/FileSystemObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/FileSystemObject.cs	(original)
+++ trunk/testsuite/bludgeon/FileSystemObject.cs	Tue Mar 18 19:04:33 2008
@@ -18,8 +18,7 @@
 
 	abstract public class FileSystemObject {
 
-		// TURN THIS ON TO TEST THE ARCHIVE PATCH!
-		static public bool SearchInArchives = false;
+		const bool SearchInArchives = true;
 
 		private static int next_id = 0;
 
@@ -184,15 +183,15 @@
 			get { return null; }
 		}
 
-		virtual protected string GetChildUri (FileSystemObject child)
+		virtual protected Uri GetChildUri (FileSystemObject child)
 		{
 			throw new Exception ("Invalid GetChildUri call");
 		}
 
-		virtual public string Uri {
+		virtual public Uri Uri {
 			get {
 				if (parent == null)
-					return "floating://" + Name;
+					return new Uri ("floating://" + Name);
 				return parent.GetChildUri (this);
 			}
 		}
@@ -229,7 +228,7 @@
 		public ICollection Children {
 			get {
 				if (children == null)
-					throw new Exception ("Invalid request for children on " + Uri);
+					throw new Exception ("Invalid request for children on " + Uri.ToString ());
 				return children.Values;
 			}
 		}
@@ -237,16 +236,16 @@
 		public FileSystemObject GetChild (string name)
 		{
 			if (children == null)
-				throw new Exception ("Invalid request for child '" + name + "' on " + Uri);
+				throw new Exception ("Invalid request for child '" + name + "' on " + Uri.ToString ());
 			return children [name] as FileSystemObject;
 		}
 
 		public virtual void AddChild (FileSystemObject child, EventTracker tracker)
 		{
 			if (children == null)
-				throw new Exception ("Can't add a child to " + Uri);
+				throw new Exception ("Can't add a child to " + Uri.ToString ());
 			if (child.parent != null)
-				throw new Exception ("Can't add parented child " + child.Uri + " to " + Uri);
+				throw new Exception ("Can't add parented child " + child.Uri.ToString () + " to " + Uri.ToString ());
 
 			// FIXME: Need to handle the case of the added child
 			// clobbering another w/ the same name.
@@ -261,11 +260,11 @@
 		public virtual void ClobberingAddChild (FileSystemObject child, FileSystemObject victim, EventTracker tracker)
 		{
 			if (children == null)
-				throw new Exception ("Can't add a child to " + Uri);
+				throw new Exception ("Can't add a child to " + Uri.ToString ());
 			if (child.parent != null)
-				throw new Exception ("Can't add parented child " + child.Uri + " to " + Uri);
+				throw new Exception ("Can't add parented child " + child.Uri.ToString () + " to " + Uri.ToString ());
 			if (victim.parent != this)
-				throw new Exception ("Victim " + victim.Uri + " is not a child of " + Uri);
+				throw new Exception ("Victim " + victim.Uri.ToString () + " is not a child of " + Uri.ToString ());
 			if (child.Extension != victim.Extension)
 				throw new Exception ("Extension mismatch: " + child.Extension + " vs. " + victim.Extension);
 
@@ -283,7 +282,7 @@
 		public virtual void RemoveChild (FileSystemObject child, EventTracker tracker)
 		{
 			if (child.parent != this)
-				throw new Exception (child.Uri + " is not a child of " + Uri);
+				throw new Exception (child.Uri.ToString () + " is not a child of " + Uri.ToString ());
 
 			if (IsRooted)
 				child.DeleteOnDisk (tracker);
@@ -295,7 +294,7 @@
 		public virtual void MoveChild (FileSystemObject child, FileSystemObject new_parent, EventTracker tracker)
 		{
 			if (child.parent != this)
-				throw new Exception (child.Uri + " is not a child of " + Uri);
+				throw new Exception (child.Uri.ToString () + " is not a child of " + Uri.ToString ());
 
 			if (new_parent == null || new_parent == child.parent)
 				return;
@@ -303,7 +302,7 @@
 			// We can't move child into new_parent if child is
 			// already above new_parent in the tree.
 			if (child.IsAncestorOf (new_parent))
-				throw new Exception ("Can't move " + child.Uri + " to " + new_parent.Uri);
+				throw new Exception ("Can't move " + child.Uri.ToString () + " to " + new_parent.Uri.ToString ());
 			
 			string old_full_name;
 			old_full_name = child.FullName;

Modified: trunk/testsuite/bludgeon/GzipFileObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/GzipFileObject.cs	(original)
+++ trunk/testsuite/bludgeon/GzipFileObject.cs	Tue Mar 18 19:04:33 2008
@@ -20,10 +20,10 @@
 			AddChild (gzipped_file, null);
 		}
 
-		override protected string GetChildUri (FileSystemObject children)
+		override protected Uri GetChildUri (FileSystemObject children)
 		{
 			// FIXME: What is the uri scheme for gzip files?
-			return this.Uri + "#" + children.Name;
+			return new Uri (this.Uri.ToString () + "#" + children.Name);
 		}
 
 		override public string MimeType {
@@ -40,7 +40,7 @@
 				throw new Exception ("Gzip file " + Uri + " has " + ChildCount + " children");
 
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 
 			UnclosableStream unclosable;
 			unclosable = new UnclosableStream (stream);

Modified: trunk/testsuite/bludgeon/SanityCheck.cs
==============================================================================
--- trunk/testsuite/bludgeon/SanityCheck.cs	(original)
+++ trunk/testsuite/bludgeon/SanityCheck.cs	Tue Mar 18 19:04:33 2008
@@ -29,10 +29,11 @@
 			success = true;
 
 			foreach (FileSystemObject fso in matching_fsos) {
-				if (matching_hits.Contains (fso.Uri))
-					matching_hits.Remove (fso.Uri);
+				string uri = UriFu.UriToEscapedString (fso.Uri);
+				if (matching_hits.Contains (uri))
+					matching_hits.Remove (uri);
 				else {
-					Log.Failure ("Hit missing from beagled query results: {0}", fso.Uri);
+					Log.Failure ("Hit missing from beagled query results: {0}", uri);
 					success = false;
 				}
 			}

Modified: trunk/testsuite/bludgeon/TarFileObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/TarFileObject.cs	(original)
+++ trunk/testsuite/bludgeon/TarFileObject.cs	Tue Mar 18 19:04:33 2008
@@ -31,10 +31,10 @@
 			}
 		}
 
-		override protected string GetChildUri (FileSystemObject children)
+		override protected Uri GetChildUri (FileSystemObject children)
 		{
 			// FIXME: What is the uri scheme for tar files?
-			return this.Uri + "#" + children.Name;
+			return new Uri (this.Uri.ToString () + "#" + children.Name);
 		}
 
 		override public string MimeType {
@@ -91,7 +91,7 @@
 		override public void AddToStream (Stream stream, EventTracker tracker)
 		{
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 
 			UnclosableStream unclosable;
 			unclosable = new UnclosableStream (stream);

Modified: trunk/testsuite/bludgeon/TextFileObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/TextFileObject.cs	(original)
+++ trunk/testsuite/bludgeon/TextFileObject.cs	Tue Mar 18 19:04:33 2008
@@ -32,7 +32,7 @@
 		override public void AddToStream (Stream stream, EventTracker tracker)
 		{
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 			
 			// We can't just use a StreamWriter here, since that
 			// will close the underlying stream when it gets

Modified: trunk/testsuite/bludgeon/ZipFileObject.cs
==============================================================================
--- trunk/testsuite/bludgeon/ZipFileObject.cs	(original)
+++ trunk/testsuite/bludgeon/ZipFileObject.cs	Tue Mar 18 19:04:33 2008
@@ -26,10 +26,10 @@
 			}
 		}
 
-		override protected string GetChildUri (FileSystemObject children)
+		override protected Uri GetChildUri (FileSystemObject children)
 		{
 			// FIXME: What is the uri scheme for zip files?
-			string uri = this.Uri + "#" + children.Name;
+			Uri uri = new Uri (this.Uri.ToString () + "#" + children.Name);
 			return uri;
 		}
 
@@ -80,7 +80,7 @@
 		override public void AddToStream (Stream stream, EventTracker tracker)
 		{
 			if (tracker != null)
-				tracker.ExpectingAdded (this.Uri);
+				tracker.ExpectingAdded (UriFu.UriToEscapedString (this.Uri));
 
 			UnclosableStream unclosable;
 			unclosable = new UnclosableStream (stream);

Modified: trunk/testsuite/bludgeon/beagled.dummy
==============================================================================
--- trunk/testsuite/bludgeon/beagled.dummy	(original)
+++ trunk/testsuite/bludgeon/beagled.dummy	Tue Mar 18 19:04:33 2008
@@ -5,5 +5,9 @@
 #
 # We need to do this since we are running uninstalled.
 
-cd ../beagled
+if [ ! -d ../../beagle/beagled ] || [ ! -e ../../beagle/beagled/BeagleDaemon.exe ]; then
+    echo "Local beagled not found at ../../beagle/beagled/. Exiting."
+fi
+
+cd ../../beagle/beagled
 ./beagled $BLUDGEON_EXTRA_ARGS $@

Modified: trunk/testsuite/bludgeon/bludgeon.in
==============================================================================
--- trunk/testsuite/bludgeon/bludgeon.in	(original)
+++ trunk/testsuite/bludgeon/bludgeon.in	Tue Mar 18 19:04:33 2008
@@ -1,25 +1,24 @@
 #! bash@
 
-if [ -e ./@target@ ] && [ -e ./Makefile.am ] ; then
-    echo "*** Running uninstalled @target@ ***"
-    THIS_PATH="../Util:../BeagleClient:."
-    THIS_EXE="./@target@"
+# Check if beagle source is in the right place
+if [ -d ../../beagle/beagled ] && [ -e ../../beagle/beagled/Makefile.am ] && [ -e ../../beagle/beagled/BeagleDaemon.exe ]; then
+    echo "*** Running with uninstalled beagled ***"
+    BEAGLE_DIR="../../beagle"
+    THIS_PATH="$BEAGLE_DIR/Util:$BEAGLE_DIR/BeagleClient:."
 
     export BEAGLED_COMMAND="./beagled.dummy"
 
-    export MONO_PATH="../Util:../BeagleClient:$MONO_PATH"
-    export LD_LIBRARY_PATH="../glue/.libs:$LD_LIBRARY_PATH"
+    export MONO_PATH="$BEAGLE_DIR/Util:$BEAGLE_DIR/BeagleClient:$MONO_PATH"
 
-    export BEAGLE_FILTER_PATH="../Filters"
+    echo "mono path = $MONO_PATH"
+    export BEAGLE_FILTER_PATH="$BEAGLE_DIR/Filters"
 
 else
-    THIS_PATH="@pkglibdir@"
-    THIS_EXE="@pkglibdir@/@target@"
+    THIS_PATH="."
 
     export BEAGLED_COMMAND="beagled"
 
-    export MONO_PATH="@pkglibdir@:$MONO_PATH"
-    export LD_LIBRARY_PATH="@pkglibdir@:$LD_LIBRARY_PATH"
+    export MONO_PATH="@libdir@/beagle:$MONO_PATH"
 fi
 
 if [ -z "$BEAGLE_MONO_RUNTIME" ]; then
@@ -28,5 +27,7 @@
    echo "*** Using mono runtime at $BEAGLE_MONO_RUNTIME ***"
 fi
 
+THIS_EXE="./@target@"
+
 MONO_PATH="$THIS_PATH:$MONO_PATH" exec $BEAGLE_MONO_RUNTIME --debug $MONO_EXTRA_ARGS $THIS_EXE "$@"
 



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