changeset 39177:9d13e7c2d65e

8159834: Add some support for jtreg test headers in IntelliJ langtools project Summary: Add live templates to help creation of jtreg tests Reviewed-by: jlahoda
author mcimadamore
date Tue, 21 Jun 2016 15:31:08 +0100
parents eef1aa371e87
children 997c7bd366db
files langtools/make/build.xml langtools/make/intellij/utils/jtreg-live-templates.xml
diffstat 2 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/make/build.xml	Mon Jun 20 13:21:09 2016 -0700
+++ b/langtools/make/build.xml	Tue Jun 21 15:31:08 2016 +0100
@@ -235,7 +235,10 @@
     <target name="idea" depends="-check-langtools.jdk.home">
         <mkdir dir=".idea"/>
         <copy todir=".idea" >
-            <fileset dir="make/intellij" excludes="**/src/**"/>
+            <fileset dir="make/intellij">
+               <exclude name="**/src/**"/>
+               <exclude name="**/utils/**"/>
+            </fileset>
         </copy>
         <condition property="idea.jtreg.home" value="${jtreg.home}" else = "[jtreg.home]">
             <isset property="jtreg.home"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/intellij/utils/jtreg-live-templates.xml	Tue Jun 21 15:31:08 2016 +0100
@@ -0,0 +1,25 @@
+<!-- 
+The following live template declarations allow for automatic generation of jtreg test headers.
+Unfortunately, live templates cannot be shared on a per project base, but they can be easily imported
+by cutting and paste the following lines inside IntelliJ LiveTemplate settings (this will need to be done only once).
+-->
+     
+<template name="@test" value="@test&#10;* @bug $BUG_ID$&#10;* @summary $BUG_SUMMARY$&#10;* $JTREG_ACTION$ $FILE_NAME$" description="jtreg header (positive test)" toReformat="false" toShortenFQNames="true">
+  <variable name="BUG_ID" expression="groovyScript(&quot;_1 ==~ /T\\d{7}/ ? _1.substring(1).take(7) : 'NNNNNNN'&quot;, fileNameWithoutExtension())" defaultValue="" alwaysStopAt="true" />
+  <variable name="BUG_SUMMARY" expression="&quot;Bug summary&quot;" defaultValue="" alwaysStopAt="true" />
+  <variable name="JTREG_ACTION" expression="&quot;@compile&quot;" defaultValue="" alwaysStopAt="true" />
+  <variable name="FILE_NAME" expression="fileName()" defaultValue="" alwaysStopAt="true" />
+  <context>
+    <option name="JAVA_COMMENT" value="true" />
+  </context>
+</template>
+<template name="@test /nodynamiccopyright/" value="@test&#10;* @bug $BUG_ID$&#10;* @summary $BUG_SUMMARY$&#10;* $JTREG_ACTION$/fail/ref=$GOLDEN_NAME$ -XDrawDiagnostics $FILE_NAME$" description="jtreg header (negative test)" toReformat="false" toShortenFQNames="true">
+  <variable name="BUG_ID" expression="groovyScript(&quot;_1 ==~ /T\\d{7}/ ? _1.substring(1).take(7) : 'NNNNNNN'&quot;, fileNameWithoutExtension())" defaultValue="NNNNNNN" alwaysStopAt="true" />
+  <variable name="BUG_SUMMARY" expression="&quot;Bug summary&quot;" defaultValue="" alwaysStopAt="true" />
+  <variable name="JTREG_ACTION" expression="&quot;@compile&quot;" defaultValue="" alwaysStopAt="true" />
+  <variable name="GOLDEN_NAME" expression="groovyScript(&quot;_1 + '.out'&quot;, fileNameWithoutExtension())" defaultValue="out.txt" alwaysStopAt="true" />
+  <variable name="FILE_NAME" expression="fileName()" defaultValue="" alwaysStopAt="true" />
+  <context>
+    <option name="JAVA_COMMENT" value="true" />
+  </context>
+</template>