carbidecpp22devenv/plugins/org.eclipse.test_3.2.0/library.xml
changeset 637 0c11af94aac6
equal deleted inserted replaced
636:3ef299ba838f 637:0c11af94aac6
       
     1 <?xml version="1.0"?>
       
     2 <project name="Library" default="usage" basedir=".">
       
     3 
       
     4 	<target name="usage">
       
     5 		<echo message="Please refer to the testframework.html in org.eclipse.test for instructions on usage." />
       
     6 	</target>
       
     7 
       
     8 	<target name="init">
       
     9 		<!-- 
       
    10 			Parameters:
       
    11 				(Mandatory)
       
    12 				data-dir		- the directory for Eclipse to write its data
       
    13 				plugin-name		- the name of the plugin to test
       
    14 				classname		- the name of the test class
       
    15 				
       
    16 				(Optional - overrides defaults set in script)
       
    17 				vmargs			- a string containing arguments to pass to the VM.
       
    18 				extraVMargs		- allows separate setting of VM args from separate caller.
       
    19 				timeout			- overrides default test timeout value (in milliseconds).
       
    20 				test-output		- overrides default output file produced from test run.
       
    21 				plugin-path		- path to root of plug-in
       
    22 				useEclipseExe	- property setting forces test to launch via eclipse executable.
       
    23 				junit-report-output - output directory for junit reports produced for specified classname.
       
    24 		-->
       
    25 		
       
    26 	  	<tstamp>
       
    27 	        <format property="TIMENOW" pattern="HHmmssSSSS"/>
       
    28 	    </tstamp>
       
    29 		<!--property setting useEclipseExe launches tests using the eclipse executable-->
       
    30 		<condition property="launchTarget" value="eclipse-test">
       
    31 			<isset property="useEclipseExe" />
       
    32 		</condition>
       
    33 		<!--default launch target for launching tests-->
       
    34 		<property name="launchTarget" value="java-test" />
       
    35 		<property name="formatter" value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
       
    36 	    
       
    37 		<!--default heap sizes when running performance tests-->
       
    38 	    <condition property="vmargs" value=" -Xms256M -Xmx256M">
       
    39 			<equals arg1="${test.target}" arg2="performance" />
       
    40 	    </condition>
       
    41 		<property name="extraVMargs" value=""/>
       
    42 		<property name="plugin-path" value="" />
       
    43 		<property name="timeout" value="7200000" />
       
    44 		<property name="test-output" value="${eclipse-home}/${classname}.xml" />
       
    45 		<property name="junit-report-output" value="${eclipse-home}/results" />
       
    46 		<mkdir dir="${junit-report-output}"/>
       
    47 	</target>
       
    48 	
       
    49 	<target name="core-test" description="Eclipse application used to launch HEADLESS plugin tests." depends="init">
       
    50 		<antcall target="${launchTarget}">
       
    51 			<param name="application" value="org.eclipse.test.coretestapplication"/>
       
    52 		</antcall>
       
    53 	</target>
       
    54 	
       
    55 	<target name="ui-test" description="Eclipse application used to launch UI plugin tests." depends="init">
       
    56 		<antcall target="${launchTarget}">
       
    57 			<param name="application" value="org.eclipse.test.uitestapplication"/>
       
    58 		</antcall>
       
    59 	</target>
       
    60 
       
    61 	<target name="java-test">
       
    62 		<!--default vm args-->
       
    63 		<property name="vmargs" value=" -Xms40m -Xmx256m"/>
       
    64 	  	
       
    65 	  	<!--set default jvm to use for testing-->
       
    66 	   	<property name="jvm" value="${java.home}/bin/java" />  	
       
    67 	
       
    68 		<echo message="Running ${classname}. Result file: ${junit-report-output}/${classname}.xml."/>
       
    69 		
       
    70 		<java fork="true" dir="." timeout="${timeout}" jvm="${jvm}" logError="true"
       
    71 			classname="org.eclipse.core.launcher.Main" output="${junit-report-output}/${classname}.txt">
       
    72 	        <classpath>
       
    73 	    		<fileset dir="${eclipse-home}/plugins">
       
    74 	            	<include name="org.eclipse.equinox.launcher_*.jar"/>
       
    75 	          	</fileset>
       
    76 	        </classpath>
       
    77 		    <arg line="-application ${application}"/>
       
    78 		    <arg line="-data ${data-dir}"/>
       
    79 		    <arg line="formatter=${formatter},${test-output}"/>
       
    80 		    <arg line="-testPluginName ${plugin-name}"/>
       
    81 		    <arg line="-className ${classname}"/>
       
    82 		    <arg line="-os ${os}"/>
       
    83 		    <arg line="-ws ${ws}"/>
       
    84 		    <arg line="-arch ${arch}"/>
       
    85 		    <arg line="-consolelog"/>
       
    86 		    <jvmarg line="${vmargs} ${extraVMargs}"/>
       
    87 		    <sysproperty key="PLUGIN_PATH" value="${plugin-path}"/> 
       
    88 		</java>
       
    89 		<antcall target="collect-results" />
       
    90 	</target>
       
    91 	
       
    92 	<target name="eclipse-test" description="Runs the specified classname as a plug-in test.">		
       
    93 		<property name="vmargs" value="-Xms256m -Xmx512m"/>
       
    94 		
       
    95 		<!--use -consolelog if launching a headless test-->
       
    96 		<condition property="consolelog" value="-consolelog">
       
    97 			<equals arg1="${application}" arg2="org.eclipse.test.coretestapplication"/>
       
    98 		</condition>
       
    99 		<property name="consolelog" value="" />
       
   100 
       
   101 		<!--
       
   102 			vm selection priority:
       
   103 			1.  user-specified java executable via outer Ant property setting of "jvm".
       
   104 			2.  java executable on path.
       
   105 		-->
       
   106 		<condition property="test-vm" value="-vm ${jvm}">
       
   107 			<isset property="jvm" />
       
   108 		</condition>
       
   109 		<property name="test-vm" value="" />
       
   110 		
       
   111 		<!--ensure executable has execute permission-->
       
   112 		<chmod file="${eclipse-home}/eclipse" perm="ugo+rx"/>
       
   113 		
       
   114 		
       
   115 		<echo message="Running ${classname}. Result file: ${junit-report-output}/${classname}.xml."/>
       
   116 
       
   117 		<exec executable="${eclipse-home}/eclipse" dir="${eclipse-home}" timeout="${timeout}" logError="true" failonerror="false" output="${junit-report-output}/${classname}.txt">
       
   118 			<arg line="-data ${data-dir}"/>
       
   119 			<arg line="${test-vm}"/>
       
   120 			<arg line="-application ${application}"/>
       
   121 			<arg line="formatter=${formatter},${test-output}"/>
       
   122 			<arg line="-testPluginName ${plugin-name}"/>
       
   123 			<arg line="-className ${classname}"/>
       
   124 			<arg line="-nosplash"/>
       
   125 			<arg line="--launcher.suppressErrors"/>
       
   126 			<arg line="${consolelog}"/>
       
   127 			<arg line="-vmargs ${vmargs} ${extraVMargs} -DPLUGIN_PATH=${plugin-path}"/>
       
   128 		</exec>
       
   129 		<antcall target="collect-results" />
       
   130 	</target>
       
   131 	
       
   132 	<target name="collect-results">
       
   133 		<dirname property="output-dir" file="${test-output}"/>
       
   134 		<basename property="output-file-name" file="${test-output}"/>
       
   135 		<junitreport todir="${junit-report-output}" tofile="${classname}.xml">
       
   136 			<fileset dir="${output-dir}">
       
   137 				<include name="${output-file-name}"/>
       
   138 			</fileset>
       
   139 		</junitreport>
       
   140 
       
   141 		<style style="${eclipse-home}/dropins/eclipse/plugins/org.eclipse.test/JUNIT.XSL"
       
   142 			basedir="${junit-report-output}"
       
   143 			includes="${classname}.result.xml"
       
   144 			destdir="${junit-report-output}" />
       
   145 
       
   146 		<!--save .log content and *.log content from configuration directory-->
       
   147 		<concat destfile="${junit-report-output}/${classname}.log">
       
   148 			<fileset dir="${eclipse-home}" includes="${data-dir}/.metadata/*.log"/>
       
   149 			<fileset dir="${eclipse-home}" includes="configuration/*.log"/>
       
   150 		</concat>
       
   151 	</target>
       
   152 
       
   153 	<target name="collect">
       
   154 		<!--
       
   155 			This target can be used to aggragate test runs from multiple test suites into a single report.
       
   156 		
       
   157 			Parameters to this target:
       
   158 			includes		- the names of the files to include
       
   159 			output-file		- the name of the output file to produce
       
   160 		-->
       
   161 		<junitreport todir="." tofile="${output-file}">
       
   162 			<fileset dir=".">
       
   163 				<include name="${includes}"/>
       
   164 			</fileset>
       
   165 		</junitreport>
       
   166 	</target>
       
   167 
       
   168 </project>
       
   169