public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* RFC: Adding support for a new tag to a Mauve test tool
@ 2012-01-13 11:55 Pavel Tisnovsky
       [not found] ` <CAFXTvn5xZ8h_yvirEqSkcpDjOPN3gFP2fWiENWzNTh=nQwDWAA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tisnovsky @ 2012-01-13 11:55 UTC (permalink / raw)
  To: mauve-discuss

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

Hi all,

I'd like to add support for a new tag to a Mauve test tool. This tag is named "CompileOptions:"
and could be used to add specific command line options passed to a compiler (it's different
behavior from changing compiler options globally).

Usage (in the test - btw: its compatible with ECJ and OpenJDK too):

// Tags: CompileOptions: -source 1.4

or just:

// CompileOptions: -source 1.4

because the "Tags:" prefix is not checked (it's true for other tags too - I'm not sure if its
a bug or a feature of Mauve test tool :-).

Unified diff for Harness.java is stored in an attachment.

Could anybody look at this change please?

Thank you in advance,
Pavel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Harness.diff --]
[-- Type: text/x-patch; name=Harness.diff, Size: 1967 bytes --]

Index: Harness.java
===================================================================
RCS file: /cvs/mauve/mauve/Harness.java,v
retrieving revision 1.32
diff -u -r1.32 Harness.java
--- Harness.java	13 Feb 2009 15:51:59 -0000	1.32
+++ Harness.java	13 Jan 2012 11:42:49 -0000
@@ -65,6 +65,9 @@
   // bootclasspath, which should be the classpath installation directory
   private static String compileStringBase = "-proceedOnError -nowarn -1.5 -d " + config.builddir;
   
+  // Options specified in a test which is passed to a compiler
+  private static String compileOptions = "";
+
   // The writers for ecj's out and err streams.
   private static PrintWriter ecjWriterOut = null;
   private static PrintWriter ecjWriterErr = null;
@@ -991,6 +994,10 @@
                   {
                     processFilesTag(line, base, filesToCopy);
                   }
+                else if (line.contains("CompileOptions:"))
+                  {
+                    processCompileOptions(line);
+                  }
                 else if (line.contains("not-a-test"))
                   {
                     // Don't run this one but parse it's tags.
@@ -1074,6 +1081,17 @@
   }
 
   /**
+   * Processes the // CompileOptions: tag in a testlet's source.
+   *
+   * @param line string of the current source line
+   */
+  private static void processCompileOptions(String line)
+  {
+    compileOptions = line.substring(line.indexOf("CompileOptions:") + "CompileOptions:".length()); 
+    compileOptions += " "; // add separator to a command line
+  }
+
+  /**
    * Processes the // Files: tag in a testlet's source.
    *
    * @param base base directory of the current test
@@ -1352,7 +1370,7 @@
       return true;
 
     int result = - 1;
-    compileString = compileStringBase;
+    compileString = compileStringBase + compileOptions;
     for (Iterator it = filesToCompile.iterator(); it.hasNext(); )
       compileString += " " + (String) it.next();
     try

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

end of thread, other threads:[~2012-01-16 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 11:55 RFC: Adding support for a new tag to a Mauve test tool Pavel Tisnovsky
     [not found] ` <CAFXTvn5xZ8h_yvirEqSkcpDjOPN3gFP2fWiENWzNTh=nQwDWAA@mail.gmail.com>
2012-01-16  9:20   ` Pavel Tisnovsky
2012-01-16 15:46     ` Dr Andrew John Hughes

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