RFR(S) : 8038186 : [TESTBUG] improvements of test j.l.i.MethodHandles

Igor Ignatyev igor.ignatyev at oracle.com
Sat Mar 29 23:07:54 UTC 2014


John,

unfortunately, I've already pushed my changes w/o junit annotation. But 
I have the dirty patch which adds "jtreg support" to netbeans:

1. add test.single action for test folder to 'ide-actions' section in 
JDK project -- jdk/make/netbeans/j2se/nbproject/project.xml:
>                 <action name="test.single">
>                     <script>nbproject/ide-file-targets.xml</script>
>                     <target>test-selected-file-in-test</target>
>                     <context>
>                         <property>run.files</property>
>                         <folder>${root}/test</folder>
>                         <pattern>\.java$</pattern>
>                         <format>relative-path</format>
>                         <arity>
>                             <separated-files> </separated-files>
>                         </arity>
>                     </context>
>                 </action>

2. create jdk/make/netbeans/j2se/nbproject/ide-file-targets.xml file 
(it's partially generated by netbeans):
> <?xml version="1.0" encoding="UTF-8"?>
> <project basedir=".." name="JDK-IDE">
>     <property name="name" value="jdk"/>
>     <property name="root" value="../../.."/>
>     <property file="../common/architectures/name-${os.name}.properties"/>
>     <property name="platform" value="windows"/>
>     <property file="../common/architectures/arch-${os.arch}.properties"/>
>     <property name="arch" value="${os.arch}"/>
>     <property file="nbproject/private/build.properties"/>
>     <property file="${user.home}/.openjdk/${name}-build.properties"/>
>     <property file="${user.home}/.openjdk/build.properties"/>
>     <property file="build.properties"/>
>     <property name="bootstrap.jdk" value="${java.home}/.."/>
>     <property name="jtreg.home" value="${env.JT_HOME}"/>
>     <property name="jtreg.tests" value="**"/>
>     <!-- TODO: edit the following target according to your needs -->
>     <!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html#runsingle) -->
>     <target name="run-selected-file-in-test">
>         <fail unless="run.class">Must set property 'run.class'</fail>
>         <java classname="${run.class}" failonerror="true" fork="true">
>             <classpath>
>                 <pathelement path="${jtreg.home}/lib/testng.jar"/>
>             </classpath>
>         </java>
>     </target>
>     <target name="test-selected-file-in-test">
>         <fail unless="run.files">Must set property 'run.files'</fail>
>         <exec executable="${jtreg.home}/win32/bin/jtreg">
>             <arg value="-v1"/>
>             <arg value="-dir:${root}/test"/>
>             <arg value="-jdk:${bootstrap.jdk}"/>
>             <arg line="${run.files}"/>
>         </exec>
>     </target>
> </project>

3. open jdk/make/netbeans/j2se/nbproject
4. select your favorite tests in 'Tests' fileset
5. click 'Test File(s)' in a context menu or in 'Run' menu or press Ctrl-F6
6. ...
7. PROFIT

Hope you'll find it useful.

PS you have to set 'JT_HOME' environment variable, it should point to 
jtreg-root directory.

Igor

On 03/29/2014 10:58 PM, John Rose wrote:
> On Mar 28, 2014, at 2:29 AM, Vladimir Ivanov
> <vladimir.x.ivanov at oracle.com <mailto:vladimir.x.ivanov at oracle.com>> wrote:
>
>> PS: John mentioned recently that there's a convention for
>> java/lang/invoke tests to be in JUnit format. I'm not sure it'll
>> improve the code in any way (maybe TestNG will?). I hope John will
>> express his opinion on this, if it's important.
>
> If a test is in JUnit format, please keep it that way.  I (at least) run
> these tests from NetBeans which knows about JUnit.  Extracting logic
> from MHT and changing the test framework directly dilutes my interactive
> testing workflow.
>
> If my IDE had a jtreg plugin, I wouldn't need to worry about which jtreg
> tests use which style, but the world isn't perfect, yet.
>
> — John
>
> P.S. Same comment to the people that are eager to change JUnit to TestNG
> apparently just because it's the new thing.  TestNG was a step backwards
> in my workflow because the CLI *stinks* compared to JUnit, making it
> nigh-impossible to manually perform one-off runs.  I assume that will be
> fixed but for now I patch my workspace back to JUnit in order to work in
> my IDE.
>
>
>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>


More information about the mlvm-dev mailing list