2 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: cwscheckapi,v $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
29 #***********************************************************************/
37 # report the given error parameter to cwstestresult if the is one.
38 # 0: no error send ok or parameter $2
41 function reportError
()
44 if [ -e $SOLARENV/bin
/cwstestresult.pl
]; then
45 if [ $ERRORCODE -eq 0 ]; then
46 PT_STATUS
=${2:-ok} # use default 'ok' or $2
47 elif [ $ERRORCODE -eq 1 ]; then
53 if [ "$OSTYPE" == "cygwin" ]; then
55 elif [ "$OSTYPE" == "linux" ]; then
57 elif [ "$OSTYPE" == "solaris" ]; then
62 perl
$SOLARENV/bin
/cwstestresult.pl
-c $CWS_WORK_STAMP -n CWSCheckAPI
-p $CWSENV $PT_STATUS
64 echo "No cwstestresult.pl found."
69 echo "Usage: $SCRIPTNAME [-m MODULE1[,MODULEn]] [-k] [-o] [-h] [-d] [-u] [-t] [-s] [-a]" >&2
71 echo "[-m] list of modules to test like: '-m sw,sc,sd' or '-m all' for all modules" >&2
73 echo "[-k] keep Office installation, otherwise it will be removed after test" >&2
75 echo "[-o] force OpenOffice.org installation instead of StarOffice" >&2
77 echo "[-d] debug installation and UnoAPI-Tests" >&2
79 # echo "[-i] debug installation" >&2
81 echo "[-t] debug UnoAPI-Tests" >&2
83 echo "[-s] skip installation of Office" >&2
85 echo "[-a] NoCwsAttach: do not attach UnoAPI-Test result to EIS database" >&2
87 echo "[-u] UseInstalledOffice: do not install an office" >&2
89 echo "further informations: http://wiki.services.openoffice.org/wiki/Cwscheckapi" >&2
94 # we start cwscheckapi
97 if [ "$PROEXT" != ".pro" ]; then
98 echo "ERROR: cwscheckapi works only on pro-versions" >&2
103 if [ x
${USER}x
= xx
]; then
104 if [ x
${LOGNAME}x
= xx
]; then
105 echo "ERROR: could not determine username. Please export variable USER" >&2
123 USE_INSTALLED_OFFICE
=false
125 while getopts ':m:dkutsaho' OPTION
; do
153 USE_INSTALLED_OFFICE
=true
156 echo "make sure your office is started with parameter -accept=pipe,name=$USER;urp;"
162 echo "unkown option \"-$OPTARG\"." >&2
166 echo "this is not possible...">&2
172 shift `expr $OPTIND - 1`
174 if [ -d /export
/home
/$USER ]; then
175 CWSCHECKAPIPATH
=/export
/home
/$USER/cwscheckapi
177 if [ -w /export
/home
]; then
178 mkdir
/export
/home
/$USER
179 CWSCHECKAPIPATH
=/export
/home
/$USER/cwscheckapi
181 CWSCHECKAPIPATH
=/tmp
/$USER/cwscheckapi
185 # the following line is to cleanup old cwscheckapi-installations. It results form the first version of cwscheckapi
186 # The disk space on /tmp is limited. If a lot of users run cwscheckapi a lot of installed offices are in /tmp
187 # The new concept is to remove the offices after test. But old unused installations should be removed...
188 if [ $CWSCHECKAPIPATH != /tmp
/$USER/cwscheckapi
]; then
189 rm -rf /tmp
/$USER/cwscheckapi
192 LOCALINSTALLDIR
=$CWSCHECKAPIPATH/office
193 LOCALUNPACKDIR
=$CWSCHECKAPIPATH/unpack
194 export LOCALINSTALLDIR
195 export LOCALUNPACKDIR
199 if [ $INSTALL = true
]; then
203 # if [ $DEBUG_I = true ]; then
204 # echo "start installation: `date`"
205 # echo call "$SOLARENV/bin/installoffice.pl -cwscheckapi true -dest $LOCALINSTALLDIR -debug $DEBUG_I"
207 perl
-w $SOLARENV/bin
/installoffice.pl
-cwscheckapi true
-dest $LOCALINSTALLDIR -ooo $OOO -debug $DEBUG_I
211 if [ $EXITVAL -ne 0 ]; then
212 echo "ERROR: could not install office"
216 echo "`date` installation successfull, start testing...."
225 if [ "$GUI" = "WNT" ]; then
226 SOFFICE
="soffice.exe"
228 CYGWIN
="-Cygwin true"
230 SHELL
=$
(cygpath
-w $SHELL)
231 if [ ! -f $SHELL ]; then
232 echo "could not determine bash shell"
238 # if [ $DEBUG_T = true ]; then
239 # echo find $LOCALINSTALLDIR -name $SOFFICE
242 if [ $USE_INSTALLED_OFFICE = false
]; then
244 OFFICEBIN
=`find $LOCALINSTALLDIR -name $SOFFICE`
246 if [ ! -f "$OFFICEBIN" ]; then
247 echo "could not find 'soffice' in subfolders of $LOCALINSTALLDIR"
252 if [ "$GUI" = "WNT" ]; then
253 # transform /tmp/... -> c:\tmp\...
254 OFFICEBIN
=`cygpath -w $OFFICEBIN`
258 echo "Use already installed and running office."
261 JARFOLDER
=$SOLARVERSION/$INPATH/bin
$UPDMINOREXT
262 SOLVER_LIB
=$SOLARVERSION/$INPATH/lib
$UPDMINOREXT
264 myCLASSPATH
=${PS}${JARFOLDER}/ridl.jar${PS}\
265 ${JARFOLDER}/unoil.jar
${PS}\
266 ${JARFOLDER}/jurt.jar
${PS}\
267 ${JARFOLDER}/juh.jar
${PS}\
268 ${JARFOLDER}/java_uno.jar
270 myCLASSPATH
=$myCLASSPATH${PS}\
271 ${JARFOLDER}/OOoRunner.jar
273 myCLASSPATH
=$myCLASSPATH${PS}\
274 /net
/unoapi
/export
/unoapi
/bin
/mysql.jar
${PS}\
278 if [ -n "$JAVAI" ]; then
280 elif [ -n "$JAVA_HOME" ]; then
281 if [ "$OS$CPUNAME$CPU" = SOLARISSPARCU
]; then
282 JAVABIN
=$JAVA_HOME/bin
/sparcv
9/java
284 JAVABIN
=$JAVA_HOME/bin
/java
287 echo "please set environment variable JAVA_HOME"
292 if [ -n "$WORK_STAMP" ]; then
293 if [ -n "$CWS_WORK_STAMP" ]; then
294 PARAM
="$PARAM -Version cws_${CWS_WORK_STAMP}"
297 echo CAUTION
! You are working on the MWS
299 PARAM
="$PARAM -Version ${WORK_STAMP}_${UPDMINOR}"
303 PARAM
="$PARAM -cmd '$OFFICEBIN -nofirststartwizard -no-oosplash -accept=pipe,name=$USER;urp; -norestore -nocrashreport -nolockcheck -enableautomation'"
304 PARAM
="$PARAM -cs pipe,name=$USER"
305 PARAM
="$PARAM -NoOffice true"
306 PARAM
="$PARAM -SRC_ROOT $SRC_ROOT"
307 PARAM
="$PARAM -COMP_ENV $OUTPATH"
308 PARAM
="$PARAM -Shell $SHELL"
309 PARAM
="$PARAM $CYGWIN"
310 PARAM
="$PARAM -tb java_complex"
311 PARAM
="$PARAM -TimeOut 90000"
312 PARAM
="$PARAM -o complex.unoapi.CheckModuleAPI::module($MODULES)"
313 if [ $ATTACH = false
]; then
314 PARAM
="$PARAM -nca true"
316 if [ $DEBUG_T = true
]; then
317 PARAM
="$PARAM -debug true -log true"
321 # /so/env/Linux_JDK_1.5.0_06/bin/java
323 # -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
324 # org.openoffice.Runner
325 # -Version cws_unoapi04
326 # -cmd '/tmp/ll93751/cwscheckapi/office/staroffice9/program/soffice -nofirststartwizard -accept=pipe,name=ll93751;urp; -norestore -nocrashreport -nolockcheck -enableautomation'
327 # -cs pipe,name=ll93751
329 # -SRC_ROOT /net/so-cwsserv02/export/cws/unoapi04/DEV300/src.m50
334 # -o 'complex.unoapi.CheckModuleAPI::module(auto)'
336 # XDEBUG=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y "
338 # set DEBUGAPI if you want to debug the checkapi
341 COMMAND
="$JAVABIN -Xmx120m $XDEBUG -cp $myCLASSPATH org.openoffice.Runner $PARAM $*"
344 LOGFILE
=$CWSCHECKAPIPATH/cwscheckapi.log
345 $COMMAND |
tee $LOGFILE
348 if [ $KEEPOFFICE = false
]; then
349 echo "remove office instrallation in $LOCALINSTALLDIR..."
350 rm -rf $LOCALINSTALLDIR
354 echo A logfile could be found here
: $LOGFILE
358 # send the results via cwstestresult.pl to EIS
359 if [ $EXITVAL -eq 0 ]; then