This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: New Test File.getParent


On Tue, 2005-11-08 at 10:44 +0100, Mark Wielaard wrote:
> Wow, I never realized this. And most of the framework code is from
> 1998/1999 before I joined the Mauve project. It looks like the config
> interface methods should have been added to the abstract TestHarness
> class as default methods and not to the SimpleTestHarness. Since this is
> easy to do I am testing a patch now that I will post to the list as soon
> as I have internet access again.

That was pretty simple and seems to work fine:

2005-11-08  Mark Wielaard  <mark@klomp.org>

	* gnu/testlet/SimpleTestHarness.java: Don't implement config.
	(getSourceDirectory): Removed.
	(getTempDirectory): Removed.
	(getPathSeparator): Removed.
	(getSeparator): Removed.
	(getMailHost): Removed.
	* gnu/testlet/TestHarness.java: Implements config.
	(getSourceDirectory): Added.
	(getTempDirectory): Added.
	(getPathSeparator): Added.
	(getSeparator): Added.
	(getMailHost): Added.
	* gnu/testlet/BinaryCompatibility/BinaryCompatibilityTest.java:
	Don't cast to SimpleTestHarness.
	* gnu/testlet/java/io/File/jdk11.java: Likewise.
	* gnu/testlet/java/net/Socket/SocketTest.java: Likewise.
	* gnu/testlet/java/net/Socket/jdk12.java: Remove SimpleTestHarness
	import.
	* gnu/testlet/java/net/Socket/jdk13.java: Likewise.
	* gnu/testlet/java/net/Socket/jdk13.java: Likewise.

I am checking this in.

Cheers,

Mark

Index: gnu/testlet/SimpleTestHarness.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/SimpleTestHarness.java,v
retrieving revision 1.43
diff -u -r1.43 SimpleTestHarness.java
--- gnu/testlet/SimpleTestHarness.java	2 Jan 2005 21:13:20 -0000	1.43
+++ gnu/testlet/SimpleTestHarness.java	8 Nov 2005 21:46:23 -0000
@@ -1,5 +1,6 @@
 // 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.
 
@@ -29,7 +30,6 @@
 
 public class SimpleTestHarness
   extends TestHarness
-  implements gnu.testlet.config
 {
   private int count = 0;
   private int failures = 0;
@@ -96,31 +96,6 @@
     ++total;
   }
 
-  public String getSourceDirectory ()
-  {
-    return srcdir;
-  }
-  
-  public String getTempDirectory ()
-  {
-    return tmpdir;
-  }
-  
-  public String getPathSeparator ()
-  {
-    return pathSeparator;
-  }
-  
-  public String getSeparator ()
-  {
-    return separator;
-  }
-  
-  public String getMailHost ()
-  {
-    return mailHost;
-  }
-  
   public Reader getResourceReader (String name)
     throws ResourceNotFoundException
   {
Index: gnu/testlet/TestHarness.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/TestHarness.java,v
retrieving revision 1.19
diff -u -r1.19 TestHarness.java
--- gnu/testlet/TestHarness.java	21 Feb 2005 06:48:58 -0000	1.19
+++ gnu/testlet/TestHarness.java	8 Nov 2005 21:46:23 -0000
@@ -1,5 +1,6 @@
 // Copyright (c) 1998, 1999, 2001  Cygnus Solutions
 // Written by Tom Tromey <tromey@cygnus.com>
+// Copyright (c) 2005  Mark J. Wielaard  <mark@klomp.org>
 
 // This file is part of Mauve.
 
@@ -32,6 +33,7 @@
  * commented).
  */
 public abstract class TestHarness
