[-- 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
Andii Hughes wrote: > On Jan 13, 2012 11:55 AM, "Pavel Tisnovsky" <ptisnovs@redhat.com > <mailto:ptisnovs@redhat.com>> wrote: >> >> 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? >> > > I've no objection to the change as it stands, but I seem to remember > there already being support for handling different Java versions (at > least, I remember writing versions in comments). Have you checked there > isn't already a way of doing this? Hi Andrew, partially yes, it's possible to specify target JDK version in a tag. For example: // Tags: JDK1.4 (and I'm glad this tag exists due to changes in standard API) But this tag is not used by the Harness tool itself. It's supported only by Ant-related tool which can select (filter/grep) only the tests with specified JDK versions and compile/run them. But even if the test is select by this Ant-tool, there's no way (AFAIK) how to specify command line flags passed to the compiler. But in some (minor) cases it's useful to be able to specify -source, -target, -bootclasspath or something similar. Btw: The mentioned Ant-tool (or are such thing called "plugin"?) is stored in mauve/gnu/anttask > >> Thank you in advance, >> Pavel >
[-- Attachment #1: Type: text/plain, Size: 2449 bytes --] On 10:22 Mon 16 Jan , Pavel Tisnovsky wrote: > Andii Hughes wrote: > > On Jan 13, 2012 11:55 AM, "Pavel Tisnovsky" <ptisnovs@redhat.com > > <mailto:ptisnovs@redhat.com>> wrote: > >> > >> 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? > >> > > > > I've no objection to the change as it stands, but I seem to remember > > there already being support for handling different Java versions (at > > least, I remember writing versions in comments). Have you checked there > > isn't already a way of doing this? > > Hi Andrew, > > partially yes, it's possible to specify target JDK version in a tag. > For example: > // Tags: JDK1.4 > > (and I'm glad this tag exists due to changes in standard API) > > But this tag is not used by the Harness tool itself. It's supported only > by Ant-related tool which can select (filter/grep) only the tests > with specified JDK versions and compile/run them. But even if the test > is select by this Ant-tool, there's no way (AFAIK) how to specify > command line flags passed to the compiler. But in some (minor) cases > it's useful to be able to specify -source, -target, -bootclasspath or > something similar. > > Btw: The mentioned Ant-tool (or are such thing called "plugin"?) is stored > in mauve/gnu/anttask > > > > >> Thank you in advance, > >> Pavel > > > Ok, if there are cases other than source/target, then it makes sense to have a general 'append to command-line' option. I was just checking we wouldn't end up with duplicate features. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --]