2008-09-30 02:44:27 -05:00
|
|
|
#!/bin/bash
|
2008-06-13 06:29:05 -05:00
|
|
|
#*************************************************************************
|
2010-02-12 08:01:35 -06:00
|
|
|
#
|
2008-06-13 06:29:05 -05:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
2010-02-12 08:01:35 -06:00
|
|
|
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
2008-06-13 06:29:05 -05:00
|
|
|
#
|
|
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
#
|
|
|
|
# This file is part of OpenOffice.org.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# only, as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License version 3 for more details
|
|
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
# version 3 along with OpenOffice.org. If not, see
|
|
|
|
# <http://www.openoffice.org/license.html>
|
|
|
|
# for a copy of the LGPLv3 License.
|
2010-02-12 08:01:35 -06:00
|
|
|
#
|
2008-06-13 06:29:05 -05:00
|
|
|
#***********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
EXIT_SUCCESS=0
|
|
|
|
EXIT_FAILURE=1
|
|
|
|
EXIT_ERROR=2
|
|
|
|
EXIT_BUG=10
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
# report the given error parameter to cwstestresult if the is one.
|
|
|
|
# 0: no error send ok or parameter $2
|
|
|
|
# 1: failure
|
|
|
|
# 2...: incomplete
|
|
|
|
function reportError()
|
|
|
|
{
|
|
|
|
ERRORCODE=$1
|
|
|
|
if [ -e $SOLARENV/bin/cwstestresult.pl ]; then
|
|
|
|
if [ $ERRORCODE -eq 0 ]; then
|
|
|
|
PT_STATUS=${2:-ok} # use default 'ok' or $2
|
|
|
|
elif [ $ERRORCODE -eq 1 ]; then
|
|
|
|
PT_STATUS=failed
|
|
|
|
else
|
|
|
|
PT_STATUS=incomplete
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$OSTYPE" == "cygwin" ]; then
|
|
|
|
CWSENV=Windows
|
|
|
|
elif [ "$OSTYPE" == "linux" ]; then
|
|
|
|
CWSENV=Linux
|
|
|
|
elif [ "$OSTYPE" == "solaris" ]; then
|
|
|
|
CWSENV=SolarisX86
|
|
|
|
else
|
|
|
|
CWSENV=Unknown
|
|
|
|
fi
|
|
|
|
perl $SOLARENV/bin/cwstestresult.pl -c $CWS_WORK_STAMP -n CWSCheckAPI -p $CWSENV $PT_STATUS
|
|
|
|
else
|
|
|
|
echo "No cwstestresult.pl found."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
usage() {
|
2009-07-06 05:30:52 -05:00
|
|
|
echo "Usage: $SCRIPTNAME [-m MODULE1[,MODULEn]] [-k] [-o] [-h] [-d] [-u] [-t] [-s] [-a]" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-m] list of modules to test like: '-m sw,sc,sd' or '-m all' for all modules" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-k] keep Office installation, otherwise it will be removed after test" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-o] force OpenOffice.org installation instead of StarOffice" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-d] debug installation and UnoAPI-Tests" >&2
|
|
|
|
# echo "" >&2
|
|
|
|
# echo "[-i] debug installation" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-t] debug UnoAPI-Tests" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-s] skip installation of Office" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-a] NoCwsAttach: do not attach UnoAPI-Test result to EIS database" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "[-u] UseInstalledOffice: do not install an office" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "further informations: http://wiki.services.openoffice.org/wiki/Cwscheckapi" >&2
|
|
|
|
echo "" >&2
|
|
|
|
exit $EXIT_FAILURE
|
2008-06-13 06:29:05 -05:00
|
|
|
}
|
2008-09-30 02:44:27 -05:00
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
# we start cwscheckapi
|
|
|
|
reportError 0 running
|
|
|
|
|
2008-09-30 02:44:27 -05:00
|
|
|
if [ "$PROEXT" != ".pro" ]; then
|
|
|
|
echo "ERROR: cwscheckapi works only on pro-versions" >&2
|
2009-07-06 05:30:52 -05:00
|
|
|
reportError 2
|
2008-09-30 02:44:27 -05:00
|
|
|
exit $EXIT_FAILURE
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ x${USER}x = xx ]; then
|
|
|
|
if [ x${LOGNAME}x = xx ]; then
|
|
|
|
echo "ERROR: could not determine username. Please export variable USER" >&2
|
2009-07-06 05:30:52 -05:00
|
|
|
reportError 2
|
2008-09-30 02:44:27 -05:00
|
|
|
exit $EXIT_FAILURE
|
|
|
|
else
|
|
|
|
USER=$LOGNAME
|
|
|
|
export USER
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
|
|
|
|
#DEBUG_I=false
|
2008-06-13 06:29:05 -05:00
|
|
|
DEBUG_T=false
|
|
|
|
INSTALL=true
|
2009-07-06 05:30:52 -05:00
|
|
|
ATTACH=true
|
2008-06-13 06:29:05 -05:00
|
|
|
MODULES="auto"
|
|
|
|
OOO=false
|
2008-09-30 02:44:27 -05:00
|
|
|
KEEPOFFICE=false
|
2009-07-06 05:30:52 -05:00
|
|
|
USE_INSTALLED_OFFICE=false
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
while getopts ':m:dkutsaho' OPTION ; do
|
2008-06-13 06:29:05 -05:00
|
|
|
case $OPTION in
|
2009-07-06 05:30:52 -05:00
|
|
|
d)
|
|
|
|
# DEBUG_I=true
|
|
|
|
DEBUG_T=true
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
m)
|
|
|
|
MODULES="$OPTARG"
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
k)
|
|
|
|
KEEPOFFICE=true
|
2008-09-30 02:44:27 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
o)
|
|
|
|
OOO=true
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
# i)
|
|
|
|
# DEBUG_I=true
|
|
|
|
# ;;
|
|
|
|
t)
|
|
|
|
DEBUG_T=true
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
s)
|
|
|
|
INSTALL=false
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
a)
|
|
|
|
ATTACH=false
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
u)
|
|
|
|
USE_INSTALLED_OFFICE=true
|
|
|
|
INSTALL=false
|
|
|
|
KEEPOFFICE=true
|
|
|
|
echo "make sure your office is started with parameter -accept=pipe,name=$USER;urp;"
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
h)
|
|
|
|
usage $EXIT_SUCCESS
|
2008-06-13 06:29:05 -05:00
|
|
|
;;
|
2009-07-06 05:30:52 -05:00
|
|
|
\?)
|
|
|
|
echo "unkown option \"-$OPTARG\"." >&2
|
|
|
|
usage $EXIT_ERROR
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "this is not possible...">&2
|
2008-06-13 06:29:05 -05:00
|
|
|
usage $EXIT_BUG
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift `expr $OPTIND - 1`
|
|
|
|
|
2008-09-30 02:44:27 -05:00
|
|
|
if [ -d /export/home/$USER ]; then
|
|
|
|
CWSCHECKAPIPATH=/export/home/$USER/cwscheckapi
|
|
|
|
else
|
|
|
|
if [ -w /export/home ]; then
|
|
|
|
mkdir /export/home/$USER
|
|
|
|
CWSCHECKAPIPATH=/export/home/$USER/cwscheckapi
|
|
|
|
else
|
|
|
|
CWSCHECKAPIPATH=/tmp/$USER/cwscheckapi
|
|
|
|
fi
|
|
|
|
fi
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2008-09-30 02:44:27 -05:00
|
|
|
# the following line is to cleanup old cwscheckapi-installations. It results form the first version of cwscheckapi
|
|
|
|
# The disk space on /tmp is limited. If a lot of users run cwscheckapi a lot of installed offices are in /tmp
|
|
|
|
# The new concept is to remove the offices after test. But old unused installations should be removed...
|
|
|
|
if [ $CWSCHECKAPIPATH != /tmp/$USER/cwscheckapi ]; then
|
|
|
|
rm -rf /tmp/$USER/cwscheckapi
|
|
|
|
fi
|
|
|
|
|
|
|
|
LOCALINSTALLDIR=$CWSCHECKAPIPATH/office
|
|
|
|
LOCALUNPACKDIR=$CWSCHECKAPIPATH/unpack
|
2008-06-13 06:29:05 -05:00
|
|
|
export LOCALINSTALLDIR
|
|
|
|
export LOCALUNPACKDIR
|
|
|
|
|
2008-08-14 06:55:02 -05:00
|
|
|
unset FORCE2ARCHIVE
|
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
if [ $INSTALL = true ]; then
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
date 2>&1
|
|
|
|
|
|
|
|
# if [ $DEBUG_I = true ]; then
|
|
|
|
# echo "start installation: `date`"
|
|
|
|
# echo call "$SOLARENV/bin/installoffice.pl -cwscheckapi true -dest $LOCALINSTALLDIR -debug $DEBUG_I"
|
|
|
|
# fi
|
2008-06-13 06:29:05 -05:00
|
|
|
perl -w $SOLARENV/bin/installoffice.pl -cwscheckapi true -dest $LOCALINSTALLDIR -ooo $OOO -debug $DEBUG_I
|
2009-07-06 05:30:52 -05:00
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
EXITVAL=$?
|
|
|
|
|
|
|
|
if [ $EXITVAL -ne 0 ]; then
|
|
|
|
echo "ERROR: could not install office"
|
2009-07-06 05:30:52 -05:00
|
|
|
reportError 2
|
2008-06-13 06:29:05 -05:00
|
|
|
exit $EXITVAL
|
|
|
|
fi
|
2009-07-06 05:30:52 -05:00
|
|
|
echo "`date` installation successfull, start testing...."
|
2008-06-13 06:29:05 -05:00
|
|
|
fi
|
|
|
|
|
2008-11-26 06:04:07 -06:00
|
|
|
SOFFICE="soffice"
|
|
|
|
PS=":"
|
|
|
|
CYGWIN=""
|
|
|
|
|
|
|
|
SHELL="/bin/bash"
|
|
|
|
# cygwin:
|
|
|
|
if [ "$GUI" = "WNT" ]; then
|
|
|
|
SOFFICE="soffice.exe"
|
|
|
|
PS=";"
|
|
|
|
CYGWIN="-Cygwin true"
|
2009-07-06 05:30:52 -05:00
|
|
|
SHELL=$(which bash)
|
|
|
|
SHELL=$(cygpath -w $SHELL)
|
2008-11-26 06:04:07 -06:00
|
|
|
if [ ! -f $SHELL ]; then
|
|
|
|
echo "could not determine bash shell"
|
2009-07-06 05:30:52 -05:00
|
|
|
reportError 2
|
2008-11-26 06:04:07 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
# if [ $DEBUG_T = true ]; then
|
|
|
|
# echo find $LOCALINSTALLDIR -name $SOFFICE
|
|
|
|
# fi
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
if [ $USE_INSTALLED_OFFICE = false ]; then
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
OFFICEBIN=`find $LOCALINSTALLDIR -name $SOFFICE`
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
if [ ! -f "$OFFICEBIN" ]; then
|
|
|
|
echo "could not find 'soffice' in subfolders of $LOCALINSTALLDIR"
|
|
|
|
reportError 2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$GUI" = "WNT" ]; then
|
2008-11-26 06:04:07 -06:00
|
|
|
# transform /tmp/... -> c:\tmp\...
|
2009-07-06 05:30:52 -05:00
|
|
|
OFFICEBIN=`cygpath -w $OFFICEBIN`
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
OFFICEBIN=$SOFFICE
|
|
|
|
echo "Use already installed and running office."
|
2008-11-26 06:04:07 -06:00
|
|
|
fi
|
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
JARFOLDER=$SOLARVERSION/$INPATH/bin$UPDMINOREXT
|
|
|
|
SOLVER_LIB=$SOLARVERSION/$INPATH/lib$UPDMINOREXT
|
2009-07-06 05:30:52 -05:00
|
|
|
|
|
|
|
myCLASSPATH=${PS}${JARFOLDER}/ridl.jar${PS}\
|
|
|
|
${JARFOLDER}/unoil.jar${PS}\
|
|
|
|
${JARFOLDER}/jurt.jar${PS}\
|
|
|
|
${JARFOLDER}/juh.jar${PS}\
|
|
|
|
${JARFOLDER}/java_uno.jar
|
|
|
|
|
|
|
|
myCLASSPATH=$myCLASSPATH${PS}\
|
|
|
|
${JARFOLDER}/OOoRunner.jar
|
|
|
|
|
|
|
|
myCLASSPATH=$myCLASSPATH${PS}\
|
|
|
|
/net/unoapi/export/unoapi/bin/mysql.jar${PS}\
|
|
|
|
$SOLVER_LIB
|
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
PARAM=""
|
|
|
|
if [ -n "$JAVAI" ]; then
|
2009-07-06 05:30:52 -05:00
|
|
|
JAVABIN=$JAVAI
|
2008-06-13 06:29:05 -05:00
|
|
|
elif [ -n "$JAVA_HOME" ]; then
|
2008-08-27 07:37:24 -05:00
|
|
|
if [ "$OS$CPUNAME$CPU" = SOLARISSPARCU ]; then
|
|
|
|
JAVABIN=$JAVA_HOME/bin/sparcv9/java
|
|
|
|
else
|
2008-06-13 06:29:05 -05:00
|
|
|
JAVABIN=$JAVA_HOME/bin/java
|
2008-08-27 07:37:24 -05:00
|
|
|
fi
|
2008-06-13 06:29:05 -05:00
|
|
|
else
|
2009-07-06 05:30:52 -05:00
|
|
|
echo "please set environment variable JAVA_HOME"
|
|
|
|
reportError 2
|
|
|
|
exit 1
|
2008-06-13 06:29:05 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$WORK_STAMP" ]; then
|
2009-07-06 05:30:52 -05:00
|
|
|
if [ -n "$CWS_WORK_STAMP" ]; then
|
2008-06-13 06:29:05 -05:00
|
|
|
PARAM="$PARAM -Version cws_${CWS_WORK_STAMP}"
|
2009-07-06 05:30:52 -05:00
|
|
|
else
|
|
|
|
echo "######"
|
|
|
|
echo CAUTION! You are working on the MWS
|
|
|
|
echo "######"
|
2008-06-13 06:29:05 -05:00
|
|
|
PARAM="$PARAM -Version ${WORK_STAMP}_${UPDMINOR}"
|
2009-07-06 05:30:52 -05:00
|
|
|
fi
|
2008-06-13 06:29:05 -05:00
|
|
|
fi
|
|
|
|
|
2008-11-26 06:04:07 -06:00
|
|
|
PARAM="$PARAM -cmd '$OFFICEBIN -nofirststartwizard -accept=pipe,name=$USER;urp; -norestore -nocrashreport -nolockcheck -enableautomation'"
|
2008-06-13 06:29:05 -05:00
|
|
|
PARAM="$PARAM -cs pipe,name=$USER"
|
|
|
|
PARAM="$PARAM -NoOffice true"
|
|
|
|
PARAM="$PARAM -SRC_ROOT $SRC_ROOT"
|
2008-09-30 02:44:27 -05:00
|
|
|
PARAM="$PARAM -COMP_ENV $OUTPATH"
|
2008-11-26 06:04:07 -06:00
|
|
|
PARAM="$PARAM -Shell $SHELL"
|
|
|
|
PARAM="$PARAM $CYGWIN"
|
2008-06-13 06:29:05 -05:00
|
|
|
PARAM="$PARAM -tb java_complex"
|
|
|
|
PARAM="$PARAM -TimeOut 90000"
|
|
|
|
PARAM="$PARAM -o complex.unoapi.CheckModuleAPI::module($MODULES)"
|
|
|
|
if [ $ATTACH = false ]; then
|
|
|
|
PARAM="$PARAM -nca true"
|
|
|
|
fi
|
|
|
|
if [ $DEBUG_T = true ]; then
|
|
|
|
PARAM="$PARAM -debug true -log true"
|
|
|
|
fi
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
# Sample command
|
|
|
|
# /so/env/Linux_JDK_1.5.0_06/bin/java
|
|
|
|
# -Xmx120m $XDEBUG
|
|
|
|
# -cp :/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/ridl.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/unoil.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/jurt.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/juh.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/java_uno.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/OOoRunner.jar:/net/unoapi/export/unoapi/bin/mysql.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/lib.m50
|
|
|
|
# org.openoffice.Runner
|
|
|
|
# -Version cws_unoapi04
|
|
|
|
# -cmd '/tmp/ll93751/cwscheckapi/office/staroffice9/program/soffice -nofirststartwizard -accept=pipe,name=ll93751;urp; -norestore -nocrashreport -nolockcheck -enableautomation'
|
|
|
|
# -cs pipe,name=ll93751
|
|
|
|
# -NoOffice true
|
|
|
|
# -SRC_ROOT /net/so-cwsserv02/export/cws/unoapi04/DEV300/src.m50
|
|
|
|
# -COMP_ENV unxlngi6
|
|
|
|
# -Shell /bin/bash
|
|
|
|
# -tb java_complex
|
|
|
|
# -TimeOut 90000
|
|
|
|
# -o 'complex.unoapi.CheckModuleAPI::module(auto)'
|
|
|
|
|
|
|
|
# XDEBUG=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y "
|
|
|
|
|
|
|
|
# set DEBUGAPI if you want to debug the checkapi
|
|
|
|
# DEBUGAPI=t
|
|
|
|
|
2008-06-13 06:29:05 -05:00
|
|
|
COMMAND="$JAVABIN -Xmx120m $XDEBUG -cp $myCLASSPATH org.openoffice.Runner $PARAM $*"
|
2009-02-19 05:42:47 -06:00
|
|
|
echo "$COMMAND"
|
2008-06-13 06:29:05 -05:00
|
|
|
|
2008-09-30 02:44:27 -05:00
|
|
|
LOGFILE=$CWSCHECKAPIPATH/cwscheckapi.log
|
2009-02-19 05:42:47 -06:00
|
|
|
$COMMAND | tee $LOGFILE
|
2009-07-06 05:30:52 -05:00
|
|
|
EXITVAL=$?
|
2008-09-30 02:44:27 -05:00
|
|
|
|
|
|
|
if [ $KEEPOFFICE = false ]; then
|
|
|
|
echo "remove office instrallation in $LOCALINSTALLDIR..."
|
|
|
|
rm -rf $LOCALINSTALLDIR
|
|
|
|
fi
|
2008-06-13 06:29:05 -05:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo A logfile could be found here: $LOGFILE
|
|
|
|
|
2009-07-06 05:30:52 -05:00
|
|
|
date 2>&1
|
|
|
|
|
|
|
|
# send the results via cwstestresult.pl to EIS
|
|
|
|
if [ $EXITVAL -eq 0 ]; then
|
|
|
|
reportError 0 ok
|
|
|
|
else
|
|
|
|
reportError 1
|
|
|
|
fi
|