public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Add absolutePath versus relative guard test. Date: Wed, 05 Mar 2008 00:03:00 -0000 [thread overview] Message-ID: <20080305000339.23803.qmail@sourceware.org> (raw) 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
reply other threads:[~2008-03-05 0:03 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=20080305000339.23803.qmail@sourceware.org \ --to=pmuldoon@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).