Skip to main content
summaryrefslogtreecommitdiffstats
blob: 59d08593892b5b242658cca2433d1aeaff47e417 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<%!
/*  Copyright 2008 IBM Corp.  All rights reserved.  This source code is made available under the terms of the Eclipse Public License, v1.0. */
%>
<project name="Automated Testing" default="all"  basedir="." >

	<!--properties file containing the plugin directory name including version number-->
	<property file="test.properties" />
	
	<!-- urls and such from the build -->
	<property file="${basedir}/../../../build.cfg" />

	<!--default directory where test-eclipse will be installed-->
	<property name="install" value="${basedir}/target" />
	
	<!--name that can be added to report name to identify which platform tests results come from-->
	<property name="platform" value="" />

	<!-- The root of the eclipse installation -->
	<property name="eclipse-home" value="${install}/eclipse" />

	<!-- The directory that will contain the xml and html results from the tests that are run -->
 	<property name="results" value="${basedir}/results" />

	<target name="setup" if="clean" description="Reinstall the test Eclipse installation if specified by user">
		<delete dir="${install}" /><mkdir dir="${install}" />
		
		<!-- TODO: if your project requires more dependencies, add them here -->
		<echo message="Download, then unpack: Eclipse, EMF ..." />
		<property name="common.releng.dir" value="${basedir}/../../../org.eclipse.modeling.common.releng"/>
		<property name="getTestDependencies.xml" value="${common.releng.dir}/scripts/getTestDependencies.xml"/>
		<ant target="getTestDependency" antfile="${getTestDependencies.xml}" dir="${common.releng.dir}">
			<property name="url" value="${eclipseURL}" />
			<property name="file" value="${eclipseFile}" />
			<property name="unpackDest" value="${install}"/>
		</ant>
		<ant target="getTestDependency" antfile="${getTestDependencies.xml}" dir="${common.releng.dir}">
			<property name="url" value="${emfURL}" />
			<property name="file" value="${emfFile}" />
			<property name="unpackDest" value="${install}"/>
		</ant>

		<property name="dir" location="."/>
		<echo message="Unpack SDK + JUnit Tests (${dir}/<c:get select="$build/@parentProjectName"/>-*.zip) ..."/>		
		<unzip dest="${install}" overwrite="true">
		    <fileset dir="${dir}"><include name="**/<c:get select="$build/@parentProjectName"/>-*.zip"/></fileset>
		</unzip>
	</target>

	<target name="runtests" depends="setup" description="Runs ant on the test.xml for a specified plugin.  Requires a property value setting for testPlugin only if test.properties is not available.  The property testPlugin represents a directory name made up of the plugin id and plugin version.  This directory must contain a valid test.xml.">
<c:if test="$build/@testsAreJarred = 'false'">
		<echo message="${eclipse-home}/plugins/${testPlugin} is not a jarred plugin. No unpack required!"/>
</c:if>
		<echo message="Unpack ${eclipse-home}/plugins/${testPlugin}.jar to ${eclipse-home}/plugins/${testPlugin} ... "/>
		<move file="${eclipse-home}/plugins/${testPlugin}.jar" tofile="${eclipse-home}/plugins/${testPlugin}_.jar"/>
		<unjar src="${eclipse-home}/plugins/${testPlugin}_.jar" dest="${eclipse-home}/plugins/${testPlugin}"/>
		<delete file="${eclipse-home}/plugins/${testPlugin}_.jar"/>
		
		<echo message="Running test.xml from jarfile ${eclipse-home}/plugins/${testPlugin} ... "/>
		<ant antfile="${eclipse-home}/plugins/${testPlugin}/test.xml" dir="${eclipse-home}"/>
		<copy file="${eclipse-home}/${report}.xml" tofile="${results}/xml/${report}_${platform}.xml" />
	</target>

	<target name="<c:get select="$build/@parentProjectName"/>" description="Runs the test.xml of the tests plugin">
		<antcall target="runtests">
			<param name="testPlugin" value="${org.eclipse.<c:get select="$build/@projectNamespace"/>.tests}" />
			<param name="report" value="org.eclipse.<c:get select="$build/@projectNamespace"/>.tests" />
		</antcall>

		<!-- test if chkpii script exists before proceeding -->
		<property name="common.releng.dir" value="${basedir}/../../../org.eclipse.modeling.common.releng"/>
		<property name="chkpii.xml" value="${common.releng.dir}/scripts/chkpii.xml"/>
		<available file="${chkpii.xml}" property="chkpiiXMLAvailable"/>
		<antcall target="runChkpii"/>
	</target>

	<target name="runChkpii" if="chkpiiXMLAvailable">
		<ant target="chkpii" antfile="${chkpii.xml}" inheritall="true">
			<property name="zipPattern" value="<c:get select="$build/@parentProjectName"/>-*.zip"/>
		</ant>
	</target>

	<target name="all">
		<antcall target="<c:get select="$build/@parentProjectName"/>" />
		<antcall target="genHtml" />
	</target>
	
	<target name="genHtml" description="Generates HTML results with provided JUNIT.XSL provided">
		<style style="JUNIT.XSL" basedir="${results}/xml" destdir="${results}/html" />
	</target>
</project>

Back to the top