public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* patch to improve use with Eclipse
@ 2005-12-21 13:38 Raif S. Naffah
  2005-12-21 15:07 ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Raif S. Naffah @ 2005-12-21 13:38 UTC (permalink / raw)
  To: mauve-discuss


[-- Attachment #1.1: Type: text/plain, Size: 115 bytes --]

hello there,

pls. find attached a patch to improve the use of Mauve with (Native) 
Eclipse.


cheers;
rsn

[-- Attachment #1.2: mauve-20051221.patch --]
[-- Type: text/x-diff, Size: 3480 bytes --]

? frozen_serial
? .externalToolBuilders/MauveBatchRun.launch
Index: .cvsignore
===================================================================
RCS file: /cvs/mauve/mauve/.cvsignore,v
retrieving revision 1.6
diff -B -b -w -U3 -r1.6 .cvsignore
--- .cvsignore	21 Feb 2005 06:48:58 -0000	1.6
+++ .cvsignore	21 Dec 2005 13:27:58 -0000
@@ -19,3 +19,5 @@
 build
 doc
 SimpleTestHarness
+mauve-classpath
+mauve.out
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1307
diff -B -b -w -U3 -r1.1307 ChangeLog
--- ChangeLog	20 Dec 2005 19:20:17 -0000	1.1307
+++ ChangeLog	21 Dec 2005 13:28:03 -0000
@@ -1,3 +1,10 @@
+2005-12-21  Raif S. Naffah  <raif@swiftdsl.com.au>
+
+	* .externalToolBuilders/MauveBatchRunLaunch: new Eclipse Builder
+	* batch_run
+	  (CLASSPATHBCP): new env variable.
+	  (COMPILER): redefined using CLASSPATHBCP.
+
 2005-12-20  Anthony Balkissoon  <abalkiss@redhat.com>

 	* gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure1.java: New test.
Index: batch_run
===================================================================
RCS file: /cvs/mauve/mauve/batch_run,v
retrieving revision 1.17
diff -B -b -w -U3 -r1.17 batch_run
--- batch_run	31 Jul 2005 17:42:52 -0000	1.17
+++ batch_run	21 Dec 2005 13:28:03 -0000
@@ -36,9 +36,13 @@
 KEYS="$KEYS !java.lang.Character.unicode"
 fi

+if test "x$CLASSPATHBCP" = "x"; then
+CLASSPATHBCP="/usr/local/classpath/share/classpath/glibj.zip"
+fi
+
 if test "x$COMPILER" = "x"; then
 #COMPILER="gcj -C -Wno-deprecated"
-COMPILER="jikes -nowarn -bootclasspath /usr/local/classpath/share/classpath/glibj.zip"
+COMPILER="jikes -nowarn -bootclasspath $CLASSPATHBCP"
 fi

 if test "x$COMPILER" = "xgcj"; then
Index: .externalToolBuilders/MauveBatchRun.launch
===================================================================
RCS file: .externalToolBuilders/MauveBatchRun.launch
diff -N .externalToolBuilders/MauveBatchRun.launch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .externalToolBuilders/MauveBatchRun.launch	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,2 @@
+<?xml version='1.0'?>
+<launchConfiguration type='org.eclipse.ui.externaltools.ProgramLaunchConfigurationType'><stringAttribute key='org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE' value='${workspace_loc:/mauve}/mauve.out'/><stringAttribute key='org.eclipse.debug.core.ATTR_REFRESH_SCOPE' value='${container}'/><listAttribute key='org.eclipse.debug.ui.favoriteGroups'><listEntry value='org.eclipse.ui.externaltools.launchGroup'/></listAttribute><stringAttribute key='org.eclipse.ui.externaltools.ATTR_LOCATION' value='${project_loc:mauve}/batch_run'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY' value='${project_loc}'/><mapAttribute key='org.eclipse.debug.core.environmentVariables'><mapEntry key='KEYS' value='classpath'/><mapEntry key='CLASSPATHBCP' value='${project_loc:classpath}/install/share/classpath'/><mapEntry key='CACAO_BIN' value='${project_loc:classpath}/install/bin/java'/><mapEntry key='JAMVM_BIN' value='${project_loc:classpath}/install/bin/jamvm'/><mapEntry key='RUNTIME' value='${project_loc:classpath}/install/bin/java'/></mapAttribute><booleanAttribute key='org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND' value='false'/><booleanAttribute key='org.eclipse.debug.core.appendEnvironmentVariables' value='false'/></launchConfiguration>

[-- Attachment #2: Type: application/pgp-signature, Size: 216 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch to improve use with Eclipse
  2005-12-21 13:38 patch to improve use with Eclipse Raif S. Naffah
@ 2005-12-21 15:07 ` Mark Wielaard
  2005-12-21 23:46   ` Mark Wielaard
  2005-12-22 11:03   ` Raif S. Naffah
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Wielaard @ 2005-12-21 15:07 UTC (permalink / raw)
  To: raif; +Cc: mauve-discuss

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

Hi Raif,

On Thu, 2005-12-22 at 00:39 +1100, Raif S. Naffah wrote:
> pls. find attached a patch to improve the use of Mauve with (Native) 
> Eclipse.

Could you give some guidance for a newbie like me?
I installed this and now I have under Run->External Tools a new item
MauveBatchRun. If I select that (after following almost everything in
http://developer.classpath.org/mediation/ClasspathHackingWithEclipse) it
seems to configure mauve and then says:
[Console output redirected to file:/home/mark/workspace/mauve/mauve.out]

But there is nothing in that file.

I did commit it so others can play more easily with it though.

Cheers,

Mark

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch to improve use with Eclipse
  2005-12-21 15:07 ` Mark Wielaard
@ 2005-12-21 23:46   ` Mark Wielaard
  2005-12-22 11:03   ` Raif S. Naffah
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2005-12-21 23:46 UTC (permalink / raw)
  To: raif; +Cc: mauve-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1628 bytes --]

On Wed, 2005-12-21 at 16:07 +0100, Mark Wielaard wrote:
> Hi Raif,
> 
> On Thu, 2005-12-22 at 00:39 +1100, Raif S. Naffah wrote:
> > pls. find attached a patch to improve the use of Mauve with (Native) 
> > Eclipse.
> 
> Could you give some guidance for a newbie like me?
> I installed this and now I have under Run->External Tools a new item
> MauveBatchRun. If I select that (after following almost everything in
> http://developer.classpath.org/mediation/ClasspathHackingWithEclipse) it
> seems to configure mauve and then says:
> [Console output redirected to file:/home/mark/workspace/mauve/mauve.out]
> 
> But there is nothing in that file.
> 
> I did commit it so others can play more easily with it though.

Strangely enough it still doesn't really run for me.

But I did experiment a bit with eclipse and mauve and came up with a
simple SingleTestHarness which can be used with a Runner for quickly
testing a mauve Testlet that you are working on:

2005-12-21  Mark Wielaard  <mark@klomp.org>

        * gnu/testlet/SingleTestHarness.java: New file.

With this you can define a simple runner that uses this class with as
argument ${java_type_name}.

A cool trick here is to do the following:

$ mkdir -p ~/workspace/classpath/install/jre/lib
$ touch ~/workspace/classpath/install/jre/lib/rt.jar

Now you can go to Preferences -> Java -> JRE and add your
workspace/classpath/install as alternative installed jre. Then you can
use this alternative jre for the above runner to get it to test your
mauve Testlets against your the classpath project. Pretty cool :)

Cheers,

Mark

[-- Attachment #1.2: SingleTestHarness.java --]
[-- Type: text/x-java, Size: 4373 bytes --]

/* SingleTestHarness.java -- Runs one test given on the command line
   Copyright (C) 2005 Mark J. Wielaard
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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/

package gnu.testlet;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public class SingleTestHarness extends TestHarness
{  
  private int count;
  private String className;
  private String last_check;

  public SingleTestHarness(Testlet t)
  {
    className = t.getClass().getName();
  }

  public void check(boolean result)
  {
    String message = (result ? "PASS" : "FAIL") + ": " + className
                      + ((last_check == null) ? "" : (": " + last_check))
                      + " (number " + count++ + ")";
    System.out.println(message);
  }

  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)
  {
    System.out.println(message);
  }
  
  public void debug (String message)
  {
    debug(message, true);
  }
  
  public void debug (String message, boolean newline)
  {
    if (newline)
      System.out.println(message);
    else
      System.out.print(message);
  }
  
  public void debug (Throwable ex)
  {
    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]);
    }
  }

  public static void main(String[] args) throws Exception
  {
    String name = args[0];
    Class k = Class.forName(name);    
    Testlet t = (Testlet) k.newInstance();
    TestHarness h = new SingleTestHarness(t);
    t.test(h);
  }
}

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch to improve use with Eclipse
  2005-12-21 15:07 ` Mark Wielaard
  2005-12-21 23:46   ` Mark Wielaard
@ 2005-12-22 11:03   ` Raif S. Naffah
  2005-12-22 21:32     ` Mark Wielaard
  1 sibling, 1 reply; 6+ messages in thread
From: Raif S. Naffah @ 2005-12-22 11:03 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: mauve-discuss

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

hello Mark,

On Thursday 22 December 2005 02:07, Mark Wielaard wrote:
> Hi Raif,
>
> On Thu, 2005-12-22 at 00:39 +1100, Raif S. Naffah wrote:
> > pls. find attached a patch to improve the use of Mauve with
> > (Native) Eclipse.
>
> Could you give some guidance for a newbie like me?
> I installed this and now I have under Run->External Tools a new item
> MauveBatchRun. If I select that (after following almost everything in
> http://developer.classpath.org/mediation/ClasspathHackingWithEclipse)
> it seems to configure mauve and then says:
> [Console output redirected to
> file:/home/mark/workspace/mauve/mauve.out]
>
> But there is nothing in that file.

i just checked out Mauve, including this Runner, restarted Eclipse and 
tried it and it (still) works!

i did see the symptoms you're describing when (a) the built VM had 
problems; (b) the VM was not configured properly; e.g. not picking up 
the correct Classpath classes; and/or (c) the environment variables 
--defined in this Runner-- are not being picked up.  in these cases, 
the Mauve scripts would run, but no test class is selected for the 
"runner" script to run them.

the best way to debug why nothing is being written to mauve.out is to 
add some 'echo ' statements in batch_run, choose-classes and runner.  
also, on line 119 of the batch_run script, invert 2 and 1 so you can 
see the stderr output on the Eclipse console.

finally, did you create the symbolic link to mauve-classpath keys file?


>
> I did commit it so others can play more easily with it though.

thanks + cheers;
rsn

[-- Attachment #2: Type: application/pgp-signature, Size: 216 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch to improve use with Eclipse
  2005-12-22 11:03   ` Raif S. Naffah
@ 2005-12-22 21:32     ` Mark Wielaard
  2005-12-23  7:46       ` Raif S. Naffah
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Wielaard @ 2005-12-22 21:32 UTC (permalink / raw)
  To: raif; +Cc: mauve-discuss

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

Hi Raif,

On Thu, 2005-12-22 at 22:04 +1100, Raif S. Naffah wrote:
> finally, did you create the symbolic link to mauve-classpath keys file?

Doh...
I saw you also updated the wiki page with those instructions.
http://developer.classpath.org/mediation/ClasspathHackingWithEclipse

It works now for me. Thanks.

Cheers,

Mark

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch to improve use with Eclipse
  2005-12-22 21:32     ` Mark Wielaard
@ 2005-12-23  7:46       ` Raif S. Naffah
  0 siblings, 0 replies; 6+ messages in thread
From: Raif S. Naffah @ 2005-12-23  7:46 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: mauve-discuss

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

hello Mark,

On Friday 23 December 2005 08:32, Mark Wielaard wrote:
> Hi Raif,
>
> On Thu, 2005-12-22 at 22:04 +1100, Raif S. Naffah wrote:
> > finally, did you create the symbolic link to mauve-classpath keys
> > file?
>
> Doh...
> I saw you also updated the wiki page with those instructions.
> http://developer.classpath.org/mediation/ClasspathHackingWithEclipse
>
> It works now for me. Thanks.

good to hear :-) + cheers;
rsn

[-- Attachment #2: Type: application/pgp-signature, Size: 216 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-12-23  7:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-21 13:38 patch to improve use with Eclipse Raif S. Naffah
2005-12-21 15:07 ` Mark Wielaard
2005-12-21 23:46   ` Mark Wielaard
2005-12-22 11:03   ` Raif S. Naffah
2005-12-22 21:32     ` Mark Wielaard
2005-12-23  7:46       ` Raif S. Naffah

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