public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: cagney@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Valid tear-down pids.
Date: Tue, 11 Mar 2008 19:23:00 -0000	[thread overview]
Message-ID: <20080311192319.5548.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  537514afa8afe63a15d3a06d916b6c6bc3160881 (commit)
      from  43df9a4df62a43b27be1b15451df67d42e37f896 (commit)

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

- Log -----------------------------------------------------------------
commit 537514afa8afe63a15d3a06d916b6c6bc3160881
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Mar 11 15:22:08 2008 -0400

    Valid tear-down pids.
    
    frysk-sys/frysk/testbed/ChangeLog
    2008-03-11  Andrew Cagney  <cagney@redhat.com>
    
    	* TestTearDownProcess.java (testInvalidPid()): New.
    	(testInitPid()): New.
    	* TearDownProcess.java (add(ProcessIdentifier)): Validate PID.

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

Summary of changes:
 frysk-sys/frysk/testbed/ChangeLog                |    6 ++++++
 frysk-sys/frysk/testbed/TearDownProcess.java     |    4 +++-
 frysk-sys/frysk/testbed/TestTearDownProcess.java |   19 +++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/frysk-sys/frysk/testbed/ChangeLog b/frysk-sys/frysk/testbed/ChangeLog
index 6e0a8f6..e461a0c 100644
--- a/frysk-sys/frysk/testbed/ChangeLog
+++ b/frysk-sys/frysk/testbed/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-11  Andrew Cagney  <cagney@redhat.com>
+
+	* TestTearDownProcess.java (testInvalidPid()): New.
+	(testInitPid()): New.
+	* TearDownProcess.java (add(ProcessIdentifier)): Validate PID.
+
 2008-02-13  Andrew Cagney  <cagney@redhat.com>
 
 	* TearDownProcess.java: Update to match frysk.sys.Wait.
diff --git a/frysk-sys/frysk/testbed/TearDownProcess.java b/frysk-sys/frysk/testbed/TearDownProcess.java
index f74104e..f13d1d6 100644
--- a/frysk-sys/frysk/testbed/TearDownProcess.java
+++ b/frysk-sys/frysk/testbed/TearDownProcess.java
@@ -76,7 +76,9 @@ public class TearDownProcess {
 	fine.log("add", pid);
 	// Had better not try to register process one.
 	if (pid.intValue() == 1)
-	    throw new RuntimeException("killing process one during teardown");
+	    throw new RuntimeException("teardown init process: " + pid);
+	if (pid.intValue() <= 0)
+	    throw new RuntimeException("teardown process invalid: " + pid);
 	pidsToKillDuringTearDown.add(pid);
     }
 
diff --git a/frysk-sys/frysk/testbed/TestTearDownProcess.java b/frysk-sys/frysk/testbed/TestTearDownProcess.java
index c6104fb..f713305 100644
--- a/frysk-sys/frysk/testbed/TestTearDownProcess.java
+++ b/frysk-sys/frysk/testbed/TestTearDownProcess.java
@@ -47,6 +47,7 @@ import frysk.sys.Signal;
 import frysk.sys.UnhandledWaitBuilder;
 import frysk.sys.SignalBuilder;
 import frysk.sys.ProcessIdentifier;
+import frysk.sys.ProcessIdentifierFactory;
 
 public class TestTearDownProcess
     extends TestCase
@@ -68,6 +69,24 @@ public class TestTearDownProcess
 	assertGone(pid);
     }
 
+    public void testInvalidPid() {
+	ProcessIdentifier zero = ProcessIdentifierFactory.create(0);
+	try {
+	    TearDownProcess.add(zero);
+	    fail("add of zero should not succeed");
+	} catch (RuntimeException e) {
+	}
+    }
+
+    public void testInitPid() {
+	ProcessIdentifier init = ProcessIdentifierFactory.create(1);
+	try {
+	    TearDownProcess.add(init);
+	    fail("add of init should not succeed");
+	} catch (RuntimeException e) {
+	}
+    }
+
     public void testForkPtraceAttached() {
 	ProcessIdentifier pid = Fork.ptrace(new String[] { "/bin/true" });
 	long maxTime = System.currentTimeMillis() + getTimeoutMilliseconds();


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


                 reply	other threads:[~2008-03-11 19:23 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=20080311192319.5548.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: link
Be 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).