+  implements config
 {
   /**
    * Records the result of a boolean check.
@@ -199,13 +201,6 @@
     throws ResourceNotFoundException;
 
   /**
-   * Provide a directory name for writing temporary files.
-   *
-   * @return The temporary directory name.
-   */
-  public abstract String getTempDirectory ();
-
-  /**
    * Records a check point.  This can be used to mark a known place in a 
    * testlet.  It is useful if you have a large number of tests -- it makes 
    * it easier to find a failing test in the source code. 
@@ -249,4 +244,36 @@
    * @param desc  the description.
    */
   public abstract void debug (Object[] o, String desc);
+
+  // Default config interface methods.
+  public String getSourceDirectory ()
+  {
+    return srcdir;
+  }
+  
+  /**
+   * Provide a directory name for writing temporary files.
+   *
+   * @return The temporary directory name.
+   */
+
+  public String getTempDirectory ()
+  {
+    return tmpdir;
+  }
+  
+  public String getPathSeparator ()
+  {
+    return pathSeparator;
+  }
+  
+  public String getSeparator ()
+  {
+    return separator;
+  }
+  
+  public String getMailHost ()
+  {
+    return mailHost;
+  }
 }
Index: gnu/testlet/BinaryCompatibility/BinaryCompatibilityTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/BinaryCompatibility/BinaryCompatibilityTest.java,v
retrieving revision 1.2
diff -u -r1.2 BinaryCompatibilityTest.java
--- gnu/testlet/BinaryCompatibility/BinaryCompatibilityTest.java	30 Apr 2004 13:37:54 -0000	1.2
+++ gnu/testlet/BinaryCompatibility/BinaryCompatibilityTest.java	8 Nov 2005 21:46:23 -0000
@@ -2,6 +2,7 @@
 
 // Copyright (C) 2003 Red Hat, Inc.
 // Written by aph@redhat.com
+// Copyright (C) 2005 Mark J. Wielaard  <mark@klomp.org>
 
 // A set of tests for Chapter 13 of the JLS, "Binary Compatibility".
 // We run a script that compiles every test case twice, the second
@@ -29,7 +30,6 @@
 package gnu.testlet.BinaryCompatibility;
 import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
-import gnu.testlet.SimpleTestHarness;
 import java.io.*;
 
 public class BinaryCompatibilityTest implements Testlet
