public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Add "kappa" to expected list.
@ 2008-03-19  1:46 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-03-19  1:46 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  0189082059eba3c2acfb0b36bb838f01a12fc198 (commit)
       via  6caee51cf4d23d92d58dbd511b884125fb35dd56 (commit)
       via  6518bcc1d0b0309db8efa18e8baa1f7c0f6f28a7 (commit)
      from  7821ab11bdda699d0fc127060371de639968e157 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 0189082059eba3c2acfb0b36bb838f01a12fc198
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Mar 18 21:45:25 2008 -0400

    Add "kappa" to expected list.
    
    frysk-core/frysk/expr/ChangeLog
    2008-03-18  Andrew Cagney  <cagney@redhat.com>
    
    	* TestCompletion.java (testCompleteStructMember()): Add "kappa" to
    	expected list.

commit 6caee51cf4d23d92d58dbd511b884125fb35dd56
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Mar 18 21:37:41 2008 -0400

    frysk-core/frysk/proc/live/ChangeLog
    2008-03-18  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxPtraceHost.java (removeProc(LinuxPtraceProc)): Replace
    	removeProc(ProcessIdentifier).
    	(addProc(LinuxPtraceProc)): Replace
    	addProc(ProcessIdentifier,LinuxPtraceProc).
    	* LinuxPtraceProcState.java (detached.handleRemove): Remove the
    	Proc from the Host.
    	* LinuxPtraceProc.java: Update.

commit 6518bcc1d0b0309db8efa18e8baa1f7c0f6f28a7
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Mar 18 20:56:33 2008 -0400

    Add test for repeated refreshes.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-03-18  Andrew Cagney  <cagney@redhat.com>
    
    	* TestRefresh.java (checkAdditionsAndRemovals(boolean)): Replace
    	checkAdditionAndRemoval.
    	* LinuxPtraceProc.java: Add more logging.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/expr/ChangeLog                    |    5 ++
 frysk-core/frysk/expr/TestCompletion.java          |    2 +-
 frysk-core/frysk/proc/live/ChangeLog               |   12 ++++
 frysk-core/frysk/proc/live/LinuxPtraceHost.java    |   19 +++---
 frysk-core/frysk/proc/live/LinuxPtraceProc.java    |    7 +-
 .../frysk/proc/live/LinuxPtraceProcState.java      |   52 +++++++++---------
 frysk-core/frysk/proc/live/TestRefresh.java        |   60 ++++++++++---------
 7 files changed, 89 insertions(+), 68 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/expr/ChangeLog b/frysk-core/frysk/expr/ChangeLog
index 20320ce..c600ad9 100644
--- a/frysk-core/frysk/expr/ChangeLog
+++ b/frysk-core/frysk/expr/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-18  Andrew Cagney  <cagney@redhat.com>
+
+	* TestCompletion.java (testCompleteStructMember()): Add "kappa" to
+	expected list.
+
 2008-03-18  Teresa Thomas  <tthomas@redhat.com>
 
 	* CExpr.g (ARITHMETIC_PLUS): New
diff --git a/frysk-core/frysk/expr/TestCompletion.java b/frysk-core/frysk/expr/TestCompletion.java
index 872ee6c..7586ea3 100644
--- a/frysk-core/frysk/expr/TestCompletion.java
+++ b/frysk-core/frysk/expr/TestCompletion.java
@@ -82,6 +82,6 @@ public class TestCompletion extends TestCase {
 	complete("b + a", 1, new String[] { "b1", "b2" }, 0);
     }
     public void testCompleteStructMember() {
-	complete("a.", new String[] { "alpha", "beta", "epsilon", "gamma", "iota" }, 2);
+	complete("a.", new String[] { "alpha", "beta", "epsilon", "gamma", "iota", "kappa" }, 2);
     }
 }
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index e7f386e..c269998 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,5 +1,17 @@
 2008-03-18  Andrew Cagney  <cagney@redhat.com>
 
+	* LinuxPtraceHost.java (removeProc(LinuxPtraceProc)): Replace
+	removeProc(ProcessIdentifier).
+	(addProc(LinuxPtraceProc)): Replace
+	addProc(ProcessIdentifier,LinuxPtraceProc).
+	* LinuxPtraceProcState.java (detached.handleRemove): Remove the
+	Proc from the Host.
+	* LinuxPtraceProc.java: Update.
+
+	* TestRefresh.java (checkAdditionsAndRemovals(boolean)): Replace
+	checkAdditionAndRemoval.
+	* LinuxPtraceProc.java: Add more logging.
+	
 	* TestTaskObserverBlocked.java (BlockedFibonacci): Register the
 	process with StopEventLoopWhenProcTerminated earlier.
 	* LinuxPtraceProc.java: Add more logging.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceHost.java b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
