public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* remove SimpleTestHarness
@ 2006-06-21 19:56 Anthony Balkissoon
  0 siblings, 0 replies; only message in thread
From: Anthony Balkissoon @ 2006-06-21 19:56 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

This file was part of the old harness structure and is now removed.

2006-06-21  Anthony Balkissoon  <abalkiss@redhat.com>

	* gnu/testlet/SimpleTestHarness.java: Removed this file.

--Tony

[-- Attachment #2: removeSimple.diff --]
[-- Type: text/x-patch, Size: 12351 bytes --]

Index: gnu/testlet/SimpleTestHarness.java
===================================================================
RCS file: gnu/testlet/SimpleTestHarness.java
diff -N gnu/testlet/SimpleTestHarness.java
--- gnu/testlet/SimpleTestHarness.java	21 Mar 2006 16:16:05 -0000	1.45
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,433 +0,0 @@
-// Copyright (c) 1998, 1999, 2001, 2003  Red Hat, Inc.
-// Written by Tom Tromey <tromey@cygnus.com>
-// Copyright (c) 2005  Mark J. Wielaard  <mark@klomp.org>
-
-// This file is part of Mauve.
-
-// Mauve 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; either version 2, or (at your option)
-// any later version.
-
-// Mauve 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 Mauve; see the file COPYING.  If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-// KNOWN BUGS:
-//   - should look for /*{ ... }*/ and treat contents as expected
-//     output of test.  In this case we should redirect System.out
-//     to a temp file we create.
-
-package gnu.testlet;
-import java.io.*;
-import java.util.Vector;
-
-public class SimpleTestHarness
-    extends TestHarness
-{
-  private int count = 0;
-
-  private int failures = 0;
-
-  private static Vector expected_xfails = new Vector();
-
-  private int xfailures = 0;
-
-  private int xpasses = 0;
-
-  private int total = 0;
-
-  private boolean verbose = false;
-
-  private boolean debug = false;
-
-  private boolean results_only = false;
-
-  private boolean exceptions = false;
-
-  private String description;
-
-  private String last_check;
-
-  private TestReport report = null;
-
-  private TestResult currentResult = null;
-
-  private final String getDescription(String pf)
-  {
-    return (pf + ": " + description
-            + ((last_check == null) ? "" : (": " + last_check)) + " (number "
-            + (count + 1) + ")");
-  }
-
-  protected int getFailures()
-  {
-    return failures;
-  }
-
-  public void check(boolean result)
-  {
-    if (! result)
-      {
-        String desc;
-        currentResult.addFail((last_check == null ? "" : last_check)
-                              + " (number " + (count + 1) + ")");
-        if (! expected_xfails.contains(desc = getDescription("FAIL")))
-          {
-            System.out.println(desc);
-            ++failures;
-          }
-        else if (verbose || results_only)
-          {
-            System.out.println("X" + desc);
-            ++xfailures;
-          }
-      }
-    else
-      {
-        currentResult.addPass();
-        if (verbose || results_only)
-          {
-            if (expected_xfails.contains(getDescription("FAIL")))
-              {
-                System.out.println(getDescription("XPASS"));
-                ++xpasses;
-              }
-            else
-              {
-                System.out.println(getDescription("PASS"));
-              }
-          }
-      }
-    ++count;
-    ++total;
-  }
-
-  public Reader getResourceReader(String name) throws ResourceNotFoundException
-  {
-    return new BufferedReader(new InputStreamReader(getResourceStream(name)));
-  }
-
-  public InputStream getResourceStream(String name)
-      throws ResourceNotFoundException
-  {
-    // The following code assumes File.separator is a single character.
-    if (File.separator.length() > 1)
-      throw new Error("File.separator length is greater than 1");
-    String realName = name.replace('#', File.separator.charAt(0));
-    try
-      {
-        return new FileInputStream(getSourceDirectory() + File.separator
-                                   + realName);
-      }
-    catch (FileNotFoundException ex)
-      {
-        throw new ResourceNotFoundException(ex.getLocalizedMessage() + ": "
-                                            + getSourceDirectory()
-                                            + File.separator + realName);
-      }
-  }
-
-  public File getResourceFile(String name) throws ResourceNotFoundException
-  {
-    // The following code assumes File.separator is a single character.
-    if (File.separator.length() > 1)
-      throw new Error("File.separator length is greater than 1");
-    String realName = name.replace('#', File.separator.charAt(0));
-    File f = new File(getSourceDirectory() + File.separator + realName);
-    if (! f.exists())
-      {
-        throw new ResourceNotFoundException("cannot find mauve resource file"
-                                            + ": " + getSourceDirectory()
-                                            + File.separator + realName);
-      }
-    return f;
-  }
-
-  public void checkPoint(String name)
-  {
-    last_check = name;
-    count = 0;
-  }
-
-  public void verbose(String message)
-  {
-    if (verbose)
-      System.out.println(message);
-  }
-
-  public void debug(String message)
-  {
-    debug(message, true);
-  }
-
-  public void debug(String message, boolean newline)
-  {
-    if (debug)
-      {
-        if (newline)
-          System.out.println(message);
-        else
-          System.out.print(message);
-      }
-  }
-
-  public void debug(Throwable ex)
-  {
-    if (debug)
-      ex.printStackTrace(System.out);
-  }
-
-  public void debug(Object[] o, String desc)
-  {
-    debug("Dumping Object Array: " + desc);
-    if (o == null)
-      {
-        debug("null");
-        return;
-      }
-
-    for (int i = 0; i < o.length; i++)
-      {
-        if (o[i] instanceof Object[])
-          debug((Object[]) o[i], desc + " element " + i);
-        else
-          debug("  Element " + i + ": " + o[i]);
-      }
-  }
-
-  private void removeSecurityManager()
-  {
-    SecurityManager m = System.getSecurityManager();
-    if (m instanceof TestSecurityManager)
-      {
-        TestSecurityManager tsm = (TestSecurityManager) m;
-        tsm.setRunChecks(false);
-        System.setSecurityManager(null);
-      }
-  }
-
-  protected void runtest(String name)
-  {
-    // Try to ensure we start off with a reasonably clean slate.
-    System.gc();
-    System.runFinalization();
-
-    currentResult = new TestResult(name);
-
-    checkPoint(null);
-
-    Testlet t = null;
-    try
-      {
-        Class k = Class.forName(name);
-
-        Object o = k.newInstance();
-        if (! (o instanceof Testlet))
-          return;
-
-        t = (Testlet) o;
-      }
-    catch (Throwable ex)
-      {
-        String d = "FAIL: uncaught exception loading " + name;
-        currentResult.addException(ex, "failed loading class " + name);
-        if (verbose || exceptions)
-          d += ": " + ex.toString();
-        System.out.println(d);
-        if (exceptions)
-          ex.printStackTrace(System.out);
-        debug(ex);
-        if (ex instanceof InstantiationException
-            || ex instanceof IllegalAccessException)
-          debug("Hint: is the code we just loaded a public non-abstract "
-                + "class with a public nullary constructor???");
-        ++failures;
-        ++total;
-      }
-
-    if (t != null)
-      {
-        description = name;
-        try
-          {
-            t.test(this);
-            removeSecurityManager();
-          }
-        catch (Throwable ex)
-          {
-            removeSecurityManager();
-            String s = (last_check == null ? "" : " at \"" + last_check
-                                                  + "\" number " + (count + 1));
-            String d = "FAIL: " + description + ": uncaught exception" + s;
-            currentResult.addException(ex, "uncaught exception" + s);
-            if (verbose || exceptions)
-              d += ": " + ex.toString();
-            System.out.println(d);
-            if (exceptions)
-              ex.printStackTrace(System.out);
-            debug(ex);
-            ++failures;
-            ++total;
-          }
-      }
-    if (report != null)
-      report.addTestResult(currentResult);
-  }
-
-  protected int done()
-  {
-    if (! results_only)
-      {
-        System.out.println(failures + " of " + total + " tests failed");
-        if (xpasses > 0)
-          System.out.println(xpasses + " of " + total
-                             + " tests unexpectedly passed");
-        if (xfailures > 0)
-          System.out.println(xfailures + " of " + total
-                             + " tests expectedly failed");
-      }
-    return failures > 0 ? 1 : 0;
-
-  }
-
-  protected SimpleTestHarness(boolean verbose, boolean debug)
-  {
-    this(verbose, debug, false, false, null);
-  }
-
-  protected SimpleTestHarness(boolean verbose, boolean debug,
-                              boolean results_only, boolean exceptions,
-                              TestReport report)
-  {
-    this.verbose = verbose;
-    this.debug = debug;
-    this.results_only = results_only;
-    this.exceptions = exceptions;
-    this.report = report;
-
-    try
-      {
-        BufferedReader xfile = new BufferedReader(new FileReader("xfails"));
-        String str;
-        while ((str = xfile.readLine()) != null)
-          {
-            expected_xfails.addElement(str);
-          }
-      }
-    catch (FileNotFoundException ex)
-      {
-        // Nothing.
-      }
-    catch (IOException ex)
-      {
-        // Nothing.
-      }
-  }
-
-  public static void main(String[] args)
-  {
-    boolean verbose = false;
-    boolean debug = false;
-    boolean results_only = false;
-    boolean exceptions = false;
-    String file = null;
-    String xmlfile = null;
-    TestReport report = null;
-    int i;
-
-    for (i = 0; i < args.length; i++)
-      {
-        if (args[i].equals("-verbose"))
-          verbose = true;
-        else if (args[i].equals("-debug"))
-          debug = true;
-        else if (args[i].equals("-resultsonly"))
-          {
-            results_only = true;
-            verbose = false;
-            debug = false;
-          }
-        else if (args[i].equals("-exceptions"))
-          exceptions = true;
-        else if (args[i].equalsIgnoreCase("-file"))
-          {
-            if (++i >= args.length)
-              throw new RuntimeException("No file path after '-file'.  Exit");
-            file = args[i];
-          }
-        else if (args[i].equals("-xmlout"))
-          {
-            if (++i >= args.length)
-              throw new RuntimeException("No file path after '-xmlout'.");
-            xmlfile = args[i];
-          }
-        else
-          break;
-      }
-    if (xmlfile != null)
-      {
-        report = new TestReport(System.getProperties());
-      }
-
-    SimpleTestHarness harness = new SimpleTestHarness(verbose, debug,
-                                                      results_only, exceptions,
-                                                      report);
-
-    BufferedReader r = null;
-    if (file != null)
-      try
-        {
-          r = new BufferedReader(new FileReader(file));
-        }
-      catch (FileNotFoundException x)
-        {
-          throw new RuntimeException("Cannot find \"" + file + "\".  Exit");
-        }
-    else
-      r = new BufferedReader(new InputStreamReader(System.in));
-
-    while (true)
-      {
-        String cname = null;
-        try
-          {
-            cname = r.readLine();
-            if (cname == null)
-              break;
-            if (verbose)
-              System.out.println(cname);
-          }
-        catch (IOException x)
-          {
-            // Nothing.
-          }
-        if (verbose)
-          System.out.println("----");
-        harness.runtest(cname);
-      }
-
-    int retval = harness.done();
-
-    if (report != null)
-      {
-        File f = new File(xmlfile);
-        try
-          {
-            report.writeXml(f);
-          }
-        catch (IOException e)
-          {
-            throw new Error("Failed to write data to xml file: "
-                            + e.getMessage());
-          }
-      }
-    System.exit(retval);
-  }
-}

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

only message in thread, other threads:[~2006-06-21 19:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21 19:56 remove SimpleTestHarness Anthony Balkissoon

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