1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added automatic upload of the test result reports.

This commit is contained in:
Doug Schaefer 2003-07-24 20:27:32 +00:00
parent 191615c830
commit bcbcf4266c
7 changed files with 139 additions and 4 deletions

View file

@ -6,9 +6,9 @@
if [ -n "$CDT_ROOT" ]; then cd $CDT_ROOT; fi
for i in dobuild doinstall dotest
for i in dobuild doinstall dotests dopost
do
if ! $i
if ! workspace/org.eclipse.cdt.releng/$i
then
echo $i failed
exit 1

View file

@ -23,7 +23,7 @@ do
export DEST=$d/`echo $i | sed -e s:$BUILD_SITE/$d/:: -e s/.jar//`
mkdir $DEST
cd $DEST
jar xf $i
jar xf ../../$i
cd ../..
done
done

View file

@ -0,0 +1,16 @@
cd results
# Update the build page
export CDT_VERSION=`cat version.txt`
export CDT_LOGS=`echo org.*.html`
../workspace/org.eclipse.cdt.releng/edit.pl $CDT_VERSION $CDT_LOGS < index.html > index2.html
mv index2.html index.html
cd ..
# Upload to build page using eclipse
./eclipse -nosplash -application org.eclipse.cdt.releng.postResults \
-version $CDT_VERSION -logs $CDT_LOGS \
-vmargs -Dcdt.build.user=$CDT_USER -Dcdt.build.passwd=$CDT_PASSWD

View file

@ -0,0 +1,24 @@
#!/usr/bin/perl
# First arg is version number
# The rest are the log files
foreach (<STDIN>)
{
if (/<!--new..>/)
{
$version = shift;
$date = `date`;
chomp $date;
print " <li>$version - $date</li>\n";
print " <ul>\n";
foreach (@ARGV)
{
$plugin = $_;
$plugin =~ s/\.html//;
print " <li><a href=\"logs/$version/$_\">$plugin</a></li>\n"
}
print " </ul>\n";
}
print $_;
}

View file

@ -31,5 +31,15 @@
</run>
</application>
</extension>
<extension
id="postResults"
name="Post Build Results"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="org.eclipse.cdt.releng.PostResults">
</run>
</application>
</extension>
</plugin>

View file

@ -4,6 +4,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
@ -21,8 +22,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.pde.core.plugin.IFragment;
import org.eclipse.pde.core.plugin.IPlugin;
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
@ -213,8 +216,13 @@ public class DoBuild implements IPlatformRunnable {
ftp.login(ftpUser, ftpPassword);
ftp.chdir(ftpPath);
IPath resultDir = Platform.getLocation().removeLastSegments(1).append("results");
OutputStream stream = new FileOutputStream(resultDir.append("index.html").toOSString());
ftp.get(stream, "index.html");
stream.close();
IFile file = buildSite.getFile("version.xml");
OutputStream stream = new FileOutputStream(file.getRawLocation().toOSString());
stream = new FileOutputStream(file.getRawLocation().toOSString());
ftp.get(stream, "version.xml");
stream.close();
@ -255,6 +263,14 @@ public class DoBuild implements IPlatformRunnable {
transformer.transform(new DOMSource(versionDoc), new StreamResult(versionResult));
versionFile.refreshLocal(IResource.DEPTH_ONE, monitor);
version = versionId + "." + buildNum;
// Save the version in a text file for inclusion in the build page
IPath resultDir = Platform.getLocation().removeLastSegments(1).append("results");
OutputStream stream = new FileOutputStream(resultDir.append("version.txt").toOSString());
PrintStream versionText = new PrintStream(stream);
versionText.println(version);
stream.close();
System.out.println("Version: " + version);
// Go through the projects and update the version info

View file

@ -0,0 +1,69 @@
package org.eclipse.cdt.releng;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.boot.IPlatformRunnable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPConnectMode;
/**
* This application ftps the test results up to the server.
* @see IPlatformRunnable
*/
public class PostResults implements IPlatformRunnable {
private static final String ftpHost = "download.eclipse.org";
private static final String ftpPath = "cdt/updates/builds/1.2";
private static final String ftpUser = System.getProperty("cdt.build.user");
private static final String ftpPassword = System.getProperty("cdt.build.passwd");
public PostResults() {
}
/**
* @see IPlatformRunnable#run
*/
public Object run(Object args) throws Exception {
// Get the goodies out of the argument list
String version = "unversioned";
List logs = new ArrayList();
String[] strargs = (String[])args;
for (int i = 0; i < strargs.length; ++i)
if (strargs[i].equals("-version")) {
version = strargs[++i];
} else if (strargs[i].equals("-logs")) {
for (i++; i < strargs.length; ++i) {
logs.add(strargs[i]);
}
}
IPath resultDir = Platform.getLocation().removeLastSegments(1).append("results");
// Open ftp connection
FTPClient ftp = new FTPClient(ftpHost);
ftp.setConnectMode(FTPConnectMode.ACTIVE);
ftp.login(ftpUser, ftpPassword);
ftp.chdir(ftpPath);
// Upload the html files
ftp.put(new FileInputStream(resultDir.append("index.html").toOSString()), "index.html");
ftp.chdir("logs");
ftp.mkdir(version);
ftp.chdir(version);
for (int i = 0; i < logs.size(); ++i) {
String log = (String)logs.get(i);
ftp.put(new FileInputStream(resultDir.append(log).toOSString()), log);
}
ftp.quit();
return null;
}
}