index febf665..b51449e 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceHost.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
@@ -96,30 +96,31 @@ public class LinuxPtraceHost extends LiveHost {
     LinuxPtraceProc getProc(ProcessIdentifier pid) {
 	return (LinuxPtraceProc) procs.get(pid);
     }
-    void addProc(ProcessIdentifier pid, LinuxPtraceProc proc) {
-	procs.put(pid, proc);
+    void addProc(LinuxPtraceProc proc) {
+	procs.put(proc.pid, proc);
     }
-    void removeProc(ProcessIdentifier pid) {
-	procs.remove(pid);
+    void removeProc(LinuxPtraceProc proc) {
+	procs.remove(proc.pid);
     }
 
     /**
-     * Either add or update a process, however, before doing that
-     * determine the parent and ensure that it has been updated.
+     * Either add or update the specified process, however, before
+     * doing that determine the parent and ensure that it has been
+     * updated.
      */
     private class ProcChanges {
 	/**
 	 * ADDED accumulates all the tasks added as things are
 	 * updated.
 	 */
-	List added = new LinkedList();
+	final List added = new LinkedList();
 
 	/**
 	 * REMOVED starts with the full list of processes and then
 	 * works backwards removing any that are processed, by the end
 	 * it contains processes that no longer exist.
 	 */
-	HashMap removed = (HashMap) procs.clone();
+	final HashMap removed = new HashMap(procs);
 
 	/**
 	 * Update PROCID, either adding it
@@ -208,7 +209,6 @@ public class LinuxPtraceHost extends LiveHost {
 	fine.log(this, "requestRefresh");
 	Manager.eventLoop.add(new Event() {
 		public void execute() {
-		    fine.log(LinuxPtraceHost.this, "execute - refresh");
 		    LinuxPtraceHost.this.executeRefresh(knownProcesses,
 							updates);
 		}
@@ -216,6 +216,7 @@ public class LinuxPtraceHost extends LiveHost {
     }
     private void executeRefresh(Collection knownProcesses,
 				HostRefreshBuilder builder) {
+	fine.log(LinuxPtraceHost.this, "executeRefresh");
 	ProcChanges procChanges = executeRefresh();
 	Collection exitedProcesses = procChanges.removed.values();
 	exitedProcesses.retainAll(knownProcesses);
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProc.java b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
index 8a5b7c2..9a93514 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProc.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
@@ -81,10 +81,10 @@ public class LinuxPtraceProc extends LiveProc {
     public LinuxPtraceProc(Host host, Proc parent,
 			   ProcessIdentifier pid, Stat stat) {
 	super(host, parent, pid);
-	((LinuxPtraceHost)host).addProc(ProcessIdentifierFactory.create(pid.hashCode()), this);
 	this.newState = LinuxPtraceProcState.initial(false);
 	this.stat = stat;
 	this.breakpoints = new BreakpointAddresses(this);
+	((LinuxPtraceHost)host).addProc(this);
     }
 
     /**
@@ -93,9 +93,9 @@ public class LinuxPtraceProc extends LiveProc {
      */
     public LinuxPtraceProc(Task task, ProcessIdentifier fork) {
 	super(task, fork);
-	((LinuxPtraceHost)getHost()).addProc(fork, this);
 	this.newState = LinuxPtraceProcState.initial(true);
 	this.breakpoints = new BreakpointAddresses(this);
+	((LinuxPtraceHost)getHost()).addProc(this);
     }
 
     void addTask(LinuxPtraceTask task) {
@@ -341,13 +341,12 @@ public class LinuxPtraceProc extends LiveProc {
     /**
      * (Internal) Tell the process that is no longer listed in the
      * system table remove itself.
-     *
-     * XXX: This should not be public.
      */
     void performRemoval() {
 	fine.log(this, "performRemoval -- no longer in /proc");
 	Manager.eventLoop.add(new ProcEvent() {
 		public void execute() {
+		    fine.log(LinuxPtraceProc.this, "execute - performRemoval");
 		    newState = oldState().handleRemoval(LinuxPtraceProc.this);
 		}
 	    });
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProcState.java b/frysk-core/frysk/proc/live/LinuxPtraceProcState.java
index 15bbe02..665c529 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProcState.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProcState.java
@@ -99,32 +99,32 @@ abstract class LinuxPtraceProcState extends State {
      * The process is running free (or at least was the last time its
      * status was checked).
      */
-    private static final LinuxPtraceProcState detached = new LinuxPtraceProcState ("detached")
-	{
-	    LinuxPtraceProcState handleRemoval(LinuxPtraceProc proc) {
-		fine.log("handleRemoval", proc); 
-		// XXX: What about a dieing proc's tasks, have a
-		// dieing state and force a proc refresh?
-		if (proc.parent != null)
-		    proc.parent.remove (proc);
-		return destroyed;
-	    }
-	    LinuxPtraceProcState handleAddObservation (LinuxPtraceProc proc,
-						       Observation observation) {
-	    	fine.log("handleAddObserver", proc); 
-	    	return Attaching.initialState (proc, observation);
-	    }
-
-	    LinuxPtraceProcState handleDeleteObservation (LinuxPtraceProc proc,
-					       Observation observation)
-	    {
-	    	fine.log("handleDeleteObservation", proc); 
-		// Must be bogus; if there were observations then the
-		// Proc wouldn't be in this state.
-		observation.fail (new RuntimeException ("not attached"));
-		return detached;
-	    }
-	};
+    private static final LinuxPtraceProcState detached
+	= new LinuxPtraceProcState ("detached") {
+		LinuxPtraceProcState handleRemoval(LinuxPtraceProc proc) {
+		    fine.log("handleRemoval", proc); 
+		    // XXX: What about a dieing proc's tasks, have a
+		    // dieing state and force a proc refresh?
+		    if (proc.parent != null)
+			proc.parent.remove (proc);
+		    // Take it out of the host's data-base.
+		    ((LinuxPtraceHost)proc.getHost()).removeProc(proc);
+		    return destroyed;
+		}
+		LinuxPtraceProcState handleAddObservation(LinuxPtraceProc proc,
+							  Observation observation) {
+		    fine.log("handleAddObserver", proc); 
+		    return Attaching.initialState (proc, observation);
+		}
+		LinuxPtraceProcState handleDeleteObservation(LinuxPtraceProc proc,
+							     Observation observation) {
+		    fine.log("handleDeleteObservation", proc); 
+		    // Must be bogus; if there were observations then the
+		    // Proc wouldn't be in this state.
+		    observation.fail (new RuntimeException ("not attached"));
+		    return detached;
+		}
+	    };
 
     /**
      * A process is being attached, this is broken down into
diff --git a/frysk-core/frysk/proc/live/TestRefresh.java b/frysk-core/frysk/proc/live/TestRefresh.java
index 76386dc..2b14f1a 100644
--- a/frysk-core/frysk/proc/live/TestRefresh.java
+++ b/frysk-core/frysk/proc/live/TestRefresh.java
@@ -56,12 +56,14 @@ import frysk.proc.Manager;
  */
 public class TestRefresh extends TestLib {
 
+    /**
+     * Bit-flags to indicate what processes should be found.
+     */
     private static final int PROCESSES = 1;
     private static final int DAEMONS = 2;
     private static final int NEW_PROCESSES = 4;
     private static final int EXITED_PROCESSES = 16;
 
-
     /**
      * Class to record a refresh; both saving the supplied updates,
      * and applying the updates to a local cache of the system.
@@ -164,48 +166,50 @@ public class TestRefresh extends TestLib {
      * Check that a host refresh detects a process addition then
      * removal.
      */
-    private void checkAdditionAndRemoval(boolean daemon) {
+    private void checkAdditionsAndRemovals(boolean daemon) {
 	HostState state = new HostState(host);
 	state.assertRefresh("before creating process");
 	
-	// Create a sub-process; check that while there are some
-	// processes this new one isn't known.
-	SlaveOffspring child;
-	if (daemon)
-	    child = SlaveOffspring.createDaemon();
-	else
-	    child = SlaveOffspring.createChild();
-	assertTrue("host.procPool non-empty", state.processes.size() > 0);
-	state.assertIn("refresh before child created", child, 0);
-
-	// Do a refresh, check that the process gets added.
-	state.assertRefresh("after child created");
-	state.assertIn("refresh after child created", child,
-		       PROCESSES | NEW_PROCESSES
-		       | (daemon ? DAEMONS : 0));
-
-	// Delete the process.
-	child.reap();
-
-	// Check that a further refresh removes the process, generates
-	// a removed event, and puts the proc into the removed state.
-	state.assertRefresh("after child exited");
-	state.assertIn("refresh after child exits", child,
-		       EXITED_PROCESSES);
+	for (int i = 0; i < 2; i++) {
+	    // Create a sub-process; check that while there are some
+	    // processes this new one isn't known.
+	    SlaveOffspring child;
+	    if (daemon)
+		child = SlaveOffspring.createDaemon();
+	    else
+		child = SlaveOffspring.createChild();
+	    assertTrue("host.procPool non-empty", state.processes.size() > 0);
+	    state.assertIn("refresh before child created", child, 0);
+	    
+	    // Do a refresh, check that the process gets added.
+	    state.assertRefresh("after child created");
+	    state.assertIn("refresh after child created", child,
+			   PROCESSES | NEW_PROCESSES
+			   | (daemon ? DAEMONS : 0));
+	    
+	    // Delete the process.
+	    child.reap();
+	    
+	    // Check that a further refresh removes the process, generates
+	    // a removed event, and puts the proc into the removed state.
+	    state.assertRefresh("after child exited");
+	    state.assertIn("refresh after child exits", child,
+			   EXITED_PROCESSES);
+	}
     }
 
     /**
      * Check a child creation/deletion.
      */
     public void testProcAdditionAndRemoval() {
-	checkAdditionAndRemoval(false);
+	checkAdditionsAndRemovals(false);
     }
 
     /**
      * Check a daemon creation/deletion.
      */
     public void testDaemonAdditionAndRemoval() {
-	checkAdditionAndRemoval(true);
+	checkAdditionsAndRemovals(true);
     }
 
     /**


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-19  1:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-19  1:46 [SCM] master: Add "kappa" to expected list cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).