blob: e3fdbb050655fa8cad686e2e9fe1280ae64c7807 [file] [log] [blame]
# !/bin/sh
#------------------------------------------------------------------------------------------------------
# This script is designed to copy test result files from a "root" location
# to the coresponding hosted location on the Eclipse Download site.
#
# Assumptions:
# - results will be stored locally in the following hierarchy:
# ${RESULTROOT}/${VERSION}/${QUALIFIER}/${HOSTNAME} (example: ${ROOT}/2.2.0/v20101116-r8433/Eclipse)
# - there is a "TestConfiguration.html" in each host dir (specific to each run)
# - the current user id matches the commiter uid at Eclipse or an alternate is specified
# - the machine running this script has setup SSH authentication for that user to dev.eclipse.org
#
# Author: Eric Gwin (Oracle)
#
#------------------------------------------------------------------------------------------------------
# Detailed information on setting up ssh using keygen can be found at many sites on the net, I
# looked at:
# http://sial.org/howto/openssh/publickey-auth/
#
# Using ssh through a firewall will require the use of a proxy. Proxy settings differ with the shell
# and linux distribution you are using, but generally either require the http_proxy or HTTP_PROXY
# env variables be setup:
# export http_proxy=<proxy server>:<proxy port>
# export HTTP_PROXY=<proxy server>:<proxy port>
#
#------------------------------------------------------------------------------------------------------
#==========================
# Basic Env Setup
#
#Define common variables
CUR_DIR=`dirname .`
START_DATE=`date '+%y%m%d-%H%M'`
SSH_USER=
SCP_OPTIONS="-Bpqr"
#Directories
PUBLISH_HOME=/home/data/httpd/download.eclipse.org/rt/eclipselink/nightly
PUBLISH_SERVER=build.eclipse.org
#==========================
# Functions Definitions
#
unset Usage
Usage() {
echo "ERROR: Invalid usage detected!"
echo "USAGE: ./`basename ${0}` RESULTROOT RESULTBUILD HOSTNAME COMMIT_ID [\> LOGFILE 2\>\&1]"
echo "Where: RESULTROOT = Path to local results hierarchy"
echo " RESULTBUILD= OSGi-like version of build tested (2.2.0.v20101116-r8433)"
echo " HOSTNAME = host conguration name"
echo " COMMIT_ID = optional uid of comitter publishing (assumes local user)"
echo ""
echo " Assumptions:"
echo " - results will be stored locally in the following hierarchy:"
echo " ${RESULTROOT}/${VERSION}/${QUALIFIER}/${HOSTNAME} (example: ${ROOT}/2.2.0/v20101116-r8433/Oracle1)"
echo " - there is a "TestConfiguration.html" in the host dir (specific to each run)"
echo " - there is a "ResultSummary.dat" in the host dir (specific to each run)"
echo " - the current user id matches the commiter uid at Eclipse or an alternate is specified"
echo " - the machine running this script has setup SSH authentication for that user to dev.eclipse.org"
echo ""
echo " Specifications:"
echo " TestConfiguration.html:"
echo " This file should be generated by the testing process in question. It should be a valid html"
echo " document and should specify, the hardware, OS, JDK version and manufacturer, Database brand"
echo " and version, the driver name and version as well as any other tools and their versions pertinent"
echo " to replicating the test environment. This file is direcly link to in the generated build pages."
echo " ResultSummary.dat:"
echo " This file should be generated by the testing process in question, though it may be generated by the"
echo " Ant process. It lists the result files for the host, the number of tests in suite (the historic"
echo " benchmark from previous runs used to generate status of run - less/expected/more), the number"
echo " that did run, and the number of reported errors+failures (non-zero used to flag problems) in the"
echo " following format:"
echo " <testresult_file>:<NumberInSuite>:<TestsRun>:<errors+failures>"
echo " the nightly generation script looks for the following files in order (others will be ignored):"
echo " eclipselink-core-lrg-<release version>.html"
echo " eclipselink-jpa-lrg-<release version>.html"
echo " eclipselink-jpa-wdf-lrg-<release version>.html"
echo " eclipselink-jaxb-lrg-<release version>.html"
echo " eclipselink-oxm-lrg-<release version>.html"
echo " eclipselink-sdo-lrg-<release version>.html"
echo " eclipselink-dbws-lrg-<release version>.html"
echo " eclipselink-dbws-util-lrg-<release version>.html"
echo ""
exit
}
unset parseResultBuild
parseResultBuild() {
build_version=$1
build_version_string="Error: Invalid build_version: '${build_version}'!"
## Parse for VERSION, and QUALIFIER
VERSION=`echo ${build_version} | cut -d'.' -f1-3`
QUALIFIER=`echo ${build_version} | cut -d'.' -f4`
BLDDATE=`echo ${QUALIFIER} | cut -s -d'-' -f1 | cut -d'v' -f2`
#echo "VERSION='${VERSION}' QUALIFIER='${QUALIFIER}' BLDDATE='${BLDDATE}'"
}
unset validateParameters
validateParameters() {
error=false
if [ ! -d ${RESULTROOT} ] ; then
echo "Error: Publish location not found!"
echo " RESULTROOT: '${RESULTROOT}' doesn't exist!"
exit
fi
if [ ! -d ${RESULTROOT}/${VERSION} ] ; then
echo "Error: Publish location not found!"
echo " VERSION: '${RESULTROOT}/${VERSION}' doesn't exist!"
exit
fi
if [ ! -d ${RESULTROOT}/${VERSION}/${QUALIFIER} ] ; then
echo "Error: Publish location not found!"
echo " QUALIFIER: '${RESULTROOT}/${VERSION}/${QUALIFIER}' doesn't exist!"
exit
fi
SOURCEPATH=${RESULTROOT}/${VERSION}/${QUALIFIER}/${HOSTNAME}
if [ ! -d ${SOURCEPATH} ] ; then
echo "Error: Publish location not found!"
echo " HOSTNAME: '${SOURCEPATH}' doesn't exist!"
exit
fi
if [ ! -f ${SOURCEPATH}/TestConfiguration.html ] ; then
echo "Error: Test Configuration description not found!"
echo " '${SOURCEPATH}/TestConfiguration.html' doesn't exist!"
error=true
fi
if [ ! -f ${SOURCEPATH}/ResultSummary.dat ] ; then
echo "Error: ResultSummary datafile not found!"
echo " '${SOURCEPATH}/ResultSummary.dat' doesn't exist!"
error=true
fi
if [ "$error" = "true" ] ; then
exit
fi
}
unset publishResults
publishResults() {
DESTPATH=${SSH_USER}${PUBLISH_SERVER}:${PUBLISH_HOME}/${VERSION}/${BLDDATE}/.
echo ""
echo "Using secure copy to publish files:"
echo " From: ${SOURCEPATH}"
echo " To: ${DESTPATH}"
scp ${SCP_OPTIONS} ${SOURCEPATH} ${DESTPATH}
}
unset postProcess
postProcess() {
echo "PostProcessing..."
echo " Generating notification for ${PROC} publishing for ${BRANCH} build ${QUALIFIER}..."
echo " Not sent..."
# cleanup
echo "Done."
}
#==========================
# Main Begins
#
#==========================
if [ "$#" -lt 3 ] ; then
echo "Error: Incorrect number of arguments!"
Usage
fi
RESULTROOT=$1
RESULTBUILD=$2
HOSTNAME=$3
COMMIT_ID=$4
if [ ! "$COMMIT_ID" = "" ] ; then
SSH_USER=${COMMIT_ID}@
fi
parseResultBuild ${RESULTBUILD}
validateParameters
publishResults