[SCM] master: Document testcase, add empty stacktrace test

pmuldoon@sourceware.org pmuldoon@sourceware.org
Mon Nov 19 13:14:00 GMT 2007


The branch, master has been updated
       via  e05a55a7ba2861173cb86e603b2e312f4c42b197 (commit)
      from  bbf660ad5f803e000274503ad878040f4d604fef (commit)

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

- Log -----------------------------------------------------------------
commit e05a55a7ba2861173cb86e603b2e312f4c42b197
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Mon Nov 19 13:14:25 2007 +0000

    Document testcase, add empty stacktrace test
    
    2007-11-19  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* TestLinuxCore.java (testLinuxCoreFileStackTrace): Rename
    	variables, document test case, check for empty stacktraces.
    	frysk-core/frysk/proc/dead/.#TestLinuxCore.java

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

Summary of changes:
 frysk-core/frysk/proc/dead/ChangeLog          |    4 +
 frysk-core/frysk/proc/dead/TestLinuxCore.java |   89 +++++++++++++++++--------
 2 files changed, 65 insertions(+), 28 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index 4d90ad6..191c1da 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,9 +1,13 @@
 2007-11-19  Phil Muldoon  <pmuldoon@redhat.com>
 
+	* TestLinuxCore.java (testLinuxCoreFileStackTrace): Rename
+	variables, document test case, check for empty stacktraces.
+	
 	* TestLinuxCore.java (testLinuxCoreFileStackTrace): Pass
 	executable location to LinuxHost. Fix 5352. Remove unresolved.
 	Fix 11-15 indention oops.
 
+
 2007-11-17  Andrew Cagney  <cagney@redhat.com>
 
 	* TestLinuxCore.java (testLinuxCoreFileStackTrace()): Mark as
diff --git a/frysk-core/frysk/proc/dead/TestLinuxCore.java b/frysk-core/frysk/proc/dead/TestLinuxCore.java
index 94f21ec..45eec06 100644
--- a/frysk-core/frysk/proc/dead/TestLinuxCore.java
+++ b/frysk-core/frysk/proc/dead/TestLinuxCore.java
@@ -134,19 +134,62 @@ public class TestLinuxCore
     return -1;
   }
 
+  /**
+   * Test that a corefile backtrace and a live process backtrace
+   * match on a blocked process
+   *
+   **/
   public void testLinuxCoreFileStackTrace () {
    
-    final Proc ackProc; // = giveMeAProc();
+    Proc testProc;
     
+    // Create a blocked process, blocked at a signal
     File exeFile = Config.getPkgLibFile("funit-stacks");
-    ackProc = new DaemonBlockedAtSignal(exeFile).getMainTask().getProc();
+    testProc = new DaemonBlockedAtSignal(exeFile).getMainTask().getProc();
+
 
+    StacktraceAction liveStacktrace;
+    StacktraceAction coreStacktrace;
+    StringWriter liveStackOutput = new StringWriter();
+    StringWriter coreStackOutput = new StringWriter();
 
-    StacktraceAction stacker;
-    StacktraceAction coreStack;
+    // Create a Stacktrace of the blocked live process
+    liveStacktrace = new StacktraceAction(new PrintWriter(liveStackOutput),
+					  testProc, 
+					  new RequestStopEvent(Manager.eventLoop), 
+					  true, false, false, false, false, false)
 
-    StringWriter stringWriter1 = new StringWriter();
-    stacker = new StacktraceAction(new PrintWriter(stringWriter1),ackProc, new RequestStopEvent(Manager.eventLoop), true, false,false, false, false, false)
+      {
+	
+	public void addFailed (Object observable, Throwable w)
+	{
+	  fail("Proc add failed: " + w.getMessage());
+	}
+      };
+
+    // And run ....
+    new ProcBlockAction (testProc, liveStacktrace);
+    assertRunUntilStop("Perform live process Backtrace");
+
+    // Check that the live process stacktrace acually produces
+    // something. If not there is a problem beyond this tests
+    // scope.
+    assertTrue("Live stack trace is not  empty", 
+	       liveStackOutput.getBuffer().length() > 0);
+
+    // Create a  corefile from blocked process, and model.
+    String coreFileName = constructCore(testProc);
+    File testCore = new File(coreFileName);
+    Host coreHost = new LinuxHost(Manager.eventLoop, 
+				  testCore, exeFile);
+    Proc coreProc = coreHost.getProc(new ProcId(testProc.getPid()));
+
+    // Create a stackktrace of a the corefile process
+    coreStacktrace = new StacktraceAction(new PrintWriter(coreStackOutput),
+					  coreProc, 
+					  new PrintEvent(),
+					  true, false, false, false , 
+					  false, false)
     {
 
       public void addFailed (Object observable, Throwable w)
@@ -155,31 +198,21 @@ public class TestLinuxCore
       }
     };
 
-    new ProcBlockAction (ackProc, stacker);
-    assertRunUntilStop("perform backtrace");
-
-    String coreFileName = constructCore(ackProc);
-    File xtestCore = new File(coreFileName);
-
-    Host lcoreHost = new LinuxHost(Manager.eventLoop, 
-				   xtestCore, exeFile);
-    
-    Proc coreProc = lcoreHost.getProc(new ProcId(ackProc.getPid()));
+    // And run ....
+    new ProcCoreAction(coreProc, coreStacktrace);
+    assertRunUntilStop("Perform corefile Backtrace");
 
-    StringWriter stringWriter2 = new StringWriter();
-    coreStack = new StacktraceAction(new PrintWriter(stringWriter2),coreProc, new PrintEvent(),true,false,false,false,false, false)
-    {
+    // Check that the dead process stacktrace produces something. If
+    // not there isa problem beyond this tests scope.
+    assertTrue("Core stack trace is not empty", 
+	       coreStackOutput.getBuffer().length() > 0);
 
-      public void addFailed (Object observable, Throwable w)
-      {
-        fail("Proc add failed: " + w.getMessage());
-      }
-    };
-    new ProcCoreAction(coreProc, coreStack);
-    assertRunUntilStop("perform corebacktrace");
+    // Finally, compare live and core stack traces.
+    assertEquals("Compare stack traces",
+		 liveStackOutput.getBuffer().toString(),
+		 coreStackOutput.getBuffer().toString());
 
-    assertEquals("Compare stack traces",stringWriter1.getBuffer().toString(),stringWriter2.getBuffer().toString());
-    xtestCore.delete();
+    testCore.delete();
   }
 
   private static class PrintEvent implements Event


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



More information about the Frysk-cvs mailing list