[122833] Improve Test Automation
diff --git a/releng.wtpbuilder/distribution/wtp.api/build.xml b/releng.wtpbuilder/distribution/wtp.api/build.xml
index 379cc7c..035864d 100644
--- a/releng.wtpbuilder/distribution/wtp.api/build.xml
+++ b/releng.wtpbuilder/distribution/wtp.api/build.xml
@@ -38,6 +38,7 @@
<available file="${wtp.dir}/wtp-jst-Automated-Tests-${buildId}.zip"/>
</condition>
<antcall target="run"/>
+ <antcall target="upload"/>
<antcall target="clean"/>
</target>
@@ -192,8 +193,8 @@
<param name="application" value="org.eclipse.wtp.releng.tools.component.core.APIRefCompatibilityScanner"/>
<param name="vmargs" value="-Dsrc=${local.cache.dir}/${wtp-sdk},${local.cache.dir}/${eclipse.file},${local.cache.dir}/${emf.file},${local.cache.dir}/${gef.file},${local.cache.dir}/${jem.file} -Duse=${apiRoot}/releng.builder/tools/apitools/adopter_usages -DoutputDir=${apiRoot}/adopters -Xmx256M"/>
</antcall>
- <copyfile dest="${apiRoot}/apiresults/api-ref-compatibility.html" src="${apiRoot}/adopters/api-ref-compatibility.html"/>
- <copyfile dest="${apiRoot}/apiresults/api-ref-compatibility.xml" src="${apiRoot}/adopters/api-ref-compatibility.xml"/>
+ <copy tofile="${apiRoot}/apiresults/api-ref-compatibility.html" file="${apiRoot}/adopters/api-ref-compatibility.html"/>
+ <copy tofile="${apiRoot}/apiresults/api-ref-compatibility.xml" file="${apiRoot}/adopters/api-ref-compatibility.xml"/>
<antcall target="runEclipseApp">
<param name="application" value="org.eclipse.wtp.releng.tools.component.core.Java2API"/>
@@ -252,12 +253,6 @@
<param name="classname" value="org.eclipse.wtp.releng.tools.component.api.progress.APIProgressScanner"/>
<param name="args" value="-api ${local.cache.dir}/${wtp-sdk} -src ${local.cache.dir}/${wtp-sdk} -outputDir ${apiRoot}/apiresults -progressDir ${apiRoot}/releng.builder/tools/apitools/api_progress/1.0 -timestamp ${timestamp} -excludes .*infopop .*doc.isv .*doc.user .*source org.eclipse.wst org.eclipse.jst"/>
</antcall>
-
- <zip destfile="${wtp.api}/apiresults-${buildId}.zip">
- <fileset dir="${apiRoot}/apiresults">
- <include name="**/*"/>
- </fileset>
- </zip>
</target>
<target name="runEclipseApp">
@@ -294,6 +289,17 @@
</java>
</target>
+ <target name="upload" if="login">
+ <condition property="upload.path"
+ else="${login}@download1.eclipse.org:~/downloads/webtools/downloads/drops/${buildType}-${buildId}-${timestamp}"
+ value="${login}@download1.eclipse.org:~/downloads/webtools/committers/drops/${buildType}-${buildId}-${timestamp}">
+ <isset property="build.committers"/>
+ </condition>
+ <exec executable="scp" dir="${build.home}">
+ <arg line="-r ./releng.wtpbuilder/distribution/wtp.api/apiRoot/apiresults ${upload.path}"/>
+ </exec>
+ </target>
+
<target name="clean" if="clean">
<delete dir="${apiRoot}" failonerror="false"/>
<delete file="${wtp.dir}/${wtp-sdk}" failonerror="false"/>
diff --git a/releng.wtpbuilder/distribution/wtp.site/templateFiles/testResults.php.template b/releng.wtpbuilder/distribution/wtp.site/templateFiles/testResults.php.template
index bdd8170..f39f71c 100644
--- a/releng.wtpbuilder/distribution/wtp.site/templateFiles/testResults.php.template
+++ b/releng.wtpbuilder/distribution/wtp.site/templateFiles/testResults.php.template
@@ -27,6 +27,26 @@
</head>
<body>
<p><b><font face="Verdana" size="+3">Test Results</font></b> </p>
+
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="3" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">
+ Unit Test Results for <?php echo "$buildType $buildName"; ?> on Various Platforms and JRE</font></b></td>
+ </tr>
+</table>
+
+<?php
+$dir = dir("testResults");
+while ($anEntry = $dir->read())
+{
+ if ($anEntry != "." && $anEntry != ".." && $anEntry != "consolelogs" && $anEntry != "html" && $anEntry != "xml")
+ {
+ $link = "testResults/".$anEntry."/results/index.php";
+ echo "<p><a href=\"$link\">$anEntry</a></p>";
+ }
+}
+?>
+
<table border=0 cellspacing=5 cellpadding=2 width="100%" >
<tr>
<td align=LEFT valign=TOP colspan="3" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">Unit
diff --git a/releng.wtpbuilder/distribution/wtp.tests/standaloneTest.xml b/releng.wtpbuilder/distribution/wtp.tests/standaloneTest.xml
new file mode 100644
index 0000000..a16c744
--- /dev/null
+++ b/releng.wtpbuilder/distribution/wtp.tests/standaloneTest.xml
@@ -0,0 +1,132 @@
+<project default="main" basedir=".">
+
+ <!--
+ Required inputs:
+
+ build.home
+ buildType
+ buildId
+ timestamp
+ baseos
+ basews
+ basearch
+ build.committers [optional]
+ testTarget [optional]
+ -->
+
+ <target name="main">
+ <property file="${build.home}/releng.wtpbuilder/build.properties"/>
+ <property name="local.cache.dir" value="${build.home}/${build.local.repository}"/>
+ <property name="testRoot" value="${build.home}/testRoot"/>
+ <delete dir="${testRoot}"/>
+ <mkdir dir="${testRoot}"/>
+ <antcall target="getReleng"/>
+ <property file="${testRoot}/releng/maps/dependencies.properties"/>
+ <antcall target="getDependencies"/>
+ <condition property="wtp-sdk" value="wtp-sdk-${buildId}.zip" else="wtp-sdk-${buildType}-${buildId}-${timestamp}.zip">
+ <available file="${local.cache.dir}/wtp-sdk-${buildId}.zip"/>
+ </condition>
+ <condition property="wtp-wst-tests" value="wtp-wst-Automated-Tests-${buildId}.zip" else="wtp-wst-Automated-Tests-${buildType}-${buildId}-${timestamp}.zip">
+ <available file="${local.cache.dir}/wtp-wst-Automated-Tests-${buildId}.zip"/>
+ </condition>
+ <condition property="wtp-jst-tests" value="wtp-jst-Automated-Tests-${buildId}.zip" else="wtp-jst-Automated-Tests-${buildType}-${buildId}-${timestamp}.zip">
+ <available file="${local.cache.dir}/wtp-jst-Automated-Tests-${buildId}.zip"/>
+ </condition>
+ <antcall target="run"/>
+ <antcall target="upload"/>
+ <antcall target="clean"/>
+ </target>
+
+ <target name="getReleng">
+ <property name="releng.tag" value="v${buildType}${timestamp}"/>
+ <cvs
+ cvsRoot=":pserver:anonymous@dev.eclipse.org:/cvsroot/webtools"
+ package="releng"
+ dest="${testRoot}"
+ command="export"
+ tag="${releng.tag}"
+ />
+ </target>
+
+ <target name="getDependencies">
+ <ant antfile="${build.home}/releng.wtpbuilder/distribution/wtp.tests/testdependency.xml">
+ <property name="base.install.dir" value="${testRoot}"/>
+ <property name="dependencyTargets" value="${build.home}/releng.wtpbuilder/scripts/dependency/build.xml"/>
+ </ant>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-sdk-${buildId}.zip" />
+ </antcall>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-sdk-${buildType}-${buildId}-${timestamp}.zip" />
+ </antcall>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-wst-Automated-Tests-${buildId}.zip" />
+ </antcall>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-wst-Automated-Tests-${buildType}-${buildId}-${timestamp}.zip" />
+ </antcall>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-jst-Automated-Tests-${buildId}.zip" />
+ </antcall>
+ <antcall target="getAndInstallWTP">
+ <param name="file" value="wtp-jst-Automated-Tests-${buildType}-${buildId}-${timestamp}.zip" />
+ </antcall>
+ </target>
+
+ <target name="getAndInstallWTP">
+ <available file="${local.cache.dir}/${file}" property="file.exists"/>
+ <antcall target="getWTP"/>
+ <available file="${local.cache.dir}/${file}" property="file.exists"/>
+ <antcall target="installWTP"/>
+ </target>
+
+ <target name="getWTP">
+ <condition property="file.url" value="http://download.eclipse.org/webtools/committers/drops/${buildType}-${buildId}-${timestamp}" else="http://download.eclipse.org/webtools/downloads/drops/${buildType}-${buildId}-${timestamp}">
+ <isset property="build.committers"/>
+ </condition>
+ <antcall target="getWTP2"/>
+ </target>
+
+ <target name="getWTP2" unless="file.exists">
+ <property name="file.url" value="http://download.eclipse.org/webtools/downloads/drops/${buildType}-${buildId}-${timestamp}"/>
+ <get dest="${local.cache.dir}/${file}" src="${file.url}/${file}" ignoreerrors="true"/>
+ </target>
+
+ <target name="installWTP" if="file.exists">
+ <unzip src="${local.cache.dir}/${file}" dest="${testRoot}" overwrite="true"/>
+ </target>
+
+ <target name="run">
+ <mkdir dir="${testRoot}/results/consolelogs"/>
+ <copy todir="${testRoot}" flatten="true" overwrite="true">
+ <fileset dir="${build.home}/releng.wtpbuilder/distribution/wtp.tests/testScripts"/>
+ </copy>
+ <ant antfile="${build.home}/releng.wtpbuilder/distribution/wtp.tests/build.xml" target="runTestEclipse">
+ <property name="testRoot" value="${testRoot}"/>
+ <property name="testTarget" value=""/>
+ </ant>
+ <copy file="${build.home}/releng.wtpbuilder/distribution/wtp.tests/templateFiles/index.php" todir="${testRoot}/results/index.php" overwrite="true"/>
+ </target>
+
+ <target name="upload" if="login">
+ <condition property="upload.path"
+ else="~/downloads/webtools/downloads/drops/${buildType}-${buildId}-${timestamp}/testResults/${config}"
+ value="~/downloads/webtools/committers/drops/${buildType}-${buildId}-${timestamp}/testResults/${config}">
+ <isset property="build.committers"/>
+ </condition>
+ <exec executable="ssh" dir="${build.home}">
+ <arg line="${login}@download1.eclipse.org mkdir ${upload.path}"/>
+ </exec>
+ <exec executable="scp" dir="${build.home}">
+ <arg line="-r ./testRoot/results ${login}@download1.eclipse.org:${upload.path}"/>
+ </exec>
+ </target>
+
+ <target name="clean" if="clean">
+ <delete dir="${testRoot}" failonerror="false"/>
+ <delete file="${local.cache.dir}/${wtp-sdk}" failonerror="false"/>
+ <delete file="${local.cache.dir}/${wtp-wst-tests}" failonerror="false"/>
+ <delete file="${local.cache.dir}/${wtp-jst-tests}" failonerror="false"/>
+ </target>
+
+</project>
\ No newline at end of file
diff --git a/releng.wtpbuilder/distribution/wtp.tests/templateFiles/index.php b/releng.wtpbuilder/distribution/wtp.tests/templateFiles/index.php
new file mode 100644
index 0000000..1717172
--- /dev/null
+++ b/releng.wtpbuilder/distribution/wtp.tests/templateFiles/index.php
@@ -0,0 +1,70 @@
+<html>
+<head>
+
+<?php
+ $parts = explode("/", realpath(".."));
+ $label = $parts[count($parts) - 1];
+?>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="http://dev.eclipse.org/default_style.css" type="text/css">
+</head>
+<body>
+<p><b><font face="Verdana" size="+3">Test Results</font></b> </p>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="3" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">Unit
+ Test Results for <?php echo "$label"; ?> </font></b></td>
+ </tr>
+</table>
+<p></p><table border="0">
+</table>
+
+<table width="77%" border="1">
+ <tr>
+ <td width="81%"><b>Tests Performed</b></td>
+ <td width="19%"><b>Errors & Failures</b></td>
+ </tr>
+
+ <?
+ $dir = dir("html");
+ while ($anEntry = $dir->read())
+ {
+ if ($anEntry != "." && $anEntry != "..")
+ {
+ $link = "html/".$anEntry;
+ echo "<tr><td><a href=\"$link\">";
+ echo "$anEntry";
+ echo "</a></td>";
+ $xml = "xml/".substr($anEntry, 0, strlen($anEntry)-4)."xml";
+ $count = 0;
+ $fileHandle = fopen($xml, "r");
+ while (!feof($fileHandle))
+ {
+ $aLine = fgets($fileHandle, 4096); // Length parameter only optional after 4.2.0
+ $count = $count + substr_count($aLine, '<error>');
+ }
+ fclose($fileHandle);
+ echo "<td>$count</td></tr>";
+ }
+ }
+ ?>
+
+</table>
+<p></p>
+<br>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="3" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">
+ Console output logs
+ <?php echo "$label"; ?>
+ </font></b></td>
+ </tr>
+</table>
+<br>
+These <a href="consolelogs/wtptestlog.txt">logs</a> contain the console output captured while
+running the JUnit automated tests. <br>
+<br>
+
+</body>
+</html>