public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Rely less on observableProcAddedXXX to find offspring. Date: Tue, 11 Mar 2008 21:22:00 -0000 [thread overview] Message-ID: <20080311212248.6259.qmail@sourceware.org> (raw) The branch, master has been updated via 7738b08136d36420784885c1bc19d260a936ade8 (commit) from 339efbdf21c71154f4927bb94915bf009bdba38e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 7738b08136d36420784885c1bc19d260a936ade8 Author: Andrew Cagney <cagney@redhat.com> Date: Tue Mar 11 17:21:37 2008 -0400 Rely less on observableProcAddedXXX to find offspring. frysk-core/frysk/proc/live/ChangeLog 2008-03-11 Andrew Cagney <cagney@redhat.com> * TestTaskObserverBlocked.java: Register offspring with TearDownProcess. frysk-core/frysk/testbed/ChangeLog 2008-03-11 Andrew Cagney <cagney@redhat.com> * TestLib.java (addToTearDown(Task)): New. (addToTearDown(Proc)): New. (setUp()): Check if Host.observableProcAddedXXX is null. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/live/ChangeLog | 3 + .../frysk/proc/live/TestTaskObserverBlocked.java | 63 ++++++++++---------- frysk-core/frysk/testbed/ChangeLog | 4 + frysk-core/frysk/testbed/TestLib.java | 45 ++++++++------ 4 files changed, 66 insertions(+), 49 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog index bbe5917..f747dea 100644 --- a/frysk-core/frysk/proc/live/ChangeLog +++ b/frysk-core/frysk/proc/live/ChangeLog @@ -1,5 +1,8 @@ 2008-03-11 Andrew Cagney <cagney@redhat.com> + * TestTaskObserverBlocked.java: Register offspring with + TearDownProcess. + * TestProcStopped.java: Update to match Offspring. * TestRuntimeIsa.java: Ditto. diff --git a/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java b/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java index e170aaa..8695532 100644 --- a/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java +++ b/frysk-core/frysk/proc/live/TestTaskObserverBlocked.java @@ -80,12 +80,12 @@ public class TestTaskObserverBlocked extends TestLib { { TaskSet attachedTasks = new TaskSet(); - public Action updateAttached (Task task) - { - attachedTasks.add(task); - Manager.eventLoop.requestStop(); - return Action.BLOCK; - } + public Action updateAttached(Task task) { + addToTearDown(task); + attachedTasks.add(task); + Manager.eventLoop.requestStop(); + return Action.BLOCK; + } } BlockAttached blockAttached = new BlockAttached(); @@ -194,26 +194,26 @@ public class TestTaskObserverBlocked extends TestLib { return Action.BLOCK; } - protected Action spawnedOffspring (Task parent, Task offspring) - { - fine.log(this, "spawnedOffspring"); - assertInState(SPAWN_PARENT); - nextState(SPAWN_OFFSPRING); - this.offspring = offspring; - Manager.eventLoop.requestStop(); - return Action.BLOCK; - } - - /** - * Officially attached to Task. - */ - public Action updateAttached (Task task) - { - assertInState(OBSERVER_ADDED_TO_CHILD); - nextState(CHILD_ATTACHED); - Manager.eventLoop.requestStop(); - return Action.BLOCK; - } + protected Action spawnedOffspring(Task parent, Task offspring) { + fine.log(this, "spawnedOffspring"); + addToTearDown(offspring); + assertInState(SPAWN_PARENT); + nextState(SPAWN_OFFSPRING); + this.offspring = offspring; + Manager.eventLoop.requestStop(); + return Action.BLOCK; + } + + /** + * Officially attached to Task. + */ + public Action updateAttached(Task task) { + addToTearDown(task); + assertInState(OBSERVER_ADDED_TO_CHILD); + nextState(CHILD_ATTACHED); + Manager.eventLoop.requestStop(); + return Action.BLOCK; + } /** * Create a new daemon process, attach to it's spawn observer (forked or @@ -415,6 +415,7 @@ public class TestTaskObserverBlocked extends TestLib { return Action.CONTINUE; } public Action updateForkedOffspring (Task parent, Task offspring) { + addToTearDown(offspring); offspring.requestUnblock(this); return Action.BLOCK; } @@ -471,11 +472,11 @@ public class TestTaskObserverBlocked extends TestLib { return Action.CONTINUE; } - public Action updateForkedOffspring (Task parent, Task offspring) - { - offspring.requestUnblock(this); - offspring.requestAddForkedObserver(this); - return Action.BLOCK; + public Action updateForkedOffspring (Task parent, Task offspring) { + addToTearDown(offspring); + offspring.requestUnblock(this); + offspring.requestAddForkedObserver(this); + return Action.BLOCK; } } UnblockAdd observer = new UnblockAdd(); diff --git a/frysk-core/frysk/testbed/ChangeLog b/frysk-core/frysk/testbed/ChangeLog index d167f0b..7e43be5 100644 --- a/frysk-core/frysk/testbed/ChangeLog +++ b/frysk-core/frysk/testbed/ChangeLog @@ -1,5 +1,9 @@ 2008-03-11 Andrew Cagney <cagney@redhat.com> + * TestLib.java (addToTearDown(Task)): New. + (addToTearDown(Proc)): New. + (setUp()): Check if Host.observableProcAddedXXX is null. + * ProcCounter.java: Delete. * StopEventLoopWhenProcTerminated.java: Rename diff --git a/frysk-core/frysk/testbed/TestLib.java b/frysk-core/frysk/testbed/TestLib.java index 4d32b61..d877969 100644 --- a/frysk-core/frysk/testbed/TestLib.java +++ b/frysk-core/frysk/testbed/TestLib.java @@ -42,6 +42,7 @@ package frysk.testbed; import frysk.sys.ProcessIdentifier; import frysk.sys.ProcessIdentifierFactory; import frysk.proc.Proc; +import frysk.proc.Task; import frysk.proc.Host; import frysk.proc.Manager; import frysk.dwfl.DwflCache; @@ -184,6 +185,15 @@ public class TestLib extends TestCase { return findProc.proc; } + protected static void addToTearDown(Task task) { + fine.log("addToTearDown", task); + TearDownProcess.add(ProcessIdentifierFactory.create(task.getTid())); + } + protected static void addToTearDown(Proc proc) { + fine.log("addToTearDown", proc); + TearDownProcess.add(ProcessIdentifierFactory.create(proc.getPid())); + } + /** * The host being used by the current test. */ @@ -203,27 +213,26 @@ public class TestLib extends TestCase { // directly registers its process. That is to ensure that // children that never get entered into the process tree also // get registered with TearDownProcess. - host.observableProcAddedXXX.addObserver(new Observer() { - public void update (Observable o, Object obj) { - Proc proc = (Proc) obj; - if (isChildOfMine(proc)) { - TearDownProcess.add - (ProcessIdentifierFactory.create(proc.getPid())); - return; - } - Proc parent = proc.getParent(); - if (parent != null) { - ProcessIdentifier parentPid - = ProcessIdentifierFactory.create(proc.getParent() - .getPid()); - if (TearDownProcess.contains(parentPid)) { - TearDownProcess.add(ProcessIdentifierFactory - .create(proc.getPid())); + if (host.observableProcAddedXXX != null) + host.observableProcAddedXXX.addObserver(new Observer() { + public void update (Observable o, Object obj) { + Proc proc = (Proc) obj; + if (isChildOfMine(proc)) { + addToTearDown(proc); return; } + Proc parent = proc.getParent(); + if (parent != null) { + ProcessIdentifier parentPid + = ProcessIdentifierFactory.create(proc.getParent() + .getPid()); + if (TearDownProcess.contains(parentPid)) { + addToTearDown(proc); + return; + } + } } - } - }); + }); fine.log(this, "<<<<<<<<<<<<<<<< end setUp"); } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-03-11 21:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080311212248.6259.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).