From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7108 invoked by alias); 25 Jan 2008 22:48:53 -0000 Received: (qmail 7053 invoked by uid 9708); 25 Jan 2008 22:48:51 -0000 Date: Fri, 25 Jan 2008 22:48:00 -0000 Message-ID: <20080125224851.7037.qmail@sourceware.org> From: tthomas@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Update tests. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ee5cba36cbb15ff37b30293e1bd51d9ab7e1000d X-Git-Newrev: 72db7403add6c37288f73e0286b14c3967297651 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00136.txt.bz2 The branch, master has been updated via 72db7403add6c37288f73e0286b14c3967297651 (commit) via f0f511368157dee4e0c65fd59cad282050b3fa65 (commit) from ee5cba36cbb15ff37b30293e1bd51d9ab7e1000d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 72db7403add6c37288f73e0286b14c3967297651 Author: Teresa Thomas Date: Fri Jan 25 17:48:05 2008 -0500 Update tests. frysk-core/frysk/bindir/ChangeLog 2008-01-25 Teresa Thomas * TestFdebuginfo.java (testBadArguments): Update. (testNoArguments): Update. commit f0f511368157dee4e0c65fd59cad282050b3fa65 Author: Teresa Thomas Date: Fri Jan 25 17:30:03 2008 -0500 Allow fdebuginfo . Fixes bug# 5655. frysk-core/frysk/bindir/ChangeLog 2008-01-25 Teresa Thomas * fdebuginfo.java: Reindent. (.parseCommand): New. * TestFdebuginfo.java: Reindent. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 9 + frysk-core/frysk/bindir/TestFdebuginfo.java | 96 ++++++------ frysk-core/frysk/bindir/fdebuginfo.java | 211 +++++++++++++++------------ 3 files changed, 173 insertions(+), 143 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index dd4b497..2ce4bbf 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,12 @@ +2008-01-25 Teresa Thomas + + * TestFdebuginfo.java (testBadArguments): Update. + (testNoArguments): Update. + + * fdebuginfo.java: Reindent. + (.parseCommand): New. + * TestFdebuginfo.java: Reindent. + 2008-01-25 Andrew Cagney * TestLib.java: Delete. diff --git a/frysk-core/frysk/bindir/TestFdebuginfo.java b/frysk-core/frysk/bindir/TestFdebuginfo.java index 2421a63..a68a209 100644 --- a/frysk-core/frysk/bindir/TestFdebuginfo.java +++ b/frysk-core/frysk/bindir/TestFdebuginfo.java @@ -1,41 +1,41 @@ -// This file is part of the program FRYSK. -// -// Copyright 2007, 2008, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. +//This file is part of the program FRYSK. + +//Copyright 2007, 2008, Red Hat Inc. + +//FRYSK is free software; you can redistribute it and/or modify it +//under the terms of the GNU General Public License as published by +//the Free Software Foundation; version 2 of the License. + +//FRYSK is distributed in the hope that it will be useful, but +//WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +//General Public License for more details. + +//You should have received a copy of the GNU General Public License +//along with FRYSK; if not, write to the Free Software Foundation, +//Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +//In addition, as a special exception, Red Hat, Inc. gives You the +//additional right to link the code of FRYSK with code not covered +//under the GNU General Public License ("Non-GPL Code") and to +//distribute linked combinations including the two, subject to the +//limitations in this paragraph. Non-GPL Code permitted under this +//exception must only link to the code of FRYSK through those well +//defined interfaces identified in the file named EXCEPTION found in +//the source code files (the "Approved Interfaces"). The files of +//Non-GPL Code may instantiate templates or use macros or inline +//functions from the Approved Interfaces without causing the +//resulting work to be covered by the GNU General Public +//License. Only Red Hat, Inc. may make changes or additions to the +//list of Approved Interfaces. You must obey the GNU General Public +//License in all respects for all of the FRYSK code and other code +//used in conjunction with FRYSK except the Non-GPL Code covered by +//this exception. If you modify this file, you may extend this +//exception to your version of the file, but you are not obligated to +//do so. If you do not wish to provide this exception without +//modification, you must delete this exception statement from your +//version and license this file solely under the GPL without +//exception. package frysk.bindir; @@ -54,38 +54,38 @@ public class TestFdebuginfo extends TestLib { public void testPathListing() { if (unresolved(5671)) return; - // Create an unattached child process. + // Create an unattached child process. SlaveOffspring child = SlaveOffspring.createChild(); Task task = child.findTaskUsingRefresh(true); TearDownExpect e = new TearDownExpect(new String[] { Config.getBinFile("fdebuginfo").getAbsolutePath(), ""+task.getProc().getPid() - }); + }); // Look for the path of executable e.expect(task.getProc().getExe()); } - + public void testNoArguments() { - TearDownExpect e = new TearDownExpect(new String[] { + TearDownExpect e = new TearDownExpect(new String[] { Config.getBinFile("fdebuginfo").getAbsolutePath () - }); - e.expect("Error: No pid provided."); + }); + e.expect("ERROR: No argument provided"); } public void testBadArguments() { TearDownExpect e = new TearDownExpect(new String[] { Config.getBinFile("fdebuginfo").getAbsolutePath (), "this is a bad argument" - }); - e.expect("Error: Commands not supported."); + }); + e.expect("File does not exist or is not readable or is not a file."); } - + public void testInvalidArgument() { TearDownExpect e = new TearDownExpect(new String[] { Config.getBinFile("fdebuginfo").getAbsolutePath (), "-z", "1" - }); + }); e.expect("fdebuginfo: unrecognized option"); } } diff --git a/frysk-core/frysk/bindir/fdebuginfo.java b/frysk-core/frysk/bindir/fdebuginfo.java index 0cedac5..ff5e5fd 100644 --- a/frysk-core/frysk/bindir/fdebuginfo.java +++ b/frysk-core/frysk/bindir/fdebuginfo.java @@ -1,48 +1,53 @@ -// This file is part of the program FRYSK. -// -// Copyright 2007 Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. +//This file is part of the program FRYSK. + +//Copyright 2007 Red Hat Inc. + +//FRYSK is free software; you can redistribute it and/or modify it +//under the terms of the GNU General Public License as published by +//the Free Software Foundation; version 2 of the License. + +//FRYSK is distributed in the hope that it will be useful, but +//WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +//General Public License for more details. + +//You should have received a copy of the GNU General Public License +//along with FRYSK; if not, write to the Free Software Foundation, +//Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +//In addition, as a special exception, Red Hat, Inc. gives You the +//additional right to link the code of FRYSK with code not covered +//under the GNU General Public License ("Non-GPL Code") and to +//distribute linked combinations including the two, subject to the +//limitations in this paragraph. Non-GPL Code permitted under this +//exception must only link to the code of FRYSK through those well +//defined interfaces identified in the file named EXCEPTION found in +//the source code files (the "Approved Interfaces"). The files of +//Non-GPL Code may instantiate templates or use macros or inline +//functions from the Approved Interfaces without causing the +//resulting work to be covered by the GNU General Public +//License. Only Red Hat, Inc. may make changes or additions to the +//list of Approved Interfaces. You must obey the GNU General Public +//License in all respects for all of the FRYSK code and other code +//used in conjunction with FRYSK except the Non-GPL Code covered by +//this exception. If you modify this file, you may extend this +//exception to your version of the file, but you are not obligated to +//do so. If you do not wish to provide this exception without +//modification, you must delete this exception statement from your +//version and license this file solely under the GPL without +//exception. package frysk.bindir; +import java.io.File; + +import frysk.proc.Host; +import frysk.proc.Manager; import frysk.proc.ProcId; import frysk.proc.Proc; import frysk.proc.Task; +import frysk.proc.dead.LinuxExeHost; import frysk.util.CommandlineParser; import frysk.util.CoreExePair; @@ -51,63 +56,79 @@ import frysk.util.DebuginfoPaths; public final class fdebuginfo { - private static CommandlineParser parser; - - /** - * Function that gets and prints the debuginfo install paths - * - * @param proc - pid - */ - private static void printDebuginfo (Proc proc) - { - Task task = proc.getMainTask(); - DebuginfoPaths dbg = new DebuginfoPaths(task); - String dInfo = dbg.getDebuginfo(); - if (dInfo!=null) - System.out.print(dInfo); - } - - /** - * Entry function for fdebuginfo - * - * @param args - pid of the process(es) or corefile - */ - public static void main(String[] args) - { - // Parse command line. Check if argument provided. - parser = new CommandlineParser("fdebuginfo") + private static CommandlineParser parser; + + /** + * Function that gets and prints the debuginfo install paths + * + * @param proc - pid + */ + private static void printDebuginfo (Proc proc) { - //@Override - public void parseCores (CoreExePair[] coreExePairs) - { - for (int i = 0; i < coreExePairs.length; i++) - { - Proc proc = Util.getProcFromCoreExePair(coreExePairs[i]); - printDebuginfo(proc); - } - System.exit(0); - } - - //@Override - public void parsePids (ProcId[] pids) - { - for (int i= 0; i< pids.length; i++) - { - Proc proc = Util.getProcFromPid(pids[i]); - printDebuginfo(proc); - } - System.exit(0); - } - }; - - parser.setHeader("Usage: fdebuginfo "); - - parser.parse(args); - - //Pid not found - System.err.println("Error: No pid provided."); - parser.printHelp(); - System.exit(1); - } + Task task = proc.getMainTask(); + DebuginfoPaths dbg = new DebuginfoPaths(task); + String dInfo = dbg.getDebuginfo(); + if (dInfo!=null) + System.out.print(dInfo); + } + + /** + * Entry function for fdebuginfo + * + * @param args - pid of the process(es) or corefile + */ + public static void main(String[] args) + { + // Parse command line. Check if argument provided. + parser = new CommandlineParser("fdebuginfo") + { + //@Override + public void parseCores (CoreExePair[] coreExePairs) + { + for (int i = 0; i < coreExePairs.length; i++) + { + Proc proc = Util.getProcFromCoreExePair(coreExePairs[i]); + printDebuginfo(proc); + } + System.exit(0); + } + + //@Override + public void parsePids (ProcId[] pids) + { + for (int i= 0; i< pids.length; i++) + { + Proc proc = Util.getProcFromPid(pids[i]); + printDebuginfo(proc); + } + System.exit(0); + } + + //@Override + public void parseCommand(String[] command) { + File exeFile = new File(command[0]); + if (!exeFile.exists() || !exeFile.canRead() + || !exeFile.isFile()) { + System.err.println ("File does not exist or is " + + "not readable or is not a file."); + } else { + Manager.eventLoop.start(); + Host exeHost = new LinuxExeHost(Manager.eventLoop, exeFile); + Proc exeProc = Util.getProcFromExeFile(exeHost); + printDebuginfo(exeProc); + } + System.exit(0); + } + }; + + parser.setHeader("Usage: fdebuginfo || fdebuginfo " + + "|| fdebuginfo []"); + parser.parse(args); + + //Pid not found + System.err.println("ERROR: No argument provided"); + parser.printHelp(); + System.exit(1); + } } hooks/post-receive -- frysk system monitor/debugger