blob: e501a932f9661b1af177ba6f062bbb788f2cd48f [file] [log] [blame]
ndai91f5c9b2006-03-12 13:56:45 +00001<project name="Build specific targets and properties" default="test">
ndai91f5c9b2006-03-12 13:56:45 +00002
david_williams42f9b242006-11-27 18:45:14 +00003 <!-- Note to be cross-platform, "environment variables" are only appropriate for
4 some variables, e.g. ones we set, since properties are case sensitive, even if
5 the environment variables on your operating system are not, e.g. it will
6 be ${env.Path} not ${env.PATH} on Windows -->
7 <property environment="env" />
8
9
ndai91f5c9b2006-03-12 13:56:45 +000010 <!-- ===================================================================== -->
11 <!-- Steps to do after the build is done. -->
12 <!-- ===================================================================== -->
13 <target name="test">
14 <antcall target="runTest" />
15 </target>
16
17 <!-- ===================================================================== -->
18 <!-- Steps to do to test the build results -->
19 <!-- ===================================================================== -->
20 <target name="runTest">
david_williamsae0e4cb2006-11-11 02:55:51 +000021
ndai91f5c9b2006-03-12 13:56:45 +000022 <dirname file="${ant.file}" property="test.component.dir" />
23 <ant antfile="${wtp.builder.home}/scripts/build/label.xml" />
ndai91f5c9b2006-03-12 13:56:45 +000024 <property file="${wtp.builder.home}/build.properties" />
david_williamsf03431e2006-11-18 02:44:28 +000025 <property file="${buildDirectory}/label.properties" />
david_williams0987a072007-02-20 18:27:24 +000026 <property
27 name="dependencies.combined"
28 value="dependencies.combined.properties" />
ndai91f5c9b2006-03-12 13:56:45 +000029
30 <mkdir dir="${testRoot}" />
31 <mkdir dir="${testRoot}/results" />
32 <mkdir dir="${testRoot}/results/consolelogs" />
33
34 <copy todir="${testRoot}" overwrite="true">
35 <fileset dir="${test.component.dir}/testScripts">
36 </fileset>
37 </copy>
38
david_williams42f9b242006-11-27 18:45:14 +000039 <echo message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
ndai91f5c9b2006-03-12 13:56:45 +000040 <ant antfile="${test.component.dir}/testdependency.xml" target="get">
david_williams0987a072007-02-20 18:27:24 +000041 <property name="dependency.properties" value="${buildDirectory}/maps/releng.dali/maps/${dependencies.combined}" />
ndai91f5c9b2006-03-12 13:56:45 +000042 <property name="base.install.dir" value="${testRoot}" />
43 </ant>
david_williams0987a072007-02-20 18:27:24 +000044
45 <antcall target="unzipTests" />
ndai91f5c9b2006-03-12 13:56:45 +000046
47 <antcall target="runTestEclipse">
48 <param name="testTarget" value="all" />
49 </antcall>
50 <antcall target="postRunTestEclipse">
51 <param name="testTarget" value="all" />
52 </antcall>
53
ndai91f5c9b2006-03-12 13:56:45 +000054 </target>
55
david_williams0987a072007-02-20 18:27:24 +000056 <target name="unzipTests">
57
58 <!--unzip the builds and junit tests
59 we use 'unzip' here, so we can continue on error
60 (such as if zip was not created, due to other failures or options).
61 -->
62 <exec
63 dir="${buildDirectory}/${buildLabel}"
64 executable="unzip"
65 failonerror="false">
david_williamseb49d082007-05-01 03:03:15 +000066 <arg line="-o -qq wtp-jpt-${buildLabel}.zip -d ${testRoot}" />
david_williams0987a072007-02-20 18:27:24 +000067 </exec>
68
69 <exec
70 dir="${buildDirectory}/${buildLabel}"
71 executable="unzip"
72 failonerror="false">
david_williamseb49d082007-05-01 03:03:15 +000073 <arg line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
david_williams0987a072007-02-20 18:27:24 +000074 </exec>
75
76 </target>
david_williams0987a072007-02-20 18:27:24 +000077
david_williamseb49d082007-05-01 03:03:15 +000078 <property name="testTimeLimit" value="7200000" />
79 <property name="testFailOnError" value="false" />
80
81 <target name="runTestEclipse"
82 description="Run our JUnit's within an instance of antRunner">
83
84
85 <property name="test-vm" value="${env.JAVA_5_HOME}/bin/java" />
86 <property name="plugin-path"
87 value="${testRoot}/eclipse/plugins" />
88 <property name="vmargs"
89 value="-Xms256m -Xmx512m -Dosgi.ws=${env.BASEWS} -Dosgi.os=${env.BASEOS} -Dosgi.arch=${env.BASEARCH} -Dws=${env.BASEWS} -Dos=${env.BASEOS} -Darch=${env.BASEARCH} -Dosgi.clean=true -Dnoclean=true -DbuildBranch=${buildBranch} -DbuildType=${buildType} -DbuildId=${buildId} -DtestRoot=${testRoot} -DtestDir=${testRoot} -DbuildDirectory=${buildDirectory} -Dbuild.home=${env.BUILD_HOME} -DeclipseBuilderDirectory=${pde.builder.path} -DbuildLabel=${buildLabel} -Dtest-vm=${test-vm} -Dperf.buildId=${buildType}${date}-${time}" />
90
91
92 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
93 <property name="eclipse.home" value="${testRoot}" />
94
95 <echo message="Running junits" />
96
97 <!-- If there is not exactly one launcher in the stack,
98 we'd best fail fast, since we are not expecting that,
99 and may indicate an installation that would produce unpredictable
100 results -->
101 <!-- requires ant 1.7, and at this point, we're running 1.6 from
102 eclipse ...
103
104 <condition property="expectedNumberOfLaunchers">
105 <resourcecount when="equal" count="1" >
106 <fileset dir="${testRoot}/eclipse/plugins">
107 <include name="org.eclipse.equinox.launcher_*.jar" />
108 </fileset>
109 </resourcecount>
110 </condition>
111 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
112 -->
113 <!--
114 Remember: using -debug for org.eclipse.ant.core.antRunner
115 produces ant debug info to be output ... which is a TON of stuff
116 -->
117 <java
118 taskname="unit-test-masterprocess"
119 fork="true"
120 resultProperty="wtpmasterjunitresult"
121 failonerror="false"
122 timeout="${testTimeLimit}"
123 dir="${testRoot}/eclipse"
124 jvm="${env.JAVA_5_HOME}/bin/java"
125 classname="org.eclipse.equinox.launcher.Main">
126 <classpath>
127 <fileset dir="${testRoot}/eclipse/plugins">
128 <include name="org.eclipse.equinox.launcher_*.jar" />
129 </fileset>
130 </classpath>
131
132 <jvmarg value="-Xms256m"/>
133 <jvmarg value="-Xmx512m" />
134
david_williams42f9b242006-11-27 18:45:14 +0000135 <jvmarg value="-Dosgi.ws=${env.BASEWS}" />
136 <jvmarg value="-Dosgi.os=${env.BASEOS}" />
137 <jvmarg value="-Dosgi.arch=${env.BASEARCH}" />
david_williamseb49d082007-05-01 03:03:15 +0000138 <jvmarg value="-Dws=${env.BASEWS}" />
139 <jvmarg value="-Dos=${env.BASEOS}" />
140 <jvmarg value="-Darch=${env.BASEARCH}" />
141
142 <jvmarg value="-Dosgi.clean=true" />
ndai91f5c9b2006-03-12 13:56:45 +0000143 <jvmarg value="-Dnoclean=true" />
david_williamseb49d082007-05-01 03:03:15 +0000144 <jvmarg value="-DbuildBranch=${buildBranch}" />
ndai91f5c9b2006-03-12 13:56:45 +0000145 <jvmarg value="-DbuildType=${buildType}" />
146 <jvmarg value="-DbuildId=${buildId}" />
david_williamseb49d082007-05-01 03:03:15 +0000147
148 <arg value="-nosplash" />
149 <arg value="-consolelog" />
150
151 <arg value="-data" />
152 <arg value="${testRoot}/overallTestWorkspace" />
ndai91f5c9b2006-03-12 13:56:45 +0000153 <arg value="-application" />
154 <arg value="org.eclipse.ant.core.antRunner" />
155 <arg value="-file" />
david_williamseb49d082007-05-01 03:03:15 +0000156 <arg value="${testRoot}/test.xml" />
ndai91f5c9b2006-03-12 13:56:45 +0000157 <arg value="-logger" />
158 <arg value="org.apache.tools.ant.DefaultLogger" />
david_williamseb49d082007-05-01 03:03:15 +0000159 <env key="DISPLAY" value="${env.DISPLAY}" />
160 <redirector
161 output="${testRoot}/results/fullOutput.txt"
162 error="${testRoot}/results/fullErrorLog.txt"/>
163 <sysproperty key="build.home" value="${env.BUILD_HOME}" />
ndai91f5c9b2006-03-12 13:56:45 +0000164 <sysproperty key="buildDirectory" value="${buildDirectory}" />
david_williamseb49d082007-05-01 03:03:15 +0000165 <sysproperty key="buildLabel" value="${buildLabel}" />
ndai91f5c9b2006-03-12 13:56:45 +0000166 <sysproperty key="baseLocation" value="${baseLocation}" />
david_williamseb49d082007-05-01 03:03:15 +0000167 <sysproperty key="testRoot" value="${testRoot}" />
ndai91f5c9b2006-03-12 13:56:45 +0000168 <sysproperty key="testDir" value="${testRoot}" />
david_williamseb49d082007-05-01 03:03:15 +0000169 <sysproperty key="perf.buildId"
170 value="${buildType}${date}-${time}" />
171 <sysproperty key="eclipseBuilderDirectory"
172 value="${pde.builder.path}" />
173 <sysproperty key="buildLabel" value="${buildLabel}" />
ndai91f5c9b2006-03-12 13:56:45 +0000174 </java>
david_williamseb49d082007-05-01 03:03:15 +0000175
176 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
ndai91f5c9b2006-03-12 13:56:45 +0000177 </target>
178
179 <target name="postRunTestEclipse">
180 <copy todir="${buildDirectory}/${buildLabel}/testResults" overwrite="true">
181 <fileset dir="${testRoot}/results">
182 <include name="**/*.*" />
183 </fileset>
184 </copy>
185 </target>
186
ndai91f5c9b2006-03-12 13:56:45 +0000187</project>