@@ -41,17 +41,16 @@
     try
       {
         String command;
-        SimpleTestHarness sth = (SimpleTestHarness) harness;
-        String path = (sth.getSourceDirectory() +
+        String path = (harness.getSourceDirectory() +
                        "/gnu/testlet/BinaryCompatibility/tests");
-        char sep = sth.getSeparator().charAt(0);
+        char sep = harness.getSeparator().charAt(0);
         FileReader fr = new FileReader(path);
         BufferedReader tests = new BufferedReader(fr);
         while ((command = tests.readLine()) != null)
           {
             String srcdir = "/gnu/testlet/BinaryCompatibility";
             srcdir = srcdir.replace('/', sep);
-            File dir = new File(sth.getSourceDirectory() + srcdir);
+            File dir = new File(harness.getSourceDirectory() + srcdir);
             harness.debug("Execing external command: " + command);
             Process p = Runtime.getRuntime().exec(command, null, dir);
             BufferedReader result =
Index: gnu/testlet/java/io/File/jdk11.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/io/File/jdk11.java,v
retrieving revision 1.7
diff -u -r1.7 jdk11.java
--- gnu/testlet/java/io/File/jdk11.java	3 May 2004 03:21:14 -0000	1.7
+++ gnu/testlet/java/io/File/jdk11.java	8 Nov 2005 21:46:24 -0000
@@ -1,7 +1,7 @@
 /*************************************************************************
 /* jdk11.java -- java.io.File 1.1 tests
 /*
-/* Copyright (c) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (c) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
 /*
 /* This program is free software; you can redistribute it and/or modify
 /* it under the terms of the GNU General Public License as published 
@@ -24,7 +24,6 @@
 
 import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
-import gnu.testlet.SimpleTestHarness;
 import gnu.testlet.config;
 
 import java.io.File;
@@ -37,19 +36,8 @@
 public class jdk11 implements Testlet, FilenameFilter
 {
   
-  public void test (TestHarness testharness)
+  public void test (TestHarness harness)
   {
-    SimpleTestHarness harness = null;
-    try 
-      {
-	harness = (SimpleTestHarness)testharness;
-      } 
-    catch (ClassCastException cce)
-      {
-	harness.fail ("Harness not an instance of SimpleTestHarness");
-	return;
-      }
-
     String srcdirstr = harness.getSourceDirectory ();
     String tmpdirstr = harness.getTempDirectory ();
 
Index: gnu/testlet/java/net/Socket/SocketTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/Socket/SocketTest.java,v
retrieving revision 1.22
diff -u -r1.22 SocketTest.java
--- gnu/testlet/java/net/Socket/SocketTest.java	17 Nov 2004 19:50:40 -0000	1.22
+++ gnu/testlet/java/net/Socket/SocketTest.java	8 Nov 2005 21:46:24 -0000
@@ -3,6 +3,7 @@
 
 /*
   Copyright (C) 1999 Hewlett-Packard Company
+  Copyright (C) 2005 Mark J. Wielaard <mark@klomp.org>
   
   This file is part of Mauve.
   
@@ -25,14 +26,13 @@
 package gnu.testlet.java.net.Socket;
 import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
-import gnu.testlet.SimpleTestHarness;
 import java.net.*;
 import java.io.*;
 
 
 public class SocketTest implements Testlet
 {
-  protected static SimpleTestHarness harness;
+  protected static TestHarness harness;
   
   public void test_BasicServer()
   {
@@ -499,7 +499,7 @@
 
   public void test (TestHarness the_harness)
   {
-    harness = (SimpleTestHarness) the_harness;
+    harness = the_harness;
     testall ();
   }
 }
Index: gnu/testlet/java/net/Socket/jdk12.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/Socket/jdk12.java,v
retrieving revision 1.4
diff -u -r1.4 jdk12.java
--- gnu/testlet/java/net/Socket/jdk12.java	10 Feb 2005 04:37:31 -0000	1.4
+++ gnu/testlet/java/net/Socket/jdk12.java	8 Nov 2005 21:46:24 -0000
@@ -3,6 +3,7 @@
 
 /*
   Copyright (C) 2003 C. Brian Jones
+  Copyright (C) 2005 Mark J. Wielaard
   
   This file is part of Mauve.
   
@@ -28,7 +29,6 @@
 import java.net.*;
 
 import gnu.testlet.Testlet;
-import gnu.testlet.SimpleTestHarness;
 import gnu.testlet.TestHarness;
 
 public class jdk12 implements Testlet
Index: gnu/testlet/java/net/Socket/jdk13.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/Socket/jdk13.java,v
retrieving revision 1.5
diff -u -r1.5 jdk13.java
--- gnu/testlet/java/net/Socket/jdk13.java	10 Feb 2005 04:37:31 -0000	1.5
+++ gnu/testlet/java/net/Socket/jdk13.java	8 Nov 2005 21:46:24 -0000
@@ -3,6 +3,7 @@
 
 /*
   Copyright (C) 2003 C. Brian Jones
+  Copyright (C) 2003 Mark J. Wielaard  <mark@klomp.org>
   
   This file is part of Mauve.
   
@@ -28,7 +29,6 @@
 import java.net.*;
 
 import gnu.testlet.Testlet;
-import gnu.testlet.SimpleTestHarness;
 import gnu.testlet.TestHarness;
 
 public class jdk13 implements Testlet
Index: gnu/testlet/java/net/Socket/jdk14.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/Socket/jdk14.java,v
retrieving revision 1.5
diff -u -r1.5 jdk14.java
--- gnu/testlet/java/net/Socket/jdk14.java	10 Feb 2005 04:37:31 -0000	1.5
+++ gnu/testlet/java/net/Socket/jdk14.java	8 Nov 2005 21:46:24 -0000
@@ -3,6 +3,7 @@
 
 /*
   Copyright (C) 2003 C. Brian Jones
+  Copyright (C) 2003 Mark J. Wielaard  <mark@klomp.org>
   
   This file is part of Mauve.
   
@@ -28,7 +29,6 @@
 import java.net.*;
 
 import gnu.testlet.Testlet;
-import gnu.testlet.SimpleTestHarness;
 import gnu.testlet.TestHarness;
 
 public class jdk14 implements Testlet

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]