public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Add absolutePath versus relative guard test.
@ 2008-03-05  0:03 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2008-03-05  0:03 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  79400a6b6d06ba2a36277ffd27326aac38cff336 (commit)
      from  8e6e5493dbea1a24856b4dd70bbeeeff95903819 (commit)

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

- Log -----------------------------------------------------------------
commit 79400a6b6d06ba2a36277ffd27326aac38cff336
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Wed Mar 5 00:02:59 2008 +0000

    Add absolutePath versus relative guard test.
    
    2008-03-04  Phil Muldoon  <pmuldoon@redhat.com>
    
           * TestLinuxCore.java (testRelativePath): New.

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

Summary of changes:
 frysk-core/frysk/proc/dead/ChangeLog          |    2 +
 frysk-core/frysk/proc/dead/TestLinuxCore.java |   73 +++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index da0bf18..12c2afe 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,5 +1,7 @@
 2008-03-04  Phil Muldoon  <pmuldoon@redhat.com>
 
+	* TestLinuxCore.java (testRelativePath): New.
+
 	* LinuxCoreInfo.java (getExeFile): Return
 	a File derived from the absolute path.
 
diff --git a/frysk-core/frysk/proc/dead/TestLinuxCore.java b/frysk-core/frysk/proc/dead/TestLinuxCore.java
index a128c33..519f7dc 100644
--- a/frysk-core/frysk/proc/dead/TestLinuxCore.java
+++ b/frysk-core/frysk/proc/dead/TestLinuxCore.java
@@ -75,6 +75,79 @@ public class TestLinuxCore extends TestLib {
     private Proc coreProc
 	= LinuxCoreFactory.createProc(Config.getPkgDataFile("test-core-x86"));
 
+
+    public void testRelativePath() {
+
+	// Test a relative path. This exercises sourcware bz 5864.
+	// Providing a relative path with the backing executable
+	// causes the find elf map to fail. It manifests itself
+	// when an stacktrace is performed.
+
+	Proc ackProc = giveMeAProc();
+	File coreFileName = new File(constructCore(ackProc));
+
+	// Get pwd of Test runner.
+	File countPath = new File(System.getProperty("user.dir"));
+
+	// Calculate how many legs in the path from root to
+	// Test runner, and add one '../' per segment.
+	String segment = countPath.getParent();
+	StringBuffer relativeIntro = new StringBuffer();
+	while (segment != null) {
+	    relativeIntro.append("../");
+	    countPath = new File(segment);
+	    segment = countPath.getParent();
+	}
+
+	// Build relative exe path, and model core.
+	countPath = new File(relativeIntro+ackProc.getExe());
+	Proc coreProc = LinuxCoreFactory.createProc(coreFileName, countPath);
+
+	// Guard: Build a stack trace. If a relative path is not being
+	// converted to an absolute path in the Corefile code, the
+	// backtrace will fail as it infers that ../foo/bar is not a
+	// file (see 5864) and refers to the maps as an internal map
+	// with no backing file. If a backtrace is built, then the
+	// relative -> absolute converstion is occuring.
+	StacktraceAction coreStacktrace;
+	StringWriter coreStackOutput = new StringWriter();
+	PrintStackOptions options = new PrintStackOptions();
+	options.setNumberOfFrames(20);
+	options.setElfOnly(true);
+
+	// Create a stackktrace of a the corefile process
+	coreStacktrace = new StacktraceAction(new PrintWriter(coreStackOutput),
+					      coreProc, 
+					      new PrintEvent(),options)
+	    {
+		
+		public void addFailed (Object observable, Throwable w)
+		{
+		    fail("Proc add failed: " + w.getMessage());
+		}
+	    };
+	
+	// And run ....
+	new ProcCoreAction(coreProc, coreStacktrace);
+	assertRunUntilStop("Perform corefile Backtrace");
+
+	String mainThread = "Task #\\d+\n" + 
+	    "(#[\\d]+ 0x[\\da-f]+ in .*\n)*"
+	    + "#[\\d]+ 0x[\\da-f]+ in server \\(\\).*\n"
+	    + "#[\\d]+ 0x[\\da-f]+ in main \\(\\).*\n"
+	    + "#[\\d]+ 0x[\\da-f]+ in __libc_start_main \\(\\).*\n"
+	    + "#[\\d]+ 0x[\\da-f]+ in _start \\(\\).*\n\n";
+
+	String regex = new String();
+	regex += "(" + mainThread + ")";
+
+	String result = coreStackOutput.getBuffer().toString();
+	
+	assertTrue(result + "should match: " + regex + " threads",
+               result.matches(regex));
+	
+    }
+
     public void testLinuxCoreFileMaps() {
 	// Remove the hasIsa test as on -r test runs the singleton
 	// maintains reference in between runs.


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


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

only message in thread, other threads:[~2008-03-05  0:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05  0:03 [SCM] master: Add absolutePath versus relative guard test pmuldoon

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).