| <?xml version="1.0" encoding="UTF-8"?> |
| <project |
| name="collectTestResults" |
| default="collectTestResults" |
| basedir="."> |
| |
| <!-- example properties. Caller normally provides. --> |
| <property |
| name="job" |
| value="ep4-unit-mac64" /> |
| <property |
| name="buildNumber" |
| value="49" /> |
| <property |
| name="buildId" |
| value="N20121014-2000" /> |
| <property |
| name="eclipseStream" |
| value="4.3.0" /> |
| <property |
| name="EBUILDER_HASH" |
| value="master" /> |
| |
| |
| <target |
| name="collectTestResults" |
| depends="init" |
| description="Collect Test Results from Hudson to build machine location."> |
| |
| |
| <fail unless="buildNumber" /> |
| |
| <retry |
| retrycount="3" |
| retrydelay="1000"> |
| <get |
| ignoreerrors="true" |
| verbose="true" |
| src="${hudsonResultURL}" |
| dest="${tmpzipdir}/archive.zip" /> |
| </retry> |
| |
| <echo message="hudsonTestResultsURL ${hudsonTestResultsURL} " /> |
| <retry |
| retrycount="3" |
| retrydelay="1000"> |
| <get |
| src="${hudsonTestResultsURL}" |
| dest="${resultsDir}/${job}-${buildNumber}.xml" /> |
| </retry> |
| |
| <!-- not sure if mkdir needed? --> |
| <mkdir dir="${resultsDir}/directorLogs" /> |
| |
| <unzip |
| overwrite="true" |
| src="${tmpzipdir}/archive.zip" |
| dest="${resultsDir}/"> |
| <globmapper |
| from="archive/workarea/${buildId}/eclipse-testing/results/*" |
| to="*" /> |
| </unzip> |
| |
| <exec |
| executable="/bin/bash" |
| failonerror="true"> |
| <arg value="${UTILITIES_HOME}/sdk/promotion/updateDropLocation.sh" /> |
| <arg value="${eclipseStream}" /> |
| <arg value="${buildId}" /> |
| <arg value="${EBUILDER_HASH}" /> |
| <arg value="${job}" /> |
| <arg value="${buildNumber}" /> |
| </exec> |
| |
| <delete failonerror="false"> |
| <fileset dir="${resultsDir}"> |
| <include name="${tmpzipdir}" /> |
| <include name="archive/**" /> |
| </fileset> |
| </delete> |
| |
| </target> |
| |
| <target |
| name="init" |
| unless="collectTestResultsInitialized"> |
| |
| <property environment="env" /> |
| <echo message="env.BUILD_HOME: ${env.BUILD_HOME}" /> |
| |
| <condition property="UTILITIES_HOME" value="${env.WORKSPACE}/utilities/production" else="/shared/eclipse"> |
| <isset property="env.WORKSPACE"/> |
| </condition> |
| |
| <condition |
| property="env.HUDSON_ROOT_URI" |
| value="shared"> |
| <and> |
| <contains |
| string="${job}" |
| substring="46M" |
| casesensitive="yes" /> |
| <contains |
| string="${job}" |
| substring="gtk2" |
| casesensitive="yes" /> |
| </and> |
| </condition> |
| |
| <condition |
| property="env.HUDSON_ROOT_URI" |
| value="platform"> |
| <contains |
| string="${job}" |
| substring="gtk" |
| casesensitive="yes" /> |
| </condition> |
| <property |
| name="env.HUDSON_ROOT_URI" |
| value="shared" /> |
| |
| <!-- we set these "env" variables here not to effect the |
| environment, but that because we need some value for them, |
| so if not actually set in the environment, we create these |
| with some reasonable default. (Though, if not set in the environment, |
| could be a sign that somethign is not as expected?) |
| --> |
| <condition |
| property="hudsonHost" |
| value="${env.HUDSON_PERF_HOST}"> |
| <and> |
| <isset property="HUDSON_PERF_HOST" /> |
| <contains |
| string="${job}" |
| substring="-perf-lin" |
| casesensitive="yes" /> |
| </and> |
| </condition> |
| <!-- if that didn't set hudsonHost, check env variable before using fallback default --> |
| <condition |
| property="hudsonHost" |
| value="${env.HUDSON_HOST}" |
| else="hudson.eclipse.org"> |
| <isset property="env.HUDSON_HOST" /> |
| </condition> |
| |
| |
| <property |
| name="env.HUDSON_PROTOCOL" |
| value="https" /> |
| <property |
| name="env.HUDSON_PORT" |
| value="443" /> |
| |
| <!-- if not set externally, set to eclipse default (for -perf-lin jobs) --> |
| <property |
| name="env.LINUX_PERF_SEGMENT" |
| value="perftests" /> |
| |
| |
| |
| <condition |
| property="hudsonPathSegment" |
| value="${env.LINUX_PERF_SEGMENT}" |
| else="${env.HUDSON_ROOT_URI}"> |
| <and> |
| <isset property="env.LINUX_PERF_SEGMENT" /> |
| <contains |
| string="${job}" |
| substring="-perf-lin" |
| casesensitive="yes" /> |
| </and> |
| </condition> |
| |
| <property |
| name="env.BUILD_HOME" |
| value="/shared/eclipse/builds" /> |
| |
| <echo message="env.BUILD_HOME: ${env.BUILD_HOME}" /> |
| |
| |
| <script language="javascript"><![CDATA[ |
| var buildId = project.getProperty("buildId"); |
| var patternbuildType = new RegExp(/^([IMXYNSRU])(\d{8})-(\d{4})$/); |
| |
| var sArraybuildType = patternbuildType.exec(buildId); |
| // sArray 0 is "whole match" |
| var buildType = sArraybuildType[1]; |
| project.setProperty("buildType", buildType); |
| |
| var eclipseStream = project.getProperty("eclipseStream"); |
| var patternStream = new RegExp(/(\d+)\.(\d+)\.(\d+)/); |
| |
| var sArrayStream = patternStream.exec(eclipseStream); |
| // sArray[0] is "whole match" |
| var eclipseStreamMajor = sArrayStream[1]; |
| var eclipseStreamMinor = sArrayStream[2]; |
| var eclipseStreamService = sArrayStream[3]; |
| project.setProperty("eclipseStreamMajor", eclipseStreamMajor); |
| project.setProperty("eclipseStreamMinor", eclipseStreamMinor); |
| project.setProperty("eclipseStreamService", eclipseStreamService); |
| |
| var buildhome = project.getProperty("env.BUILD_HOME"); |
| |
| var buildRoot= buildhome + "/" + eclipseStreamMajor + buildType; |
| project.setProperty("buildRoot", buildRoot); |
| var siteDir= buildRoot + "/siteDir"; |
| var postingDirectory = siteDir + "/eclipse/downloads/drops" |
| if (eclipseStreamMajor > 3 ) |
| { |
| postingDirectory = siteDir + "/eclipse/downloads/drops4"; |
| } |
| project.setProperty("postingDirectory", postingDirectory); |
| ]]> |
| </script> |
| |
| <echo message="buildRoot: ${buildRoot}" /> |
| |
| <echo message="postingDirectory: ${postingDirectory}" /> |
| |
| <!-- |
| Two possible results directories. |
| All of these asssume following naming conventions in Hudson jobs. TODO: in future could/should have properties |
| that describe the tests anyway, so might want to use that, to deside results directories.Currently: |
| contains -perf- : performance |
| else: testresults |
| We need to avoid "-baseline" distinction. If anything, |
| make one base on "LR" (long running). |
| --> |
| <condition |
| property="resultsDir" |
| value="${postingDirectory}/${buildId}/performance" |
| else="${postingDirectory}/${buildId}/testresults"> |
| <contains |
| string="${job}" |
| substring="-perf-" |
| casesensitive="yes" /> |
| </condition> |
| |
| <!-- attempt to create incase hasn't been created yet --> |
| <mkdir dir="${resultsDir}" /> |
| |
| <property |
| name="hudsonResultRootJobURL" |
| value="${env.HUDSON_PROTOCOL}://${hudsonHost}:${env.HUDSON_PORT}/${hudsonPathSegment}/job/${job}/${buildNumber}" /> |
| |
| |
| <property |
| name="hudsonResultRootURL" |
| value="${hudsonResultRootJobURL}/artifact/*zip*" /> |
| <property |
| name="hudsonResultURL" |
| value="${hudsonResultRootURL}/archive.zip" /> |
| <echo message="hudsonResultURL ${hudsonResultURL} " /> |
| |
| <property |
| name="hudsonTestResultsURL" |
| value="${hudsonResultRootJobURL}/testReport/api/xml?tree=failCount,passCount,skipCount,duration" /> |
| <echo message="hudsonTestResultsURL ${hudsonTestResultsURL} " /> |
| |
| <property |
| name="tmpzipdir" |
| value="${resultsDir}/tmp${job}" /> |
| |
| |
| |
| <mkdir dir="${tmpzipdir}" /> |
| |
| <property |
| name="collectTestResultsInitialized" |
| value="true" /> |
| |
| </target> |
| |
| </project> |