public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Test 6621; fexe on a process with a deleted executable.
@ 2008-06-12 14:00 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-06-12 14:00 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  29cf509f4c2e62437f34c7bee2be1c29f9d4935b (commit)
      from  09ad908a40a267c243caa418f18cb40b98991694 (commit)

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

- Log -----------------------------------------------------------------
commit 29cf509f4c2e62437f34c7bee2be1c29f9d4935b
Author: Andrew Cagney <cagney@toil.yyz.redhat.com>
Date:   Thu Jun 12 09:56:31 2008 -0400

    Test 6621; fexe on a process with a deleted executable.
    
    frysk-core/frysk/bindir/ChangeLog
    2008-06-12  Andrew Cagney  <cagney@redhat.com>
    
    	* TestFexe.java (testExeOfDeletedFile()): New; mark as unresolved
    	6621.
    
    frysk-sys/frysk/expunit/ChangeLog
    2008-06-12  Andrew Cagney  <cagney@redhat.com>
    
    	* TestExpect (testShell()): New.
    	* Expect.java (Expect()): New.
    
    frysk-sys/frysk/testbed/ChangeLog
    2008-06-12  Andrew Cagney  <cagney@redhat.com>
    
    	* TearDownExpect.java (TearDownExpect()): Add.

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

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog           |    5 +++++
 frysk-core/frysk/bindir/TestFexe.java       |   26 ++++++++++++++++++++++++++
 frysk-sys/frysk/expunit/ChangeLog           |    5 +++++
 frysk-sys/frysk/expunit/Expect.java         |   11 +++++++++++
 frysk-sys/frysk/expunit/TestExpect.java     |    9 +++++++++
 frysk-sys/frysk/testbed/ChangeLog           |    4 ++++
 frysk-sys/frysk/testbed/TearDownExpect.java |    4 ++++
 7 files changed, 64 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index 29df5ba..5f57822 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-12  Andrew Cagney  <cagney@redhat.com>
+
+	* TestFexe.java (testExeOfDeletedFile()): New; mark as unresolved
+	6621.
+
 2008-06-10  Andrew Cagney  <cagney@redhat.com>
 
 	* TestFstack.java (testBackTraceWithFullPath): Specify "paths",
diff --git a/frysk-core/frysk/bindir/TestFexe.java b/frysk-core/frysk/bindir/TestFexe.java
index 6f79c80..d5aba64 100644
--- a/frysk-core/frysk/bindir/TestFexe.java
+++ b/frysk-core/frysk/bindir/TestFexe.java
@@ -39,6 +39,7 @@
 
 package frysk.bindir;
 
+import frysk.testbed.TearDownFile;
 import frysk.testbed.TearDownExpect;
 import frysk.testbed.TestLib;
 import frysk.config.Prefix;
@@ -87,4 +88,29 @@ public class TestFexe extends TestLib {
 	e.expect("/bin/bash" + "\r\n");
     }
 
+    public void testExeOfDeletedFile() {
+	if (unresolved(6621))
+	    return;
+	TearDownExpect e = new TearDownExpect();
+	TearDownFile exe = TearDownFile.create();
+	// Create a copy of sleep that is executable.
+	e.send("cp /bin/sleep " + exe.getPath() + "\r");
+	e.expect("cp .*\\$ ");
+	e.send("chmod +x " + exe.getPath() + "\r");
+	e.expect("chmod .*\\$ ");
+	// Start sleep running; pid is in $!, save it.
+	e.send(exe.getAbsolutePath() + " 1000 &\r");
+	e.send("pid=$! ; echo pid=$pid\r");
+	e.expect("pid=[0-9]+\r\n\\$ ");
+	// Try fexe with the executable present.
+	e.send(Prefix.binFile("fexe").getPath() + " $pid\r");
+	e.expect(exe.getName() + "\r\n\\$ ");
+	// Delete the executable
+	e.send("rm -f " + exe.getPath() + "\r");
+	e.expect("\\$ ");
+	assertFalse("file exists", exe.stillExists());
+	// Try fexe with the executable deleted
+	e.send(Prefix.binFile("fexe").getPath() + " $pid\r");
+	e.expect(exe.getName() + " \\(deleted\\)\r\n\\$ ");
+    }
 }
diff --git a/frysk-sys/frysk/expunit/ChangeLog b/frysk-sys/frysk/expunit/ChangeLog
index 3434555..b81903d 100644
--- a/frysk-sys/frysk/expunit/ChangeLog
+++ b/frysk-sys/frysk/expunit/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-12  Andrew Cagney  <cagney@redhat.com>
+
+	* TestExpect (testShell()): New.
+	* Expect.java (Expect()): New.
+
 2008-03-11  Andrew Cagney  <cagney@redhat.com>
 
 	* Child.java: Use LogFinest.
diff --git a/frysk-sys/frysk/expunit/Expect.java b/frysk-sys/frysk/expunit/Expect.java
index 1d07b91..d2542f6 100644
--- a/frysk-sys/frysk/expunit/Expect.java
+++ b/frysk-sys/frysk/expunit/Expect.java
@@ -91,6 +91,17 @@ public class Expect {
     }
 
     /**
+     * Create a bash shell sitting at a prompt.
+     */
+    public Expect() {
+	this(new String[] {
+		"/bin/bash", "-c",
+		"export PS1=$\\ ; export PS2=>\\ ; exec /bin/bash --norc --noprofile"
+	    });
+	expect("\\$ ");
+    }
+
+    /**
      * Clean up.
      *
      * XXX: This drains all outstanding WAITPID events, and SIGCHLD
diff --git a/frysk-sys/frysk/expunit/TestExpect.java b/frysk-sys/frysk/expunit/TestExpect.java
index 32bd302..b7b2f83 100644
--- a/frysk-sys/frysk/expunit/TestExpect.java
+++ b/frysk-sys/frysk/expunit/TestExpect.java
@@ -151,4 +151,13 @@ public class TestExpect
 	    });
 	assertEquals ("brk mode", "-brkint", g.toString ());
     }
+
+    public void testShell() {
+	Expect e = new Expect();
+	// send a command, check that all, especially the prompt, are
+	// correct.
+	e.send("echo hi\r");
+	e.expect("echo hi\r\nhi\r\n\\$ ");
+    }
+
 }
diff --git a/frysk-sys/frysk/testbed/ChangeLog b/frysk-sys/frysk/testbed/ChangeLog
index 60bdb8a..ff3c2a9 100644
--- a/frysk-sys/frysk/testbed/ChangeLog
+++ b/frysk-sys/frysk/testbed/ChangeLog
@@ -1,3 +1,7 @@
+2008-06-12  Andrew Cagney  <cagney@redhat.com>
+
+	* TearDownExpect.java (TearDownExpect()): Add.
+
 2008-06-06  Andrew Cagney  <cagney@redhat.com>
 
 	* LocalMemory.java (getModuleName()): New.
diff --git a/frysk-sys/frysk/testbed/TearDownExpect.java b/frysk-sys/frysk/testbed/TearDownExpect.java
index 0e50faf..7bbdcfb 100644
--- a/frysk-sys/frysk/testbed/TearDownExpect.java
+++ b/frysk-sys/frysk/testbed/TearDownExpect.java
@@ -65,6 +65,10 @@ public class TearDownExpect extends Expect {
 	super(command);
 	add(this);
     }
+    public TearDownExpect() {
+	super();
+	add(this);
+    }
 
     /**
      * Collection of expect classes.


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


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

only message in thread, other threads:[~2008-06-12 14:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-12 14:00 [SCM] master: Test 6621; fexe on a process with a deleted executable 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).