File: buildTests.xml

package info (click to toggle)
eclipse 3.8.1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 338,456 kB
  • ctags: 472,713
  • sloc: java: 2,762,069; ansic: 136,783; xml: 105,676; cpp: 35,759; jsp: 4,420; sh: 3,288; perl: 1,687; makefile: 232; python: 67; php: 24
file content (243 lines) | stat: -rw-r--r-- 12,438 bytes parent folder | download | duplicates (3)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<project name="Eclipse SDK Test build" default="runTests" basedir=".">
	
	<!-- check java -->
	<property environment="env"/>
		<property name="jhome" value="${env.JAVA_HOME}"/>
		<condition property="javaHomeExists">
			<resourceexists>
				<file file="${jhome}"/>
			</resourceexists>
		</condition>
	<fail unless="javaHomeExists" message="JAVA_HOME is not set properly"/>
	

	<!-- load properties used by build.xml -->
	<loadproperties srcFile="build.properties"/>
	<!-- Distros with alternative JUnit 4 JAR locations should pass this
	     parameter in to ant -->
	<property name="junit4JarLocation" value="/usr/share/java/junit4.jar" />

	<property name="topBuildDir" value="${basedir}/build" />
	<property name="homeDir" value="${basedir}/home" />
	<property name="baseworkspace" value="${basedir}/baseworkspace" />
	<property name="buildworkspace" value="${basedir}/buildworkspace" />
	<property name="buildDirectory" value="${topBuildDir}/eclipse-${label}-src" />
	<property name="testsBuildDir" value="${basedir}/testsBuild" />
	<property name="testsBuildDirectory" value="${testsBuildDir}/eclipse-sdktests-${label}-src" />
	<property name="provisionDir" value="${buildDirectory}/installation" />
	<property name="provisionWithTestsDir" value="${buildDirectory}/installationWithTests" />

	<available file="eclipse-sdktests-${label}-src.tar.bz2" property="testsSourcePresent" value="true" />
	<available file="eclipse-sdktests-${label}-scripts.tar.bz2" property="testsScriptsPresent" value="true" />
	
	<!-- check what is already done -->
	<uptodate property="testsunpack.complete" srcfile="${basedir}/eclipse-sdktests-${label}-src.tar.bz2" targetfile="testsunpack-stamp" />
	<uptodate property="testspatch.complete" srcfile="testsunpack-stamp" targetfile="testspatch-stamp" />
	<uptodate property="testsbuild.complete" srcfile="testspatch-stamp" targetfile="testsbuild-stamp" />
	
	<target name="fetchTestSources" unless="testsSourcePresent">
		<fail message="SDK tests source tarball eclipse-sdktests-${label}-src.tar.bz2 is not present.  Please either download a file such as eclipse-${label}-src.tar.bz2 from http://download.eclipse.org/technology/linuxtools/eclipse-build/, generate one by running ./buildSDKSource.sh or correct build.properties file to reflect your tarball version." />
	</target>

	<target name="fetchTestScripts" unless="testsScriptsPresent">
		<fail message="Scripts for the SDK tests tarball eclipse-sdktests-${label}-scripts.tar.bz2 are not present.  Please either download a file such as eclipse-sdktests-${label}-scripts.tar.bz2 from http://download.eclipse.org/technology/linuxtools/eclipse-build/, generate one by running ./buildSDKSource.sh or correct build.properties file to reflect your tarball version." />
	</target>

	<target name="checkDebugAndVerbose">
		<condition property="bothDebugAndVerbose.set">
			<and>
				<isset property="debugTests" />
				<isset property="verboseTests" />
			</and>
		</condition>
	</target>
	
	<target name="setPDEBuildPath" depends="provisionSDKinDropins">
			<path id="pdebuilddir.id">
				<dirset dir="${provisionDir}/dropins/sdk/plugins">
					<include name="org.eclipse.pde.build_*" />
				</dirset>
			</path>

			<property name="pdebuilddir" refid="pdebuilddir.id" />
	</target>

	<target name="setDebugAndVerbose" depends="checkDebugAndVerbose" if="bothDebugAndVerbose.set">
		<property name="testSwitches" value="-dv" />
	</target>

	<target name="setDebugTests" if="debugTests">
		<property name="testSwitches" value="-d" />
	</target>

	<target name="setVerboseTests" if="verboseTests">
		<property name="testSwitches" value="-v" />
	</target>

	<target name="setDebugAndVerboseArgs" depends="setDebugAndVerbose,setDebugTests,setVerboseTests" />

	<target name="provisionSDKinDropins">
		<ant antfile="build.xml" target="provisionSDKinDropins"/>
	</target>
	
	<target name="buildHelperTask" >
		<ant antfile="build.xml" target="buildHelperTask"/>
		<taskdef name="symlinkOSGiJars" classname="org.eclipse.linuxtools.eclipsebuild.SymlinkOSGiJars" classpath="${basedir}/task-bin" />
		<taskdef name="symlinkInstalledOSGiJars" classname="org.eclipse.linuxtools.eclipsebuild.SymlinkInstalledOSGiJars" classpath="${basedir}/task-bin" />
		<taskdef name="symlinkNonOSGiJars" classname="org.eclipse.linuxtools.eclipsebuild.SymlinkNonOSGiJars" classpath="${basedir}/task-bin" />
	</target>
	
	<target name="applyTestPatches" depends="unpackTests" unless="testspatch.complete">
		<patch patchfile="${basedir}/patches/tests-noapttests.patch" dir="${testsBuildDirectory}/features/org.eclipse.sdk.tests" strip="0" />
		<patch patchfile="${basedir}/patches/tests-noequinoxregiontests.patch" dir="${testsBuildDirectory}/features/org.eclipse.sdk.tests" strip="0" />
		<patch patchfile="${basedir}/patches/tests-BZ295666.patch" dir="${testsBuildDirectory}" strip="0" />
		<patch patchfile="${basedir}/patches/tests-org.eclipse.pde.ui.tests-LocalTargetDefinitionTests.patch" dir="${testsBuildDirectory}/plugins/org.eclipse.pde.ui.tests" strip="0" />
		<patch patchfile="${basedir}/patches/tests-nop2discoverytests.patch" dir="${testsBuildDirectory}/features/org.eclipse.sdk.tests" strip="0" />
		<patch patchfile="${basedir}/patches/tests-org.eclipse.ant.tests.core.patch" dir="${testsBuildDirectory}/plugins/org.eclipse.ant.tests.core" strip="0" />
		<patch patchfile="${basedir}/patches/tests-org.eclipse.ant.tests.ui.patch" dir="${testsBuildDirectory}/plugins/org.eclipse.ant.tests.ui" strip="0" />

		<!-- remove when 373107 is fixed -->
		<patch patchfile="${basedir}/patches/tests-unpackAntUITests.patch" dir="${testsBuildDirectory}/features/org.eclipse.sdk.tests" strip="0" />
		<echo file="testspatch-stamp" />
	</target>
			
	<target name="unpackTests" depends="fetchTestSources,fetchTestScripts" unless="testsunpack.complete">
		<delete dir="${testsBuildDir}" />
		<mkdir dir="${testsBuildDir}" />

		<!-- User home used for build -->
		<delete dir="${homeDir}" />
		<mkdir dir="${homeDir}" />

		<!-- Workspaces used for build -->
		<delete dir="${baseworkspace}" />
		<mkdir dir="${baseworkspace}" />
		<delete dir="${buildworkspace}" />
		<mkdir dir="${buildworkspace}" />

		<echo message="Extracting SDK tests source (tar jxf eclipse-sdktests-${label}-src.tar.bz2)" />
		<untar dest="${testsBuildDir}" src="${basedir}/eclipse-sdktests-${label}-src.tar.bz2" compression="bzip2" />
		<untar dest="${testsBuildDir}" src="${basedir}/eclipse-sdktests-${label}-scripts.tar.bz2" compression="bzip2" />
		<move todir="${testsBuildDir}">
			<fileset dir="${testsBuildDir}/eclipse-sdktests-${label}-scripts">
				<include name="**/*" />
			</fileset>
		</move>

		<!-- Create a stamp file -->
		<echo file="testsunpack-stamp" />
	</target>
	
		
	<target name="buildTests" depends="provisionSDKinDropins,applyTestPatches,setPDEBuildPath" unless="testsbuild.complete">

			<!-- Test framework -->
			<exec executable="${provisionDir}/eclipse" failonerror="true">
				<arg line="-nosplash " />
				<arg line="-consolelog " />
				<arg line="-application org.eclipse.ant.core.antRunner " />
				<arg line="-buildfile ${pdebuilddir}/scripts/build.xml" />
				<arg line="-propertyfile ${basedir}/build.properties " />
				<arg line="-DbuildDirectory=${testsBuildDirectory} " />
				<arg line="-Dtype=feature -Did=org.eclipse.test " />
				<arg line="-DbaseLocation=${provisionDir} " />
				<arg line="-DbuildLabel=${testsBuildLabel} " />
				<arg line="-data ${buildworkspace} " />
			</exec>
			<!-- SDK tests -->
			<exec executable="${provisionDir}/eclipse" failonerror="true">
				<arg line="-nosplash " />
				<arg line="-consolelog " />
				<arg line="-application org.eclipse.ant.core.antRunner " />
				<arg line="-buildfile ${pdebuilddir}/scripts/build.xml" />
				<arg line="-propertyfile ${basedir}/build.properties " />
				<arg line="-DbuildDirectory=${testsBuildDirectory} " />
				<arg line="-Dtype=feature -Did=org.eclipse.sdk.tests " />
				<arg line="-DbaseLocation=${provisionDir} " />
				<arg line="-DbuildLabel=${testsBuildLabel} " />
				<arg line="-data ${buildworkspace} " />
			</exec>
			<echo file="testsbuild-stamp" />
		</target>
	
	
	<target name="runTests" depends="buildTests,setDebugAndVerboseArgs, buildHelperTask">
			<!-- These two next calls just set the properties to an empty string if they are not previously set -->
			<property name="debugTestsSwitch" value="" />
			<property name="verboseTestsSwitch" value="" />

			<!-- Install a clean SDK for testing -->
			<ant antfile="build.xml" target="provision">
				<property name="provisionDir" value="${provisionWithTestsDir}"/>
				<property name="p2.director.installIU" value="org.eclipse.sdk.ide" />
				<property name="profileName" value="SDKProfile" />
			</ant>

			<fileset id="junit4.jar" dir="${provisionWithTestsDir}/plugins">
				<include name="**/org.junit4_**/junit.jar" />
			</fileset>
			<property name="junit4jar.path" refid="junit4.jar" />

			<delete file="${provisionWithTestsDir}/plugins/${junit4jar.path}" />
			<symlink link="${provisionWithTestsDir}/plugins/${junit4jar.path}" resource="${junit4JarLocation}" />

			<!-- Re-symlink system JARs -->
			<symlinkInstalledOSGiJars dependencies="${basedir}/dependencies/dependencies.properties" topLevelDir="${provisionWithTestsDir}/plugins" />
			<symlinkNonOSGiJars dependencies="${basedir}/dependencies/nonosgidependencies.properties" topLevelDir="${provisionWithTestsDir}/plugins" />
			<symlinkInstalledOSGiJars dependencies="${basedir}/dependencies/jdtdependencies.properties" topLevelDir="${provisionWithTestsDir}/plugins" />
			<symlinkNonOSGiJars dependencies="${basedir}/dependencies/jdtnonosgidependencies.properties" topLevelDir="${provisionWithTestsDir}/plugins" />
			<symlinkInstalledOSGiJars dependencies="${basedir}/dependencies/sdkdependencies.properties" topLevelDir="${provisionWithTestsDir}/plugins" />
			
			<!-- Install test framework -->
			<ant antfile="build.xml" target="provision">
				<property name="provisionDir" value="${provisionWithTestsDir}"/>
				<property name="reposource" value="${testsBuildDirectory}/buildRepo" />
				<property name="p2.director.installIU" value="org.eclipse.test.feature.group" />
				<property name="profileName" value="SDKProfile" />
			</ant>
			
			<echo message="###################################################################" />
			<echo message="#                                                                 #" />
			<echo message="#             Please post and discuss results here:               #" />
			<echo message="# http://wiki.eclipse.org/Linux_Tools_Project/Eclipse_Build/Tests #" />
			<echo message="#                                                                 #" />
			<echo message="###################################################################" />
			<echo message="" />
			<tstamp>
				<format property="timestamp" pattern="yyyyMMddHHmmss" />
			</tstamp>
			<chmod perm="ugo+rx" file="${basedir}/runtests.sh" />
			<!--
			<echo message="Calling runtests with (debug, verbose) = (${testSwitches})" />
			-->
			<exec executable="${basedir}/runtests.sh" dir="${basedir}">
				<arg value="-t${timestamp}" />
				<arg value="-b ${testsBuildDirectory}" />
				<arg value="-p ${provisionWithTestsDir}" />
				<arg value="${testSwitches}" />
			</exec>
			<property name="testResultDir" value="${basedir}/tests_${timestamp}/results" />
			<!-- Copy over the XML to generate a top-level report for all of the tests -->
			<mkdir dir="${testResultDir}/origXml" />
			<copy failonerror="false" todir="${testResultDir}/origXml">
				<fileset dir="${testResultDir}/xml">
					<include name="**/*" />
				</fileset>
			</copy>
			<!-- Un-"collect" the results -->
			<replace dir="${testResultDir}/origXml" value="">
				<include name="**/*.xml" />
				<replacetoken>&lt;testsuites&gt;</replacetoken>
			</replace>
			<replace dir="${testResultDir}/origXml" value="">
				<include name="**/*.xml" />
				<replacetoken>&lt;/testsuites&gt;</replacetoken>
			</replace>
			<!-- Aggregate XML report files -->
			<junitreport todir="${testResultDir}/xml" tofile="org.eclipse.sdk.tests.xml">
				<fileset dir="${testResultDir}/origXml" includes="*.xml" />
			</junitreport>
			<!-- Generate top-level HTML report -->
			<xslt style="${provisionWithTestsDir}/plugins/${testframework}/JUNIT.XSL" basedir="${testResultDir}/xml" includes="org.eclipse.sdk.tests.xml" destdir="${testResultDir}/html" />
		</target>
</project>