diff options
Diffstat (limited to 'smoketestoo_native')
28 files changed, 4185 insertions, 0 deletions
diff --git a/smoketestoo_native/check_setup.pl b/smoketestoo_native/check_setup.pl new file mode 100755 index 000000000000..8165b0c8a5b4 --- /dev/null +++ b/smoketestoo_native/check_setup.pl @@ -0,0 +1,73 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: check_setup.pl,v $ +# +# $Revision: 1.3 $ +# +# 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. +# +#************************************************************************* + +sub checkLogDat { + my ($setuplogfile) = shift; + my ($errorfound) = 0; + + open SETUPLOG, "<$setuplogfile" or die "canīt open file $setuplogfile"; + while(<SETUPLOG>) { + $line = $_; + chomp $line; + if ($line =~ /^ERR/ ) { + print "Error: $line\n"; + $errorfound = 1; + } + } + close SETUPLOG; + return !$errorfound; #check ok? +} + +$idStr = ' $Revision: 1.3 $ '; +$idStr =~ /Revision:\s+(\S+)\s+\$/ + ? ($prg_rev = $1) : ($prg_rev = "-"); + +print "checkSetup -- Version: $prg_rev\n"; + +if ( ($#ARGV >-1) && ($#ARGV < 1) ) { + $ARGV[0]=~ s/\"//g; +} + +if ( ! ( ($#ARGV >-1) && ($#ARGV < 1) && $ARGV[0] && (-e $ARGV[0] ) ) ) { + print "Usage: checkSetup <setuplogfile>\n" ; + exit(1); +} + +if (checkLogDat ($ARGV[0])) { + exit (0); +} +else { + print STDERR "ERROR: setup failed\n"; + exit (2); +} diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/MANIFEST.MF b/smoketestoo_native/com/sun/star/comp/smoketest/MANIFEST.MF new file mode 100755 index 000000000000..09e2f42ca0f6 --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/MANIFEST.MF @@ -0,0 +1,2 @@ +RegistrationClassName: com.sun.star.comp.smoketest.TestExtension + diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.idl b/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.idl new file mode 100755 index 000000000000..b20a25f69148 --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.idl @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TestExtension.idl,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +#ifndef _com_sun_star_comp_smoketest_TestExtension_idl_ +#define _com_sun_star_comp_smoketest_TestExtension_idl_ + +#include <com/sun/star/lang/XServiceInfo.idl> + + +module com { module sun { module star { module comp { module smoketest { + // example service, XServiceInfo is implemented here for demonstration + // issues. XServiceInfo must be implemented by all components. + service TestExtension: ::com::sun::star::lang::XServiceInfo; +};};};};}; + +#endif diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.java b/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.java new file mode 100755 index 000000000000..ec87d2ee9803 --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/TestExtension.java @@ -0,0 +1,169 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TestExtension.java,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.comp.smoketest; + +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.Type; + +/** This class capsulates the class, that implements the minimal component, a + * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a + * method, that writes the information into the given registry key + * (<CODE>__writeRegistryServiceInfo</CODE>). + */ +public class TestExtension { + /** This class implements the component. At least the interfaces XServiceInfo, + * XTypeProvider, and XInitialization should be provided by the service. + */ + public static class _TestExtension extends WeakBase + implements XServiceInfo { + /** The service name, that must be used to get an instance of this service. + */ + static private final String __serviceName = + "com.sun.star.comp.smoketest.TestExtension"; + + /** The initial component contextr, that gives access to + * the service manager, supported singletons, ... + * It's often later used + */ + private XComponentContext m_cmpCtx; + + /** The service manager, that gives access to all registered services. + * It's often later used + */ + private XMultiComponentFactory m_xMCF; + + /** The constructor of the inner class has a XMultiServiceFactory parameter. + * @param xmultiservicefactoryInitialization A special service factory + * could be introduced while initializing. + */ + public _TestExtension(XComponentContext xCompContext) { + try { + m_cmpCtx = xCompContext; + m_xMCF = m_cmpCtx.getServiceManager(); + } + catch( Exception e ) { + e.printStackTrace(); + } + } + + /** This method returns an array of all supported service names. + * @return Array of supported service names. + */ + public String[] getSupportedServiceNames() { + return getServiceNames(); + } + + /** This method is a simple helper function to used in the + * static component initialisation functions as well as in + * getSupportedServiceNames. + */ + public static String[] getServiceNames() { + String[] sSupportedServiceNames = { __serviceName }; + return sSupportedServiceNames; + } + + /** This method returns true, if the given service will be + * supported by the component. + * @param sServiceName Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService( String sServiceName ) { + return sServiceName.equals( __serviceName ); + } + + /** Return the class name of the component. + * @return Class name of the component. + */ + public String getImplementationName() { + return _TestExtension.class.getName(); + } + } + + + /** + * Gives a factory for creating the service. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns a <code>XSingleComponentFactory</code> for creating + * the component + * @param sImplName the name of the implementation for which a + * service is desired + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleComponentFactory __getComponentFactory(String sImplName) + { + XSingleComponentFactory xFactory = null; + + if ( sImplName.equals( _TestExtension.class.getName() ) ) + xFactory = Factory.createComponentFactory(_TestExtension.class, + _TestExtension.getServiceNames()); + + return xFactory; + } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return Factory.writeRegistryServiceInfo(_TestExtension.class.getName(), + _TestExtension.getServiceNames(), + regKey); + } + /** This method is a member of the interface for initializing an object + * directly after its creation. + * @param object This array of arbitrary objects will be passed to the + * component after its creation. + * @throws Exception Every exception will not be handled, but will be + * passed to the caller. + */ + public void initialize( Object[] object ) + throws com.sun.star.uno.Exception { + /* The component describes what arguments its expected and in which + * order!At this point you can read the objects and can intialize + * your component using these objects. + */ + } + +} diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/delzip b/smoketestoo_native/com/sun/star/comp/smoketest/delzip new file mode 100755 index 000000000000..636fda90bfcb --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/delzip @@ -0,0 +1 @@ +ECHO is OFF diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/makefile.mk b/smoketestoo_native/com/sun/star/comp/smoketest/makefile.mk new file mode 100755 index 000000000000..d111eacbd349 --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2009 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# 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. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/.. +PRJNAME = smoke_test +PACKAGE = com$/sun$/star$/comp$/smoketest +TARGET = com_sun_star_comp_smoketest + +no_common_build_zip:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +JARFILES = ridl.jar jurt.jar unoil.jar juh.jar + + +JARTARGET = TestExtension.jar +JARCOMPRESS = TRUE +CUSTOMMANIFESTFILE = MANIFEST.MF + +ZIP1TARGET=TestExtension +ZIP1LIST=* +ZIPFLAGS=-r +ZIP1DIR=$(MISC)$/$(TARGET) +ZIP1EXT=.oxt + +# --- Files -------------------------------------------------------- + +#COPY_OXT_MANIFEST:= $(MISC)$/$(TARGET)$/META-INF$/manifest.xml +JAVAFILES = TestExtension.java + +# --- Targets ------------------------------------------------------ + +ZIP1DEPS=$(MISC)$/$(TARGET)$/$(JARTARGET)\ + $(MISC)$/$(TARGET)$/TestExtension.rdb\ + $(MISC)$/$(TARGET)$/META-INF$/manifest.xml + +.INCLUDE : target.mk + +$(MISC)$/TestExtension.urd: TestExtension.idl + $(IDLC) -O$(MISC) -I$(SOLARIDLDIR) -cid -we $< + +$(MISC)$/$(TARGET)$/META-INF$/manifest.xml: manifest.xml + @-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + +$(MISC)$/$(TARGET)$/TestExtension.rdb: $(MISC)$/TestExtension.urd + $(REGMERGE) $@ /UCR $< + +$(JAVACLASSFILES) .UPDATEALL: $(MISC)$/$(TARGET)$/TestExtension.rdb + $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -X$(SOLARBINDIR)/types.rdb $< + +$(MISC)$/$(TARGET)$/$(JARTARGET) : $(JARTARGETN) + $(COPY) $< $@ diff --git a/smoketestoo_native/com/sun/star/comp/smoketest/manifest.xml b/smoketestoo_native/com/sun/star/comp/smoketest/manifest.xml new file mode 100755 index 000000000000..7e3e7947aa0f --- /dev/null +++ b/smoketestoo_native/com/sun/star/comp/smoketest/manifest.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<manifest:manifest> + <manifest:file-entry manifest:full-path="TestExtension.jar" manifest:media-type="application/vnd.sun.star.uno-component;type=Java"/> + <manifest:file-entry manifest:full-path="TestExtension.rdb" manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"/> +</manifest:manifest>
\ No newline at end of file diff --git a/smoketestoo_native/config.pl b/smoketestoo_native/config.pl new file mode 100755 index 000000000000..642a256e33d4 --- /dev/null +++ b/smoketestoo_native/config.pl @@ -0,0 +1,171 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: config.pl,v $ +# +# $Revision: 1.5 $ +# +# 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. +# +#************************************************************************* + +use File::Path; +use File::Copy; + +### globals ### + +$is_debug = 0; + +$gui = $ENV{GUI}; +$cygwin = "cygwin"; + +if ($^O =~ /cygwin/) { + $gui = $cygwin; +} + +if (($gui eq "UNX") or ($gui eq $cygwin)) { + $pathslash = "/"; +} +else +{ + $pathslash = "\\"; +} + +#### Hardly coded path for +# \share\registry\data\org\openoffice\Office\Jobs.xcu + +$jobs_XML_Path = "share" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash . "Office" . $pathslash . "Jobs.xcu"; + +# \user\registry\data\org\openoffice\ + +$User_Path = "user" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash; + +# \user\registry\data\org\openoffice\Office\ + +$User_Office_Path = $User_Path . "Office" . $pathslash; + +# \user\registry\data\org\openoffice\Office\OOoImprovement + +$OOoImprovement_Path = $User_Office_Path . "OOoImprovement" . $pathslash; + +$common_XML = "Common.xcu"; +$setup_XML = "Setup.xcu"; +$oooimprovement_XML = "Settings.xcu"; + +# $(INPATH)\misc\Common.xcu +$inpath_Common_XCU = $ENV{INPATH} . $pathslash . "misc" . $pathslash . $common_XML; + +### main ### + +$idStr = ' $Revision: 1.5 $ '; +$idStr =~ /Revision:\s+(\S+)\s+\$/ + ? ($cpflat2minor_rev = $1) : ($cpflat2minor_rev = "-"); + +if ( ($#ARGV >= 3) ) { + $ARGV[0] =~ s/\"//g; + $ARGV[1] =~ s/\"//g; + $ARGV[2] =~ s/\"//g; + $ARGV[3] =~ s/\"//g; + chop($ARGV[0]); + chop($ARGV[1]); + chop($ARGV[2]); + chop($ARGV[3]); +} + +if ( ! ( ($#ARGV >= 4) && $ARGV[0] && $ARGV[1] && $ARGV[2] && $ARGV[3] && (-d $ARGV[3]) && $ARGV[4] ) ) { + print "Usage: config <basispath> <brandpath> <userinstallpath> <datapath> <buildid>\n" ; + exit(1); +} + +$basisdir = $ARGV[0]; +$branddir = $ARGV[1]; +$userinstalldir = $ARGV[2]; +$datapath = $ARGV[3]; +$buildid = $ARGV[4]; + +$fullquickstart_path = $branddir . "program" . $pathslash . "quickstart.exe"; + +print "patching config ... \n"; +if (!-d "$userinstalldir$User_Office_Path") { + mkpath("$userinstalldir$User_Office_Path", 0, 0777); +} +if (!-d "$userinstalldir$OOoImprovement_Path") { + mkpath("$userinstalldir$OOoImprovement_Path", 0, 0777); +} + +# copy Common.xcu +print "Patching Common.xcu\n" if $is_debug; +PatchCommonXcu($buildid); +print "cp $inpath_Common_XCU $userinstalldir$User_Office_Path$common_XML\n" if $is_debug; +copy ("$inpath_Common_XCU", "$userinstalldir$User_Office_Path$common_XML"); + +# copy OOoImprovement/Settings.xcu + +print "cp $datapath$oooimprovement_XML $userinstalldir$OOoImprovement_Path$oooimprovement_XML\n" if $is_debug; +copy ("$datapath$oooimprovement_XML", "$userinstalldir$OOoImprovement_Path$oooimprovement_XML"); + +# copy Setup.xcu + +print "cp $datapath$setup_XML $userinstalldir$User_Path$setup_XML\n" if $is_debug; +copy ("$datapath$setup_XML", "$userinstalldir$User_Path$setup_XML"); + + +# quickstarter loeschen +if ($gui ne "UNX") { + print "kill $fullquickstart_path \n"; + unlink( $fullquickstart_path ) or die "cannot unlink $fullquickstart_path"; +} + +#delete joblist +$fullsource_path = $basisdir . $jobs_XML_Path; +unlink ($fullsource_path); + +exit(0); + +############################################################################ +sub PatchCommonXcu #17.04.2009 10:37 +############################################################################ + { + my $buildid = shift; + open(INFILE, "< $datapath$common_XML") || die "Can't open $datapath$common_XML (read)\n"; + open(OUTFILE, "> $inpath_Common_XCU") || die "Can't open $inpath_Common_XCU (write)\n"; + my $patch_next_line = 0; + my $value = "<value>Patch" . $buildid . "</value>\n"; + while ( $line = <INFILE> ) { + if ( $patch_next_line ) { + print OUTFILE " $value"; + $patch_next_line = 0; + } else + { + print OUTFILE $line; + } + if ( $line =~ /ReminderDate/ ) { + $patch_next_line = 1; + } + } + close(INFILE); + close(OUTFILE); +} ##PatchCommonXcu diff --git a/smoketestoo_native/data/Common.xcu b/smoketestoo_native/data/Common.xcu new file mode 100644 index 000000000000..8cb90a69b7b6 --- /dev/null +++ b/smoketestoo_native/data/Common.xcu @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:package="org.openoffice.Office" oor:name="Common"> + <node oor:name="Misc"> + <prop oor:name="FirstRun" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> + <node oor:name="Security"> + <node oor:name="Scripting"> + <prop oor:name="OfficeBasic" oor:type="xs:int"> + <value>2</value> + </prop> + <prop oor:name="MacroSecurityLevel" oor:type="xs:int"> + <value>0</value> + </prop> + </node> + </node> + <node oor:name="Help"> + <node oor:name="Registration"> + <prop oor:name="ReminderDate"> + <value/> + </prop> + </node> + </node> +</oor:component-data> diff --git a/smoketestoo_native/data/Settings.xcu b/smoketestoo_native/data/Settings.xcu new file mode 100644 index 000000000000..425e789dabc1 --- /dev/null +++ b/smoketestoo_native/data/Settings.xcu @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Settings" oor:package="org.openoffice.Office.OOoImprovement"> + <node oor:name="Participation"> + <prop oor:name="ShowedInvitation" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="InvitationAccepted" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> +</oor:component-data> diff --git a/smoketestoo_native/data/Setup.xcu b/smoketestoo_native/data/Setup.xcu new file mode 100644 index 000000000000..cbcd2ef8f1ca --- /dev/null +++ b/smoketestoo_native/data/Setup.xcu @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Setup" oor:package="org.openoffice"> + <node oor:name="Office"> + <prop oor:name="LicenseAcceptDate" oor:type="xs:string"> + <value>2100-01-01T00:00:00</value> + </prop> + <prop oor:name="FirstStartWizardCompleted" oor:type="xs:boolean"> + <value>true</value> + </prop> + </node> +</oor:component-data> diff --git a/smoketestoo_native/data/TestExtension.oxt b/smoketestoo_native/data/TestExtension.oxt Binary files differnew file mode 100755 index 000000000000..70580b6a52e3 --- /dev/null +++ b/smoketestoo_native/data/TestExtension.oxt diff --git a/smoketestoo_native/data/dbgsv.ini b/smoketestoo_native/data/dbgsv.ini new file mode 100644 index 000000000000..42142b4124e5 --- /dev/null +++ b/smoketestoo_native/data/dbgsv.ini @@ -0,0 +1,42 @@ +[output] +log_file=dbgsv.log +overwrite=1 +include= +exclude= +include_class= +exclude_class= +trace=dev/null +warning=dev/null +error=window + +[memory] +initialize=1 +overwrite=0 +overwrite_free=0 +pointer=0 +report=0 +trace=0 +new_and_delete=0 +object_test=0 +sys_alloc=0 +leak_report=0 + +init_byte=77 +bound_byte=55 +free_byte=33 + +[gui] +debug_window_state= + +[objects] +check_this=0 +check_function=0 +check_exit=0 +generate_report=0 +trace=0 + +[test] +profiling=0 +resources=1 +dialog=0 +bold_app_font=0 diff --git a/smoketestoo_native/data/scripts/Global.xba b/smoketestoo_native/data/scripts/Global.xba new file mode 100755 index 000000000000..c56b444cf030 --- /dev/null +++ b/smoketestoo_native/data/scripts/Global.xba @@ -0,0 +1,739 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Global" script:language="StarBasic">REM ***** BASIC ***** + +const cMaxErrorStates = 13 + +const cCoGreen = 4057917, cCoRed = 16711680, cCoGrey = 12632256 +const cParagraphBreak = 0 + +global const cExtensionFileName = "TestExtension.oxt" + +global const cDocNew = 0, cDocCut = 1, cDocPaste = 2, cDocSaveOpen8 = 3, cDocSaveOpenXML = 4, cDocSaveOpen50 = 5, cDocClose = 6, cDocWrite = 7 +global const cNewsInit = 0, cNewsSend = 1, cNewsRead = 2 +global const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5 +global const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2 +global const cScheduleDateRead = 0 +global const cLogfileFailed = 255 + +global const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3 +global const cStMessage = 12, cStHTML = 6, cStChart = 4, cStJava = 7 +global const cStMath = 5, cStNews = 10, cStSchedule = 8, cStDataBase = 9 +global const cStExtension = 11 +global const cStNone = -1 + +global const cFlt8 = 0, cFlt50 = 32, cFltNewDoc = 64, cFltXML = 128 + +global const frmWriter = 1, frmCalc = 2, frmMessage = 3, frmImpress = 4 +global const frmMath = 5, frmImage = 6, frmChart = 7, frmHyperText = 8, frmDraw = 9 +global const frmDataBase = 10, frmSchedule = 11, frmNews = 12, frmJava = 13 +global const frmExtension = 14 + +global const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2 + +'UserFieldKennungen +Global const cYes = "y", cNo = "n" +Global const cStateNo = 0, cStateYes = 1 + +'Feldtypen +Global const cFtExtUser = 21, cFtPageNum = 5, cFtStatistic = 8, cFtDateTime = 27, cFtDatabase = 31 + +'UnoStrings +Global const cUnoSeparator = "." +Global const cUnoPrefix = "com.sun.star." +Global const cUnoUserField = cUnoPrefix + "text.FieldMaster.User" +Global const cUnoExtUserField = cUnoPrefix + "text.TextField.ExtendedUser" +Global const cUnoMasterDataBase = cUnoPrefix + "text.FieldMaster.Database" +Global const cUnoDataBase = cUnoPrefix + "text.TextField.Database" +Global const cUnoDateTime = cUnoPrefix + "text.TextField.DateTime" +Global const cUnoTextGraphi2 = cUnoPrefix + "text.Graphic" +Global const cUnoJavaLoader = cUnoPrefix + "loader.Java" +Global const cUnoDatabaseContext = cUnoPrefix + "sdb.DatabaseContext" +Global const cUnoRowSet = cUnoPrefix + "sdb.RowSet" +Global const cUnoSmoketestTestExtension = cUnoPrefix + "comp.smoketest.TestExtension" +Global const cUnoSmoketestCommandEnvironment = cUnoPrefix + "deployment.test.SmoketestCommandEnvironment" +Global const cUnothePackageManagerFactory = cUnoPrefix + "deployment.thePackageManagerFactory" + +'UserFieldNames +Global const cUserFieldTestWriter = "Writer", cUserFieldTestCalc = "Calc", cUserFieldTestImpress = "Impress" +Global const cUserFieldTestDraw = "Draw", cUserFieldTestMath = "Math", cUserFieldTestChart = "Chart" +Global const cUserFieldTestHTML = "HTML", cUserFieldTestJava = "Java", cUserFieldTestDatabase = "Database" +Global const cUserFieldTestExtension = "Extension" +Global const cUserFieldTestOpenSaveXML = "SaveOpenXML", cUserFieldTestOpenSave50 = "SaveOpen50", cUserFieldTestCut = "Cut" +Global const cUserFieldTestPaste = "Paste", cUserFieldTestTerminateAfterTest = "Terminate", cUserFieldTestOpenSave8 = "SaveOpen8" + +Global const cOptionsDialogName = "OptionsDlg", cTest10Modul = "Standard" + +Global const cDlgCancel = 1, cDlgOk = 0, cDlgStartTest = 2 + +global gErrorState (cMaxErrorStates, 5) as integer + +global gOutputDoc as Object +global gOutputDocNotUno as Object +global gOptionsDialog as Object +Dim bMakeMailAccount as Boolean, bTestMail as Boolean, bTestDocs as Boolean +Dim bTestSchedule as Boolean, bTestAdr as Boolean + +Global bMakeWriterTest as boolean, bMakeCalcTest as boolean, bMakeImpressTest as boolean +Global bMakeDrawTest as Boolean, bMakeMathTest as boolean, bMakeChartTest as boolean +Global bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolean +Global bMakeExtensionTest as boolean +Global bMakeSaveOpenXMLTest as boolean, bMakeSaveOpen50Test as boolean, bMakeCutTest as boolean +Global bMakePasteTest as boolean, bMakeTerminateAfterTest as boolean, bShowTable as boolean +Global bMakeSaveOpen8Test as boolean + +global sExtensionURL as string + +Dim gDlgState as Integer + +Sub SetGlobalDoc + gOutPutDoc = StarDesktop.CurrentComponent +end Sub + +Sub ClearStatus + for j% = 0 to cMaxErrorStates + for i% = 0 to 5 + gErrorState (j%, i%) = cLogUnknown + next i% + next j% +end Sub + +Sub ClearAllText + call SetGlobalDoc + call ClearDoc (gOutPutDoc) + call ClearStatus +end Sub + +Sub Main + call SetGlobalDoc + if bShowTable then + call ClearDoc (gOutPutDoc) + end If + + call ClearStatus + + Call Test_10er.Main + + if bShowTable then + call CreateStatusTable2 + call CreateStatusTable + call CreateDocState + call CreateSecondState + gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage + end if +End Sub + +Sub CreateStatusTable + dim tableHeaders(7) as string + tableHeaders(cStWriter) = "Writer" + tableHeaders(cStCalc) = "Calc" + tableHeaders(cStPraesentation) = "PrÃĪsen- tation" + tableHeaders(cStZeichnen) = "Zeichn." + tableHeaders(cStChart) = "Diagr." + tableHeaders(cStMath) = "Math" + tableHeaders(cStHTML) = "HTML" + tableHeaders(cStJava) = "Java" + + dim tableColums(5) as string + tableColums(cDocNew) = "new" + tableColums(cDocCut) = "cut" + tableColums(cDocPaste) = "paste" + tableColums(cDocSaveOpen8) = "V8.0" + tableColums(cDocSaveOpenXML) = "XML" + tableColums(cDocSaveOpen50) = "V5.0" +' tableColums(cDocClose) = "close" + + aDoc = gOutPutDoc + + xText = aDoc.Text + xCursor = xText.createTextCursor() + +' xCursor.gotoStart(FALSE) +' xCursor.GoRight (2, False) +' SetParagraphBreak (xCursor) +' SetParagraphBreak (xCursor) + xCursor.gotoStart(FALSE) + xCursor.GoRight (4, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) + + table = aDoc.createInstance("com.sun.star.text.TextTable") + table.initialize(7,9) + table.Name = "StTab1" + xText.insertTextContent(xCursor, table, FALSE) + + tableCursor = table.createCursorByCellName(table.CellNames(0)) + tableCursor.gotoStart(FALSE) + tableCursor.goRight(1,FALSE) + + for i% = 0 to 7 + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.String=tableHeaders(i%) + + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + + tableCursor.goRight(1,FALSE) + next i% + + xCursor.gotoStart(FALSE) +' SetParagraphBreak (xCursor) +' SetParagraphBreak (xCursor) + + tableCursor.gotoStart(FALSE) + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + + for i% = 0 to 5 + tableCursor.goDown(1,FALSE) + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.String=tableColums(i%) + + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + next i% +end Sub + +Sub CreateStatusTable2 + dim tableHeaders(5) as string + tableHeaders(cStDataBase-9) = "Database" + tableHeaders(1) = "" + tableHeaders(cStExtension-9) = "Extension" + tableHeaders(3) = "" + tableHeaders(4) = "" + + dim tableColums(5) as string + tableColums(cDBService ) = "services" + tableColums(cDBOpen ) = "open" + tableColums(cDBInsert ) = "insert" + tableColums(cDBDelete ) = "delete" + tableColums(cDBSeek ) = "seek" + tableColums(cDBClose ) = "close" + + dim tableColums2(3) as string + tableColums2(cEXTService ) = "services" + tableColums2(cEXTInstall ) = "install" + tableColums2(cEXTUninstall ) = "uninstall" + + aDoc = gOutPutDoc + + xText = aDoc.Text + xCursor = xText.createTextCursor() + + xCursor.gotoStart(FALSE) + xCursor.GoRight (4, False) + SetParagraphBreak (xCursor) + SetParagraphBreak (xCursor) + xCursor.gotoEnd(FALSE) + + table = aDoc.createInstance("com.sun.star.text.TextTable") + table.initialize(7,6) + table.Name = "StTab2" + 'table.RelativeWidth =500 + + xText.insertTextContent(xCursor, table, FALSE) + + tableCursor = table.createCursorByCellName(table.CellNames(0)) + tableCursor.gotoStart(FALSE) + tableCursor.goRight(1,FALSE) + + for i% = 0 to 5 + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.String=tableHeaders(i%) + + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + + tableCursor.goRight(1,FALSE) + next i% + + tableCursor.gotoStart(FALSE) + + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + + for i% = 0 to 5 + tableCursor.goDown(1,FALSE) + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.String=tableColums(i%) + + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + next i% + + tableCursor.gotoStart(FALSE) + tableCursor.goRight(2,FALSE) + + for i% = 0 to 3 + tableCursor.goDown(1,FALSE) + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + xCell.String=tableColums2(i%) + + xCell.BackTransparent = False + xCell.BackColor = cCoGrey + next i% +end Sub + + +Sub CreateDocState + aDoc = gOutPutDoc + table = aDoc.TextTables.GetByIndex (1) + 'table = aDoc.TextTables.GetByName ("StTab1") + + for j% = 0 to 7 + for i% = 0 to 5 + sRangeName = GetRangeName(j%, i%+1) + + tableCursor = table.createCursorByCellName(sRangeName) + + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + + xCell.BackTransparent = False + + if gErrorState (j%, i%) = cLogTrue then + xCell.BackColor = cCoGreen + else if gErrorState (j%, i%) = cLogFalse then + xCell.BackColor = cCoRed + else + xCell.BackColor = cCoGrey + end If + end If + + next i% + next j% +end Sub + +Sub CreateSecondState + aDoc = gOutPutDoc + table = aDoc.TextTables.GetByIndex (0) + 'table = aDoc.TextTables.GetByName ("StTab2") + + for j% = 0 to cMaxErrorStates-9 + for i% = 0 to 5 + sRangeName = GetRangeName(j%, i%+1) + + tableCursor = table.createCursorByCellName(sRangeName) + + cName = tableCursor.getRangeName() + xCell = table.getCellByName(cName) + + xCell.BackTransparent = False + + if gErrorState (j%+9, i%) = cLogTrue then + xCell.BackColor = cCoGreen + else if gErrorState (j%+9, i%) = cLogFalse then + xCell.BackColor = cCoRed + else + xCell.BackColor = cCoGrey + end If + end If + + next i% + next j% +end Sub + +Function GetRangeName (nColumn as integer, nRow as integer) as string + GetRangeName = chr (nColumn+66) + Trim(Str(nRow+1)) +end Function + +Sub SetStatus (nDocType as Integer, nAction as Integer, bState as Boolean) + Dim nStatusType as Integer + Dim nState as integer + nStatusType = GetStatusType (nDocType) + If nStatusType = cStNone then Exit Sub + + if bState then + nState = cLogTrue + else + nState = cLogFalse + end If + + gErrorState (nStatusType, nAction) = nState +end Sub + +Function GetStatusType (nDocType as Integer) as Integer + Select Case ( nDocType ) + case frmWriter + GetStatusType = cStWriter ' Textdokument + case frmCalc + GetStatusType = cStCalc 'Tabellendokument + case frmMessage + GetStatusType = cStMessage 'Nachricht + case frmImpress + GetStatusType = cStPraesentation 'PrÃĪsentation + case frmDraw + GetStatusType = cStZeichnen 'Zeichnen + case frmMath + GetStatusType = cStMath 'Formel + case frmImage + GetStatusType = cStBild 'Bild + case frmHyperText + GetStatusType = cStHTML 'Hypertext-Dokument + case frmChart + GetStatusType = cStChart 'Diagramm + case frmSchedule + GetStatusType = cStSchedule 'Diagramm + case frmJava + GetStatusType = cStJava 'Java + case frmNews + GetStatusType = cStNews 'News + case frmDataBase + GetStatusType = cStDataBase 'DataBase + case frmExtension + GetStatusType = cStExtension 'Extension + case else + GetStatusType = cStNone + end Select +end Function + +Sub SetParagraphBreak (aCursor as Object) + aCursor.Text.InsertControlCharacter (aCursor, cParagraphBreak, True) +end Sub + +Sub ClearDoc (aDoc as Object) + Dim aText as Object + Dim i% + for i%=1 to aDoc.TextTables.count + aDoc.TextTables.GetByIndex(0).dispose + next + + aText = aDoc.Text.CreateTextCursor + aText.GotoStart (False) + aText.GoRight (3, False) + SetParagraphBreak (aText) + aText.GotoEnd (True) + aText.String="" +end Sub + +Sub ClearDocFull (aDoc as Object) + Dim aText as Object + Dim i% + for i%=1 to aDoc.TextTables.count + aDoc.TextTables.GetByIndex(0).dispose + next + + aText = aDoc.Text.CreateTextCursor + aText.GotoStart (False) + aText.GotoEnd (True) + aText.String="" +end Sub + +Sub SetGlobalOptionsDialog () + + Dim oLibContainer As Object, oLib As Object + Dim oInputStreamProvider As Object + Dim oDialog As Object + + Const sLibName = cTest10Modul + Const sDialogName = cOptionsDialogName + + REM get library and input stream provider + oLibContainer = DialogLibraries + + REM load the library + oLibContainer.loadLibrary( sLibName ) + + oLib = oLibContainer.getByName( sLibName ) + oInputStreamProvider = oLib.getByName( sDialogName ) + + REM create dialog control + gOptionsDialog = CreateUnoDialog( oInputStreamProvider ) + +end Sub + +Sub ShowOptionsDlg + + call SetGlobalDoc + call SetGlobalOptionsDialog + call GetOptions + + REM show the dialog + gOptionsDialog.execute() + + ' jetzt lÃĪuft der Dialog, bis ein Button gedrÞckt wird + + Select Case (gDlgState) + case cDlgOk + call SetOptions () + case cDlgStartTest + call SetOptions () + call StartTestByOptions () + end Select + + gOptionsDialog.dispose() + +end Sub + +Sub SetOptions + call SetGlobalDoc + SetUserFieldState (cUserFieldTestWriter, -(gOptionsDialog.getControl("cbWriterTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestCalc, -(gOptionsDialog.getControl("cbCalcTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestImpress, -(gOptionsDialog.getControl("cbImpressTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestDraw, -(gOptionsDialog.getControl("cbDrawTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestHTML, -(gOptionsDialog.getControl("cbHTMLTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestMath, -(gOptionsDialog.getControl("cbMathTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestChart, -(gOptionsDialog.getControl("cbChartTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestJava, -(gOptionsDialog.getControl("cbJavaTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestDatabase, -(gOptionsDialog.getControl("cbDatabaseTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestExtension, -(gOptionsDialog.getControl("cbExtensionTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestOpenSaveXML, -(gOptionsDialog.getControl("cbSaveOpenXMLTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestOpenSave50, -(gOptionsDialog.getControl("cbSaveOpen50Test").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl("cbSaveOpen8Test").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestCut, -(gOptionsDialog.getControl("cbCutTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestPaste, -(gOptionsDialog.getControl("cbPasteTest").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl("cbTerminateAfterTest").getState), gOutPutDoc) +end Sub + +Sub GetOptions + call SetGlobalDoc + gOptionsDialog.getControl("cbWriterTest").setState( -( GetUserFieldState (cUserFieldTestWriter, gOutPutDoc))) + gOptionsDialog.getControl("cbCalcTest").setState ( -( GetUserFieldState (cUserFieldTestCalc, gOutPutDoc))) + gOptionsDialog.getControl("cbImpressTest").setState( -( GetUserFieldState (cUserFieldTestImpress, gOutPutDoc))) + gOptionsDialog.getControl("cbDrawTest").setState( -( GetUserFieldState (cUserFieldTestDraw, gOutPutDoc))) + gOptionsDialog.getControl("cbHTMLTest").setState( -( GetUserFieldState (cUserFieldTestHTML, gOutPutDoc))) + gOptionsDialog.getControl("cbMathTest").setState( -( GetUserFieldState (cUserFieldTestMath, gOutPutDoc))) + gOptionsDialog.getControl("cbChartTest").setState( -( GetUserFieldState (cUserFieldTestChart, gOutPutDoc))) + gOptionsDialog.getControl("cbJavaTest").setState( -( GetUserFieldState (cUserFieldTestJava, gOutPutDoc))) + gOptionsDialog.getControl("cbDatabaseTest").setState( -( GetUserFieldState (cUserFieldTestDatabase, gOutPutDoc))) + gOptionsDialog.getControl("cbExtensionTest").setState( -( GetUserFieldState (cUserFieldTestExtension, gOutPutDoc))) + gOptionsDialog.getControl("cbSaveOpenXMLTest").setState( -( GetUserFieldState (cUserFieldTestOpenSaveXML, gOutPutDoc))) + gOptionsDialog.getControl("cbSaveOpen50Test").setState( -( GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc))) + gOptionsDialog.getControl("cbSaveOpen8Test").setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc))) + gOptionsDialog.getControl("cbCutTest").setState( -( GetUserFieldState (cUserFieldTestCut, gOutPutDoc))) + gOptionsDialog.getControl("cbPasteTest").setState( -( GetUserFieldState (cUserFieldTestPaste, gOutPutDoc))) + gOptionsDialog.getControl("cbTerminateAfterTest").setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc))) +End Sub + +Sub ReadOptions + call SetGlobalDoc + bTestDocs = true + bMakeWriterTest = GetUserFieldState (cUserFieldTestWriter, gOutPutDoc) + bMakeCalcTest = GetUserFieldState (cUserFieldTestCalc, gOutPutDoc) + bMakeImpressTest = GetUserFieldState (cUserFieldTestImpress, gOutPutDoc) + bMakeDrawTest = GetUserFieldState (cUserFieldTestDraw, gOutPutDoc) + bMakeHTMLTest = GetUserFieldState (cUserFieldTestHTML, gOutPutDoc) + bMakeMathTest = GetUserFieldState (cUserFieldTestMath, gOutPutDoc) + bMakeChartTest = GetUserFieldState (cUserFieldTestChart, gOutPutDoc) + bMakeJavaTest = GetUserFieldState (cUserFieldTestJava, gOutPutDoc) + bMakeDBTest = GetUserFieldState (cUserFieldTestDatabase, gOutPutDoc) + bMakeExtensionTest = GetUserFieldState (cUserFieldTestExtension, gOutPutDoc) + bMakeSaveOpenXMLTest = GetUserFieldState (cUserFieldTestOpenSaveXML, gOutPutDoc) + bMakeSaveOpen50Test = GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc) + bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc) + bMakeCutTest = GetUserFieldState (cUserFieldTestCut, gOutPutDoc) + bMakePasteTest = GetUserFieldState (cUserFieldTestPaste, gOutPutDoc) + bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc) +end Sub + +Sub SetDefaultOptions + bTestDocs = true + bMakeWriterTest = true + bMakeCalcTest = true + bMakeImpressTest = true + bMakeDrawTest = true + bMakeHTMLTest = true + bMakeMathTest = true + bMakeChartTest = true + bMakeJavaTest = true + bMakeDBTest = true + bMakeExtensionTest = true + bMakeSaveOpenXMLTest = true + REM Disable StarOffice 5.0 tests in case binfilter has not been included + if Environ("WITH_BINFILTER") = "NO" then + bMakeSaveOpen50Test = false + else + bMakeSaveOpen50Test = true + End If + bMakeSaveOpen8Test = true + bMakeCutTest = true + bMakePasteTest = true + bMakeTerminateAfterTest = true +end Sub + +Sub ShutdownQuickstarter + dim qs as Object + qs = createUnoService("com.sun.star.comp.desktop.QuickstartWrapper" ) + qs.setFastPropertyValue( 0, false ) +end Sub + +Sub StartTestByOptions + call ShutdownQuickstarter + bShowTable = true + call ReadOptions + call Main + + if bMakeTerminateAfterTest then + + ClearDocFull (gOutPutDoc) + gOutPutDoc.dispose + 'StarDesktop.Terminate + + 'EnableReschedule( false ) + 'DispatchSlot( 5300 ) + stop + End If +end Sub + +Sub StartTestWithDefaultOptions + call ShutdownQuickstarter + bShowTable = false + call SetDefaultOptions + call Main + + if bMakeTerminateAfterTest then + stop + + ClearDocFull (gOutPutDoc) + gOutPutDoc.dispose + 'StarDesktop.Terminate + 'EnableReschedule( false ) + 'DispatchSlot( 5300 ) + stop + End If +end Sub + +Sub DispatchSlot(SlotID as Integer) + Dim oArg() as new com.sun.star.beans.PropertyValue + Dim oUrl as new com.sun.star.util.URL + Dim oTrans as Object + Dim oDisp as Object + + oTrans = createUNOService("com.sun.star.util.URLTransformer") + oUrl.Complete = "slot:" & CStr(SlotID) + oTrans.parsestrict(oUrl) + + oDisp = StarDesktop.queryDispatch(oUrl, "_self", 0) + oDisp.dispatch(oUrl, oArg()) +End Sub + +Sub LoadLibrary( LibName As String ) + + dim args(1) + dim arg as new com.sun.star.beans.PropertyValue + arg.Name = "LibraryName" + arg.Value = LibName + args(0) = arg + + dim url as new com.sun.star.util.URL + dim trans as object + trans = createUnoService("com.sun.star.util.URLTransformer" ) + url.Complete = "slot:6517" + trans.parsestrict( url ) + + dim disp as object + disp = StarDesktop.currentFrame.queryDispatch( url, "", 0 ) + disp.dispatch( url, args() ) + +End Sub + +Sub ExecuteSlot( SlotNr As String, oDoc as Object ) + dim args() + dim url as new com.sun.star.util.URL + dim trans as object + dim disp as object + + trans = createUnoService("com.sun.star.util.URLTransformer" ) + url.Complete = "slot:" + SlotNr + trans.parsestrict( url ) + + disp = oDoc.CurrentController.Frame.queryDispatch( url, "", 0 ) + disp.dispatch( url, args() ) + +End Sub + +Sub CutText (oDoc as Object) + ExecuteSlot ("5710", oDoc) +End Sub + +Sub PasteText (oDoc as Object) + ExecuteSlot ("5712", oDoc) +End Sub + +Sub DelAllUserFields (aDoc as Object) + Dim aFieldType as Object + Dim aElements as Variant + Dim i% + Dim aFieldMasters, aFieldMaster as Object + Dim sElement$ + aFieldMasters = aDoc.TextFieldMasters + aElements = aFieldMasters.ElementNames + for i = 0 to UBound(aElements) + sElement$ = aElements(i) + if 0 <> instr(sElement$, cUnoUserField ) then + aFieldMaster = aFieldMasters.GetByName(sElement$) + aFieldMaster.Dispose + endif + next +end Sub + +Function GetUserFieldState (sName as String, aDoc as Object) as boolean + Dim sFieldText as String + Dim bState as boolean + sFieldText = ReadUserField (sName, aDoc) + + if LCase(sFieldText) = cYes then + bState = true + else + bState = false + end IF + + GetUserFieldState = bState +end Function + +Sub SetUserFieldState (sName as String, nState as boolean, aDoc as Object) + Dim sFieldText as String + + sFieldText = cNo 'default + + Select case nState + case true + sFieldText = cYes + case false + sFieldText = cNo + end Select + + WriteUserField (sFieldText, sName, aDoc) +end Sub + +Function ReadUserField(sFieldName as String, aDoc as Object) as String + Dim aMasters as Object + aMasters = aDoc.TextFieldMasters + if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then + ReadUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName).Content + else + ReadUserField = "" + end If +End Function + +Sub WriteUserField(sValue as String, sFieldName as String, aDoc as Object, optional aCursor as Object) + Dim aMasters, aUserField, aTxtCursor as Object + aMasters = aDoc.TextFieldMasters + if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then + aUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName) + else + aUserField = aDoc.CreateInstance (cUnoUserField) + aUserField.Name = sFieldName + end if + aUserField.Content = sValue +End Sub + +Sub WriteExtUserField(nIndex as Integer, aCursor as Object, aDoc as Object) + Dim aUserField as Object + aUserField = aDoc.CreateInstance (cUnoExtUserField) + aUserField.UserDataType = nIndex + aCursor.Text.InsertTextContent (aCursor, aUserField, True) + aUserField.Fix = True +End Sub +</script:module> diff --git a/smoketestoo_native/data/scripts/Test_10er.xba b/smoketestoo_native/data/scripts/Test_10er.xba new file mode 100755 index 000000000000..b475dfe53b42 --- /dev/null +++ b/smoketestoo_native/data/scripts/Test_10er.xba @@ -0,0 +1,907 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_10er" script:language="StarBasic">REM 10er Test + +const sSWLogFileName = "swlog.dat", sSCLogFileName = "sclog.dat" +const sSDLogFileName = "sdlog.dat", sSMathLogFileName = "smalog.dat" +const sSImDLogFileName = "simlog.dat", sSChartLogFileName = "schlog.dat" +const sSHptLogFileName = "shptlog.dat", sSMessageLogFileName = "smeslog.dat" +const sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "javalog.dat" +const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat" +const sLogFileName = "log.dat" +const cTempFileName = "ttt" + +const cMessageSaveOpen8Doc = "Save/Open open Documents (8.0)" +const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)" +const cMessageSaveOpen50Doc = "Save/Open Document 5.0" +const cMessageNewDoc = "New Document" +const cMessageCloseDoc = "Close Document" +const cMessageCutObj = "Cut Object" +const cMessagePasteObj = "Paste Object" + +Global sWorkPath$ +Global sWorkPathURL$ +Global FileChannel% +Global MainFileChannel% + +Sub Main + call TestAllDocs() +end Sub + +Sub DeleteAllSavedFiles() + Dim sFileName as String + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmHyperText) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter or cFltXML) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc or cFltXML) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress or cFltXML) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw or cFltXML) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter or cFlt50) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc or cFlt50) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress or cFlt50) + If FileExists (sFileName) then + Kill (sFileName) + End If + sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw or cFlt50) + If FileExists (sFileName) then + Kill (sFileName) + End If +End Sub + +Sub DeleteAllLogFiles() + If FileExists (sWorkPath+sLogFileName) then + Kill (sWorkPath+sLogFileName) + End If + If FileExists (sWorkPath+sSWLogFileName) then + Kill (sWorkPath+sSWLogFileName) + End If + If FileExists (sWorkPath+sSCLogFileName) then + Kill (sWorkPath+sSCLogFileName) + End If + If FileExists (sWorkPath+sSDLogFileName) then + Kill (sWorkPath+sSDLogFileName) + End If + If FileExists (sWorkPath+sSMathLogFileName) then + Kill (sWorkPath+sSMathLogFileName) + End If + If FileExists (sWorkPath+sSImDLogFileName) then + Kill (sWorkPath+sSImDLogFileName) + End If + If FileExists (sWorkPath+sSChartLogFileName) then + Kill (sWorkPath+sSChartLogFileName) + End If + If FileExists (sWorkPath+sSHptLogFileName) then + Kill (sWorkPath+sSHptLogFileName) + End If + If FileExists (sWorkPath+sSMessageLogFileName) then + Kill (sWorkPath+sSMessageLogFileName) + End If + If FileExists (sWorkPath+sSDrawLogFileName) then + Kill (sWorkPath+sSDrawLogFileName) + End If + If FileExists (sWorkPath+sJavaLogFileName) then + Kill (sWorkPath+sJavaLogFileName) + End If + If FileExists (sWorkPath+sSDBLogFileName) then + Kill (sWorkPath+sSDBLogFileName) + End If + If FileExists (sWorkPath+sExtLogFileName) then + Kill (sWorkPath+sExtLogFileName) + End If +end Sub + +Function OpenLogDat (sFileName as String) as Integer + Dim LocaleFileChannel% + If FileExists (sWorkPath+sFileName) then + Kill (sWorkPath+sFileName) + End If + LocaleFileChannel% = Freefile + Open sWorkPath+sFileName For Output As LocaleFileChannel% + OpenLogDat = LocaleFileChannel% +end Function + +Function GetWorkPath as string + sTemp = "$(userpath)/temp/" + GetWorkPath = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) +End Function + +Function GetWorkURL as string + sTemp = "$(userurl)/temp/" + GetWorkURL = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) +End Function + +Function GetSystem (sTmpWorkPath as string) as string + GetSystem = "" + if InStr (sTmpWorkPath, ":") then + GetSystem = "windows" + else + GetSystem = "unix" + End If +end Function + +Function ConvertPathToWin (sTmpWorkPath as string) as string + for i%=1 to Len(sTmpWorkPath) + sTemp = Mid (sTmpWorkPath, i%, 1) + if sTemp = "/" then + sTmpWorkPath = Left (sTmpWorkPath, i%-1) + "\" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%) + else + if sTemp = "|" then + sTmpWorkPath = Left (sTmpWorkPath, i%-1) + ":" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%) + end If + end If + next i% + ConvertPathToWin = sTmpWorkPath +end Function + +Sub TestAllDocs() +DIM sDocURL as String, sDocPath as String +DIM nStrPos as Long + + sWorkPath = GetWorkPath + sWorkPathURL = GetWorkURL + + if GetSystem (sWorkPath) = "windows" then + sWorkPath = ConvertPathToWin (sWorkPath) + end if + + 'search ExtensionURL + sExtensionURL = sWorkPathURL + If not FileExists (sExtensionURL + cExtensionFileName) then + if bShowTable then + sDocURL = gOutPutDoc.URL + CompatibilityMode(true) + nStrPos = InStrRev (sDocURL, "/" ) + CompatibilityMode(false) + if nStrPos then + sDocURL = Left (sDocURL, nStrPos) + sExtensionURL = sDocURL + If not FileExists (sExtensionURL + cExtensionFileName) then + bMakeExtensionTest = false ' test is not possible then + end if + else + bMakeExtensionTest = false ' test is not possible then + end if + + else + bMakeExtensionTest = false ' test is not possible then + end if + + end if + + call DeleteAllSavedFiles() + call DeleteAllLogFiles() + MainFileChannel = OpenLogDat (sLogFileName) + call WriteTestSequence (MainFileChannel) + if bMakeWriterTest then + call MakeDocTest (frmWriter) + end if + if bMakeCalcTest then + call MakeDocTest (frmCalc) + end if + if bMakeImpressTest then + call MakeDocTest (frmImpress) + end if + if bMakeDrawTest then + call MakeDocTest (frmDraw) + end if + if bMakeHTMLTest then + call MakeDocTest (frmHyperText) + end if + if bMakeChartTest then + call MakeChartTest (frmChart) + end if + if bMakeMathTest then + call MakeNewDoc (frmMath) + end if + if bMakeJavaTest then + call TestJava (frmJava) + end if + if bMakeDBTest then + call Test_DB.TestDB (frmDataBase) + end if + if bMakeExtensionTest then + call Test_Ext.TestExtensions (frmExtension) + end if + + Close #MainFileChannel +end Sub + +Sub WriteTestSequence (FileChannel as integer) + Print #FileChannel, "Sequence of testing" + + if bMakeWriterTest then + WriteTests ("writer : ", true, FileChannel) + end if + if bMakeCalcTest then + WriteTests ("calc : ", true, FileChannel) + end if + if bMakeImpressTest then + WriteTests ("impress : ", true, FileChannel) + end if + if bMakeDrawTest then + WriteTests ("draw : ", true, FileChannel) + end if + if bMakeHTMLTest then + WriteTests ("HTML : ", true, FileChannel) + end if + if bMakeChartTest then + WriteTests ("chart : ", false, FileChannel) + end if + if bMakeMathTest then + WriteTests ("math : ", false, FileChannel) + end if + if bMakeJavaTest then + WriteTests ("Java : ", false, FileChannel) + end if + if bMakeDBTest then + WriteDBTests ("Database : ", FileChannel) + end if + if bMakeExtensionTest then + WriteExtensionTests ("Extension : ", FileChannel) + end if + + Print #FileChannel +end Sub + +Sub WriteTests (sText as string, bTestAll as boolean, nFileChannel as integer) + Dim sWriteStr as string + + sWriteStr = sText + sWriteStr = sWriteStr + "new" + if bTestAll then + if bMakeCutTest then + sWriteStr = sWriteStr + ", cut" + end if + if bMakePasteTest then + sWriteStr = sWriteStr + ", paste" + end if + if bMakeSaveOpen8Test then + sWriteStr = sWriteStr + ", save 8.0" + end if + if bMakeSaveOpenXMLTest then + sWriteStr = sWriteStr + ", save XML" + end if + if bMakeSaveOpen50Test then + sWriteStr = sWriteStr + ", save 5.0" + end if + if bMakeSaveOpen8Test then + sWriteStr = sWriteStr + ", open 8.0" + end if + if bMakeSaveOpenXMLTest then + sWriteStr = sWriteStr + ", open XML" + end if + if bMakeSaveOpen50Test then + sWriteStr = sWriteStr + ", open 5.0" + end if + end if + + sWriteStr = sWriteStr + ", close" + + Print #nFileChannel, sWriteStr +end Sub + +Sub WriteDBTests (sText as string, nFileChannel as integer) + Dim sWriteStr as string + + sWriteStr = sText + sWriteStr = sWriteStr + "open / services" + sWriteStr = sWriteStr + ", insert" + sWriteStr = sWriteStr + ", delete" + sWriteStr = sWriteStr + ", seek" + sWriteStr = sWriteStr + ", close" + + Print #nFileChannel, sWriteStr +end Sub + +Sub WriteExtensionTests (sText as string, nFileChannel as integer) + Dim sWriteStr as string + + sWriteStr = sText + sWriteStr = sWriteStr + "services" + sWriteStr = sWriteStr + ", install" + sWriteStr = sWriteStr + ", uninstall" + + Print #nFileChannel, sWriteStr +end Sub + +Sub MakeDocTest (FilterType as Integer) + Dim oDoc as Object + Dim sFileNameXML$, sFileName50$, sFileName8$ + Dim bError as Boolean + Dim nCurrentAction as Integer + + On Local Error GoTo DOCTESTERROR + nCurrentAction = cLogfileFailed + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + nCurrentAction = cDocNew + oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc)) + LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) + LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) + SetStatus (FilterType, cDocNew, not IsNull (oDoc)) + if not IsNull (oDoc) then + nCurrentAction = cDocCut + call CutAndPaste(FilterType, oDoc) +' bError = oDoc.CurrentController.frame.close + nCurrentAction = cDocSaveOpen8 + if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then + sFileName8 = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFlt8) + SaveDoc (sFileName8, oDoc, GetDocFilter(FilterType or cFlt8)) + end if + nCurrentAction = cDocSaveOpenXML + if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then + sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFltXML) + SaveDoc (sFileNameXML, oDoc, GetDocFilter(FilterType or cFltXML)) + end if + nCurrentAction = cDocSaveOpen50 + if bMakeSaveOpen50Test and IsFilterAvailable (FilterType or cFlt50) then + sFileName50 = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFlt50) + SaveDoc (sFileName50, oDoc, GetDocFilter(FilterType or cFlt50)) + end if +' oDoc.dispose + nCurrentAction = cDocClose + oDoc.close (true) +' bError = true ' nur zum ÂĶbergang, weil bError = oDoc.CurrentController.frame.close nicht geht +' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) +' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) +' SetStatus (FilterType, cDocClose, bError) + nCurrentAction = cDocSaveOpen8 + if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then + oDoc = LoadDoc (sFileName8) + +' oDoc = Documents.open(sFileName) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, FileChannel) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, MainFileChannel) + SetStatus (FilterType, cDocSaveOpen8, not IsNull (oDoc)) + + if not IsNull (oDoc) then +' oDoc.dispose + nCurrentAction = cDocClose + oDoc.close (true) + end If + end if + + nCurrentAction = cDocSaveOpenXML + if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then + oDoc = LoadDoc (sFileNameXML) + +' oDoc = Documents.open(sFileName) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, FileChannel) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, MainFileChannel) + SetStatus (FilterType, cDocSaveOpenXML, not IsNull (oDoc)) + + if not IsNull (oDoc) then +' oDoc.dispose + nCurrentAction = cDocClose + oDoc.close (true) + end If + end if + + nCurrentAction = cDocSaveOpen50 + if bMakeSaveOpen50Test and IsFilterAvailable (FilterType or cFlt50) then + oDoc = LoadDoc (sFileName50) + +' oDoc = Documents.open(sFileName) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen50Doc, FileChannel) + LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen50Doc, MainFileChannel) + SetStatus (FilterType, cDocSaveOpen50, not IsNull (oDoc)) + + if not IsNull (oDoc) then +' oDoc.dispose + nCurrentAction = cDocClose + oDoc.close (true) + end If + end if + end If + Print #FileChannel, "---" + Close #FileChannel% + Exit Sub ' Without error + + DOCTESTERROR: + If (nCurrentAction = cLogfileFailed) then + SetStatus (FilterType, cDocNew, False) + Exit Sub + else + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) + SetStatus (FilterType, nCurrentAction, False) + Close #FileChannel% + End If + Exit Sub ' With error +End Sub + +Sub MakeNewDoc (FilterType as Integer) + DIM oDoc as Object + Dim bError as Boolean + Dim nCurrentAction as Integer + On Local Error GoTo DOCTESTERROR2 + nCurrentAction = cLogfileFailed + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + nCurrentAction = cDocNew +' oDoc = Documents.Add(GetDocFilter(FilterType)) + oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc)) + LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) + LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) + SetStatus (FilterType, cDocNew, not IsNull (oDoc)) + if not IsNull (oDoc) then + nCurrentAction = cDocClose +' oDoc.dispose + oDoc.close (true) +' bError = true ' nur zum ÂĶbergang, weil bError = oDoc.CurrentController.frame.close nicht geht +' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) +' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) +' SetStatus (FilterType, cDocClose, bError) + end If + Print #FileChannel, "---" + Close #FileChannel% + Exit Sub ' Without error + + DOCTESTERROR2: + If (nCurrentAction = cLogfileFailed) then + SetStatus (FilterType, cDocNew, False) + Exit Sub + else + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) + SetStatus (FilterType, nCurrentAction, False) + Close #FileChannel% + End If + Exit Sub ' With error +End Sub + +Sub MakeChartTest (FilterType as Integer) + Dim oCharts as Object + Dim oDoc as Object + Dim oRange(0) as New com.sun.star.table.CellRangeAddress + Dim oRect as New com.sun.star.awt.Rectangle + const cChartName="TestChart" + Dim bError as Boolean + Dim nCurrentAction as Integer + On Local Error GoTo CHARTTESTERROR + nCurrentAction = cLogfileFailed + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + nCurrentAction = cDocNew + oDoc = LoadDoc ("private:factory/" + GetDocFilter(frmCalc or cFltNewDoc)) + if not IsNull (oDoc) then + oCharts = oDoc.sheets(0).Charts + oCharts.AddNewByName (cChartName, oRect, oRange(), true, true) + bError=oCharts.HasByName(cChartName) + LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) + LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) + SetStatus (FilterType, cDocNew, bError) +' oDoc.dispose + nCurrentAction = cDocClose + oDoc.close (true) + else + LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) + LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) + SetStatus (frmCalc, cDocNew, not IsNull (oDoc)) + End if + Print #FileChannel, "---" + Close #FileChannel% + Exit Sub ' Without error + + CHARTTESTERROR: + If (nCurrentAction = cLogfileFailed) then + SetStatus (FilterType, cDocNew, False) + Exit Sub + else + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) + LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) + SetStatus (FilterType, nCurrentAction, False) + Close #FileChannel% + End If + Exit Sub ' With error +End Sub + +Sub LogState (bState as Boolean, sText as String, nLocaleFileChannel as integer) + if bState then + Print #nLocaleFileChannel, sText+" -> ok" + else + Print #nLocaleFileChannel, sText+" -> error" + end If +end Sub + +Function GetDocEndings (DocType as Integer) as String + Select Case ( DocType ) + case frmWriter or cFlt8 + GetDocEndings = "odt" ' Textdokument + case frmCalc or cFlt8 + GetDocEndings = "ods" 'Tabellendokument + case frmImpress or cFlt8 + GetDocEndings = "odp" 'PrÃsentation + case frmDraw or cFlt8 + GetDocEndings = "odg" 'Zeichen + case frmHyperText, frmHyperText or cFlt50, frmHyperText or cFltXML + GetDocEndings = "html" 'Hypertext-Dokument + case frmWriter or cFlt50 + GetDocEndings = "sdw" ' Textdokument 5.0 + case frmCalc or cFlt50 + GetDocEndings = "sdc" 'Tabellendokument 5.0 + case frmImpress or cFlt50 + GetDocEndings = "sdd" 'PrÃsentation 5.0 + case frmDraw or cFlt50 + GetDocEndings = "sda" 'Zeichen 5.0 + case frmWriter or cFltXML + GetDocEndings = "sxw" ' Textdokument + case frmCalc or cFltXML + GetDocEndings = "sxc" 'Tabellendokument + case frmImpress or cFltXML + GetDocEndings = "sxi" 'PrÃsentation + case frmDraw or cFltXML + GetDocEndings = "sxd" 'Zeichen + case else + GetDocEndings = "" + end Select +end Function + +Function GetDocFilter (DocType as Integer) as String + Select Case ( DocType ) + case frmWriter or cFlt8 + GetDocFilter = "writer8" ' Textdokument + case frmCalc or cFlt8 + GetDocFilter = "calc8" 'Tabellendokument + case frmImpress or cFlt8 + GetDocFilter = "impress8" 'PrÃĪsentation + case frmDraw or cFlt8 + GetDocFilter = "draw8" 'Zeichen + case frmMath or cFlt8 + GetDocFilter = "math8" 'Formel + + case frmWriter or cFltXML + GetDocFilter = "StarOffice XML (Writer)" ' Textdokument + case frmCalc or cFltXML + GetDocFilter = "StarOffice XML (Calc)" 'Tabellendokument + case frmImpress or cFltXML + GetDocFilter = "StarOffice XML (Impress)" 'PrÃĪsentation + case frmDraw or cFltXML + GetDocFilter = "StarOffice XML (Draw)" 'Zeichen + case frmMath or cFltXML + GetDocFilter = "StarOffice XML (Math)" 'Formel + + case frmHyperText, frmHyperText or cFlt50, frmHyperText or cFltXML + GetDocFilter = "HTML" 'Hypertext-Dokument + case frmWriter or cFlt50 + GetDocFilter = "StarWriter 5.0" ' Textdokument 5.0 + case frmCalc or cFlt50 + GetDocFilter = "StarCalc 5.0" 'Tabellendokument 5.0 + case frmImpress or cFlt50 + GetDocFilter = "StarImpress 5.0" 'PrÃĪsentation 5.0 + case frmDraw or cFlt50 + GetDocFilter = "StarDraw 5.0" 'Zeichen 5.0 + case frmMath or cFlt50 + GetDocFilter = "StarMath 5.0" 'Formel 5.0 + + case frmWriter or cFltNewDoc + GetDocFilter = "swriter" ' Textdokument + case frmCalc or cFltNewDoc + GetDocFilter = "scalc" 'Tabellendokument + case frmMessage or cFltNewDoc + GetDocFilter = "Message" 'Nachricht + case frmImpress or cFltNewDoc + GetDocFilter = "simpress" 'PrÃĪsentation + case frmDraw or cFltNewDoc + GetDocFilter = "sdraw" 'Zeichen + case frmMath or cFltNewDoc + GetDocFilter = "smath" 'Formel + case frmImage or cFltNewDoc + GetDocFilter = "simage" 'Bild + case frmHyperText or cFltNewDoc + GetDocFilter = "swriter/web" 'Hypertext-Dokument + case frmChart or cFltNewDoc + GetDocFilter = "schart" 'Diagramm + case else + GetDocFilter = "" + end Select +end Function + +Function GetLogFileName (DocType as Integer) as String + Select Case ( DocType ) + case frmWriter + GetLogFileName = sSWLogFileName ' Textdokument + case frmCalc + GetLogFileName = sSCLogFileName 'Tabellendokument + case frmMessage + GetLogFileName = sSMessageLogFileName 'Nachricht + case frmImpress + GetLogFileName = sSDLogFileName 'PrÃsentation + case frmDraw + GetLogFileName = sSDrawLogFileName 'Zeichnen + case frmMath + GetLogFileName = sSMathLogFileName 'Formel + case frmImage + GetLogFileName = sSImDLogFileName 'Bild + case frmHyperText + GetLogFileName = sSHptLogFileName 'Hypertext-Dokument + case frmChart + GetLogFileName = sSChartLogFileName 'Diagramm + case frmJava + GetLogFileName = sJavaLogFileName 'Java + case frmDataBase + GetLogFileName = sSDBLogFileName 'Database + case frmExtension + GetLogFileName = sExtLogFileName 'Extension + case else + GetLogFileName = "" + end Select +end Function + +Function GetErrorMessageOnAction (nAction as Integer) as String + Select Case ( nAction ) + case cDocNew + GetErrorMessageOnAction = cMessageNewDoc + case cDocCut + GetErrorMessageOnAction = cMessageCutObj + case cDocPaste + GetErrorMessageOnAction = cMessagePasteObj + case cDocSaveOpen8 + GetErrorMessageOnAction = cMessageSaveOpen8Doc + case cDocSaveOpenXML + GetErrorMessageOnAction = cMessageSaveOpenXMLDoc + case cDocSaveOpen50 + GetErrorMessageOnAction = cMessageSaveOpen50Doc + case cDocClose + GetErrorMessageOnAction = cMessageCloseDoc + case else + GetErrorMessageOnAction = "" + end Select +end Function + +Function IsFilterAvailable (FilterType as Integer) as boolean + IsFilterAvailable = true + if ((FilterType = (frmHyperText or cFlt50)) or (FilterType = (frmHyperText or cFltXML))) then + IsFilterAvailable = false + end if +End Function + +Function TestJava (FilterType as Integer) as boolean + Dim oObj as Object + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + oObj = createUnoService(cUnoJavaLoader) + LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, FileChannel) + LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, MainFileChannel) + SetStatus (FilterType, cDocNew, not IsNull (oObj)) + + Print #FileChannel, "---" + Close #FileChannel% + + TestJava = not IsNull (oObj) +End Function + +Sub CutAndPaste (DocType as Integer, oDoc as Object) + Dim sText as String + Dim oWin as Object + Dim oText as Object + Dim oView as Object + Dim bCutState as boolean, bPasteState as boolean + Select Case ( DocType ) + case frmWriter + Dim oCursor as Object + + sText = "AutomaticText" + oText = oDoc.GetText + oCursor = oText.CreateTextCursor + oText.InsertString(oCursor, sText, true) ' Cursor selektiert den Text + oView = oDoc.getCurrentController + oView.Select(oCursor) + + if bMakeCutTest then + call CutText (oDoc) + + if oText.GetString = "" Then + bCutState = True + else + bCutState = False + end If + SetStatus (DocType, cDocCut, bCutState) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) + end if + + if bMakePasteTest and bMakeCutTest then + call PasteText (oDoc) + + if oText.GetString = sText Then + bPasteState = True + else + bPasteState = False + end If + SetStatus (DocType, cDocPaste, bPasteState) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) + end if + + case frmCalc + DIM oCell as Object + + sText = "AutomaticText" + oCell = oDoc.Sheets(0).GetCellByPosition(0, 0) + oCell.String = sText + oView = oDoc.getCurrentController + oView.Select(oCell) + + if bMakeCutTest then + call CutText (oDoc) + + if oCell.String = "" Then + bCutState = True + else + bCutState = False + end If + SetStatus (DocType, cDocCut, bCutState) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) + end if + + if bMakePasteTest and bMakeCutTest then + call PasteText (oDoc) + + if oCell.String = sText Then + bPasteState = True + else + bPasteState = False + end If + SetStatus (DocType, cDocPaste, bPasteState) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) + end if + case frmMessage + case frmImpress, frmDraw + Dim oPage as Object + Dim oRect as Object + Dim xSize as Object + Dim xPoint as Object + Dim bObjState as Boolean + + xSize = CreateUnoStruct ("com.sun.star.awt.Size") + xPoint = CreateUnoStruct ("com.sun.star.awt.Point") + xSize.Width = 2000 + xSize.Height = 2000 + xPoint.x = 10000 + xPoint.y = 10000 + oPage = oDoc.DrawPages(0) + oRect = oDoc.CreateInstance("com.sun.star.drawing.RectangleShape") + oRect.Size = xSize + oRect.Position = xPoint + oPage.add(oRect) + + oView = oDoc.getCurrentController + oView.Select(oRect) + + ' PrÞft ob Þberhaupt ein Object angelegt wurde + if oPage.count = 1 Then + bObjState = True + else + bObjState = False + end If + + if bMakeCutTest then + call CutText (oDoc) + + if (oPage.count = 0) and bObjState Then + bCutState = True + else + bCutState = False + end If + SetStatus (DocType, cDocCut, bCutState) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) + LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) + end if + + wait (1000) 'wait after cut + + if bMakePasteTest and bMakeCutTest then + call PasteText (oDoc) + + if (oPage.count = 1) and bObjState Then + bPasteState = True + else + bPasteState = False + end If + SetStatus (DocType, cDocPaste, bPasteState) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) + LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) + end if + case frmMath + case frmImage + case frmHyperText + case frmChart + end Select +end Sub + +Sub LoadLibrary( LibName as String ) + + dim args(1) + dim arg as new com.sun.star.beans.PropertyValue + arg.Name = "LibraryName" + arg.Value = LibName + args(0) = arg + + dim url as new com.sun.star.util.URL + dim trans as object + trans = createUnoService("com.sun.star.util.URLTransformer" ) + url.Complete = "slot:6517" + trans.parsestrict( url ) + + dim disp as object + disp = StarDesktop.currentFrame.queryDispatch( url, "", 0 ) + disp.dispatch( url, args() ) + +End Sub + +Sub LoadDoc (DocName as String) as Object + dim trans as object + trans = createUnoService("com.sun.star.util.URLTransformer" ) + url = createUnoStruct("com.sun.star.util.URL" ) + url.Complete = DocName + if Left(DocName, 5 ) <> "file:" then + trans.parsestrict( url ) + endif + + Dim aPropArray(0) as Object + aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue") + aPropArray(0).Name = "OpenFlags" + aPropArray(0).Value = "S" + + dim doc as object + dim noargs() + doc = StarDesktop.loadComponentFromURL( url.Complete, "_blank", 0, aPropArray() ) ' XModel + LoadDoc = doc +End Sub + +Sub SaveDoc (DocName as String, oDoc as Object, sFilterName as string ) + dim trans as object + trans = createUnoService("com.sun.star.util.URLTransformer" ) + url = createUnoStruct("com.sun.star.util.URL" ) + url.Complete = DocName + if Left(DocName, 5 ) <> "file:" then + trans.parsestrict( url ) + endif + + if not (sFilterName = "") then + Dim aPropArray(0) as Object + aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue") + aPropArray(0).Name = "FilterName" + aPropArray(0).Value = sFilterName + + oDoc.storeAsURL( url.Complete, aPropArray() ) + else + MessageBox "Filtername is unknown!" + end if +end Sub +</script:module>
\ No newline at end of file diff --git a/smoketestoo_native/data/scripts/Test_DB.xba b/smoketestoo_native/data/scripts/Test_DB.xba new file mode 100755 index 000000000000..7e5a74bfe2ab --- /dev/null +++ b/smoketestoo_native/data/scripts/Test_DB.xba @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_DB" script:language="StarBasic">REM ***** Database Test ***** + +const cMessageDatabaseService = "Database Service" +const cMessageDatabaseOpen = "Open Database" +const cMessageDatabaseInsert = "Insert record into Database" +const cMessageDatabaseDelete = "Delete record from Database" +const cMessageDatabaseSeek = "Read other record from Database" +const cMessageDatabaseClose = "Close Database" + +Sub TestDB (FilterType as Integer) + +Dim oDBConnection as Object, oDataSource as Object, oDBContext as Object +Dim sDBName as String, sTable as String, sCurrentMessage as String +Dim nRowCount as Integer, nCurrentAction as Integer +Dim bResult as Boolean +Const sTestString = "Automatical Test" + + + On Local Error GoTo DBERROR + + nCurrentAction = cLogfileFailed + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + + nCurrentAction = cDBService + sCurrentMessage = cMessageDatabaseService + " " + cUnoDatabaseContext + + oDBContext = CreateUnoService(cUnoDatabaseContext) + sDBName=oDBContext.ElementNames(0) 'Names of Databases + + nCurrentAction = cDBOpen + sCurrentMessage = cMessageDatabaseOpen + + oDataSource = oDBContext.GetByName(sDBName) + sTable=oDataSource.Tables.ElementNames(0) + oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") + + LogState (not IsNull (oDBConnection), "Database "+ cMessageDatabaseOpen, FileChannel) + LogState (not IsNull (oDBConnection), "Database "+ cMessageDatabaseOpen, MainFileChannel) + SetStatus (FilterType, cDBOpen, not IsNull (oDBConnection)) + if (IsNull(oDBConnection)) then + Close #FileChannel% + Exit Sub + End If + + ' Database is open now + + nCurrentAction = cDBService + sCurrentMessage = cMessageDatabaseService + " " + cUnoRowSet + oRowSet = createUnoService(cUnoRowSet) + + if (IsNull(oRowSet)) then + LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService + " " + cUnoRowSet, FileChannel) + LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService + " " + cUnoRowSet, MainFileChannel) + SetStatus (FilterType, cDBService, not IsNull (oRowSet)) + Exit Sub + else + LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService, FileChannel) + LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService, MainFileChannel) + SetStatus (FilterType, cDBService, not IsNull (oRowSet)) + End If + + nCurrentAction = cDBInsert + sCurrentMessage = cMessageDatabaseInsert + + oRowSet.ActiveConnection = oDBConnection + + oRowSet.CommandType = com.sun.star.sdb.CommandType.COMMAND + oRowSet.Command = "SELECT * FROM " + sTable + oRowSet.execute() + + oRowSet.moveToInsertRow + oRowSet.updateString(5, sTestString) + + oRowSet.insertRow() + nRowCount=oRowSet.RowCount + + oRowSet.moveToCurrentRow() + + bResult = (oRowSet.getString(5) = sTestString) + LogState (bResult, "Database "+ cMessageDatabaseInsert, FileChannel) + LogState (bResult, "Database "+ cMessageDatabaseInsert, MainFileChannel) + SetStatus (FilterType, cDBInsert, bResult) + + 'delete only if insert passed + + if (bResult) Then + nCurrentAction = cDBDelete + sCurrentMessage = cMessageDatabaseDelete + oRowSet.deleteRow() + bResult = (nRowCount - oRowSet.RowCount = 0) + if ( bResult ) Then + oRowSet.next() + bResult = (nRowCount - oRowSet.RowCount = 1) + End If + LogState (bResult, "Database "+ cMessageDatabaseDelete, FileChannel) + LogState (bResult, "Database "+ cMessageDatabaseDelete, MainFileChannel) + SetStatus (FilterType, cDBDelete, bResult) + End If + + ' read other record + + nCurrentAction = cDBSeek + sCurrentMessage = cMessageDatabaseSeek + oRowSet.first() + bResult = not (oRowSet.getString(5) = sTestString) + LogState (bResult, "Database "+ cMessageDatabaseSeek, FileChannel) + LogState (bResult, "Database "+ cMessageDatabaseSeek, MainFileChannel) + SetStatus (FilterType, cDBSeek, bResult) + + nCurrentAction = cDBClose + sCurrentMessage = cMessageDatabaseClose + oDBConnection.Dispose() + LogState (True, "Database "+ cMessageDatabaseClose, FileChannel) + LogState (True, "Database "+ cMessageDatabaseClose, MainFileChannel) + SetStatus (FilterType, cDBClose, True) + + Print #FileChannel, "---" + Close #FileChannel% + Exit Sub ' Without error + + DBERROR: + If (nCurrentAction = cLogfileFailed) then + SetStatus (FilterType, cDBOpen, False) + Exit Sub + else + LogState (False, "Database "+ sCurrentMessage, FileChannel) + LogState (False, "Database "+ sCurrentMessage, MainFileChannel) + SetStatus (FilterType, nCurrentAction, False) + Close #FileChannel% + End If + Exit Sub ' With error +End Sub +</script:module>
\ No newline at end of file diff --git a/smoketestoo_native/data/scripts/Test_Ext.xba b/smoketestoo_native/data/scripts/Test_Ext.xba new file mode 100755 index 000000000000..00fc93ff86eb --- /dev/null +++ b/smoketestoo_native/data/scripts/Test_Ext.xba @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_Ext" script:language="StarBasic">REM ***** BASIC ***** + +const cMessageExtensionService = "Extension Service" +const cMessageExtensionInstall = "Install Extension" +const cMessageExtensionUninstall = "Uninstall Extension" + +Sub TestExtensions (FilterType as Integer) +Dim oTestExtension as Object, obj_null as Object +Dim sCurrentMessage as String +Dim nCurrentAction as Integer +Dim bResult as Boolean +Dim sImplementationNameString as String +sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" + + On Local Error GoTo EXTERROR + + nCurrentAction = cLogfileFailed + FileChannel% = OpenLogDat (GetLogFileName(FilterType)) + + sCurrentMessage = cMessageExtensionService + nCurrentAction = cEXTService + + 'Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for + 'adding the extension. The implementation is in + 'javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java and the code is in juh.jar + cmdEnv = createUnoService(cUnoSmoketestCommandEnvironment) + + 'Create the component context and then get the singleton thePackageManagerFactory + 'A singleton cannot be created with createUnoService + ctx = getDefaultContext + factory = ctx.getValueByName("/singletons/" + cUnothePackageManagerFactory) + + 'Get the XPackageManager interface. By passing "user" we determine that the actions we perform on + 'XPackageManager only affect the user installation. To modify the share installation one would pass "share". + ext_mgr = factory.getPackageManager("user") + + LogState (not IsNull (ext_mgr), "Extension "+ cMessageExtensionService, FileChannel) + LogState (not IsNull (ext_mgr), "Extension "+ cMessageExtensionService, MainFileChannel) + SetStatus (FilterType, cEXTService, not IsNull (ext_mgr)) + if (IsNull(ext_mgr)) then + Close #FileChannel% + Exit Sub + End If + + sCurrentMessage = cMessageExtensionInstall + nCurrentAction = cEXTInstall + + 'Add the extension. We must provide a file URL here. + ext_mgr.addPackage(sExtensionURL + cExtensionFileName, "", obj_null, cmdEnv) + + 'Check if the extension has been added by creating a service which is contained in the extension. + oTestExtension = createUnoService(cUnoSmoketestTestExtension) + bResult = (oTestExtension.getImplementationName = sImplementationNameString) + LogState (bResult, "Extension "+ cMessageExtensionInstall, FileChannel) + LogState (bResult, "Extension "+ cMessageExtensionInstall, MainFileChannel) + SetStatus (FilterType, cEXTInstall, bResult) + if (not bResult) then + Close #FileChannel% + Exit Sub + End If + + sCurrentMessage = cMessageExtensionUninstall + nCurrentAction = cEXTUninstall + + 'Remove the package + ext_mgr.removePackage("org.openoffice.legacy." + cExtensionFileName, cExtensionFileName, obj_null, cmdEnv) + + 'Try to create the service which is contained in the now removed extension. + oTestExtension = createUnoService(cUnoSmoketestTestExtension) + + 'The service must not be available anymore. Therefor isNull must return true. + LogState (IsNull (oTestExtension), "Extension "+ cMessageExtensionUninstall, FileChannel) + LogState (IsNull (oTestExtension), "Extension "+ cMessageExtensionUninstall, MainFileChannel) + SetStatus (FilterType, cEXTUninstall, IsNull (oTestExtension)) + + Print #FileChannel, "---" + Close #FileChannel% + Exit Sub ' Without error + + EXTERROR: + If (nCurrentAction = cLogfileFailed) then + SetStatus (FilterType, cEXTService, False) + Exit Sub + else + LogState (False, "Extension "+ sCurrentMessage, FileChannel) + LogState (False, "Extension "+ sCurrentMessage, MainFileChannel) + SetStatus (FilterType, nCurrentAction, False) + Close #FileChannel% + End If + Exit Sub ' With error + +End Sub +</script:module>
\ No newline at end of file diff --git a/smoketestoo_native/data/scripts/script.xlb b/smoketestoo_native/data/scripts/script.xlb new file mode 100755 index 000000000000..6b7873432f75 --- /dev/null +++ b/smoketestoo_native/data/scripts/script.xlb @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="Global"/> + <library:element library:name="Test_10er"/> + <library:element library:name="Test_DB"/> + <library:element library:name="Test_Ext"/> +</library:library>
\ No newline at end of file diff --git a/smoketestoo_native/data/smoketestdoc.sxw b/smoketestoo_native/data/smoketestdoc.sxw Binary files differnew file mode 100755 index 000000000000..b9139efda28d --- /dev/null +++ b/smoketestoo_native/data/smoketestdoc.sxw diff --git a/smoketestoo_native/data/solaris/sparc/admin b/smoketestoo_native/data/solaris/sparc/admin new file mode 100644 index 000000000000..6639c2406d06 --- /dev/null +++ b/smoketestoo_native/data/solaris/sparc/admin @@ -0,0 +1,6 @@ +action=nocheck +conflict=nocheck +setuid=nocheck +idepend=nocheck +mail= + diff --git a/smoketestoo_native/data/solaris/sparc/getuid.so b/smoketestoo_native/data/solaris/sparc/getuid.so Binary files differnew file mode 100755 index 000000000000..13c193879c4b --- /dev/null +++ b/smoketestoo_native/data/solaris/sparc/getuid.so diff --git a/smoketestoo_native/data/solaris/x86/admin b/smoketestoo_native/data/solaris/x86/admin new file mode 100644 index 000000000000..6639c2406d06 --- /dev/null +++ b/smoketestoo_native/data/solaris/x86/admin @@ -0,0 +1,6 @@ +action=nocheck +conflict=nocheck +setuid=nocheck +idepend=nocheck +mail= + diff --git a/smoketestoo_native/data/solaris/x86/getuid.so b/smoketestoo_native/data/solaris/x86/getuid.so Binary files differnew file mode 100755 index 000000000000..c5cdc8ce7a7b --- /dev/null +++ b/smoketestoo_native/data/solaris/x86/getuid.so diff --git a/smoketestoo_native/makefile.mk b/smoketestoo_native/makefile.mk new file mode 100644 index 000000000000..f21ae594bf33 --- /dev/null +++ b/smoketestoo_native/makefile.mk @@ -0,0 +1,58 @@ +#*********************************************************************** +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.9 $ +# +# 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. +# +#************************************************************************* + +PRJ=. + +PRJNAME=test10 +TARGET=t1 + +.INCLUDE : settings.mk + +STAR_REGISTRY= +.EXPORT : STAR_REGISTRY +.EXPORT : PERL +.EXPORT : DMAKE_WORK_DIR + +.INCLUDE : target.mk + +ALLTAR : make_test + + +make_test: +.IF $(NOREMOVE) + @$(PERL) smoketest.pl -nr $(LAST_MINOR) $(BUILD) +.ELSE + @$(PERL) smoketest.pl $(LAST_MINOR) $(BUILD) +.ENDIF + +noremove: + @$(PERL) smoketest.pl -nr $(LAST_MINOR) $(BUILD) + diff --git a/smoketestoo_native/prj/build.lst b/smoketestoo_native/prj/build.lst new file mode 100644 index 000000000000..5a0b659bd6d1 --- /dev/null +++ b/smoketestoo_native/prj/build.lst @@ -0,0 +1,4 @@ +smtoon smoketestoo_native :: instsetoo_native NULL +smtoon smoketestoo_native usr1 - all smoketestoonative_mkout NULL +smtoon smoketestoo_native\com\sun\star\comp\smoketest nmake - all smoketestoonative_csscs NULL +smtoon smoketestoo_native nmake - all,test10 smoketestoonative_mk smoketestoonative_csscs NULL diff --git a/smoketestoo_native/prj/d.lst b/smoketestoo_native/prj/d.lst new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/smoketestoo_native/prj/d.lst diff --git a/smoketestoo_native/smoketest.pl b/smoketestoo_native/smoketest.pl new file mode 100755 index 000000000000..89cdad54b8b0 --- /dev/null +++ b/smoketestoo_native/smoketest.pl @@ -0,0 +1,1303 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: smoketest.pl,v $ +# +# $Revision: 1.35 $ +# +# 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. +# +#************************************************************************* + +# +# smoketest - do the smoketest +# + +use File::Basename; +use File::Path; +use File::Copy; +use Getopt::Long; + +######################## +# # +# Globale Variablen # +# # +######################### +$is_debug = 0; # run without executing commands +$is_command_infos = 0; # print command details before exec +$is_protocol_test = 0; +$is_remove_on_error = 0; +$is_remove_at_end = 1; +$is_do_deinstall = 0; +$is_admin_installation = 1; +$is_oo = 1; + +$gui = $ENV{GUI}; +$temp_path = $ENV{TEMP}; +$vcsid = $ENV{VCSID}; +$sversion_saved = 0; +$FileURLPrefix = "file:///"; +$userinstalldir = "UserInstallation"; +$cygwin = "cygwin"; +$prefered_lang = "en-US"; +$global_instset_mask = ""; +$smoketest_install = $ENV{SMOKETESTINSTALLSET}; + +if (!defined($gui)) { + print "The workstamp is missing. Please use setsolar\n"; + exit(1); +} + +if (($gui eq "WNT") and ($ENV{USE_SHELL} ne "4nt")) { + $gui = $cygwin; +} + +if (!defined($temp_path) and (($gui eq "UNX") or ($gui eq $cygwin))) { + $temp_path = $ENV{TMPDIR}; + if (!defined($temp_path) and (-d "/tmp")) { + $temp_path = "/tmp"; + } +} + +if (defined($ENV{INSTALLPATH_SMOKETEST})) { + $installpath_without = $ENV{INSTALLPATH_SMOKETEST}; +} +else { + $installpath_without = $temp_path; +} + +if (!defined($installpath_without)) { + print "Your temp value is missing. Please set your temp-variable or define INSTALLPATH_SMOKETEST\n\n"; + exit(1); +} + +if (!((defined($ENV{UPDATER})) and ($ENV{UPDATER} eq "YES") and !defined($ENV{CWS_WORK_STAMP})) ) { + $is_protocol_test = 0; +} + +if ($gui eq "WNT") { + $PathSeparator = '\\'; + $NewPathSeparator = ';'; + $dos = "$ENV{COMSPEC} -c"; + $PERL = "$dos $ENV{PERL}"; + $REMOVE_DIR = "$dos del /qsxyz"; + $REMOVE_FILE = "$dos del"; + $LIST_DIR = "$dos ls"; + $COPY_FILE = "$dos copy"; + $COPY_DIR = "$dos copy /s"; + $MK_DIR = "md"; + $RENAME_FILE = "ren"; + $nul = '> NUL'; + $RESPFILE="response_fat_wnt"; + $SVERSION_INI = $ENV{USERPROFILE} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini"; + $SOFFICEBIN = "soffice.exe"; + $bootstrapini = "bootstrap.ini"; + $bootstrapiniTemp = $bootstrapini . "_"; + $packpackage = "msi"; +} +elsif ($gui eq "UNX") { + $is_do_deinstall = 0; + $PathSeparator = '/'; + $NewPathSeparator = ':'; + $dos = ""; + $PERL = "$ENV{PERL}"; + $REMOVE_DIR = "rm -rf"; + $REMOVE_FILE = "rm -f"; + $LIST_DIR = "ls"; + $COPY_FILE = "cp -f"; + $MK_DIR = "mkdir"; + $RENAME_FILE = "mv"; + $nul = '> /dev/null'; + $RESPFILE="response_fat_unx"; + $SVERSION_INI = $ENV{HOME} . $PathSeparator . ".sversionrc"; + $bootstrapini = "bootstraprc"; + $bootstrapiniTemp = $bootstrapini . "_"; + $packpackage = $ENV{PKGFORMAT}; + $SOFFICEBIN = "soffice"; + if ($ENV{OS} eq "MACOSX") { + $COPY_DIR = "cp -RPfp"; + } + else { + $COPY_DIR = "cp -rf"; + } +} +elsif ($gui eq $cygwin) { + $PathSeparator = '/'; + $NewPathSeparator = ':'; + $dos = ""; + $PERL = "$ENV{PERL}"; + $REMOVE_DIR = "rm -rf"; + $REMOVE_FILE = "rm -f"; + $LIST_DIR = "ls"; + $COPY_FILE = "cp -f"; + $COPY_DIR = "cp -rf"; + $MK_DIR = "mkdir"; + $RENAME_FILE = "mv"; + $nul = '> /dev/null'; + $RESPFILE="response_fat_wnt"; + $SVERSION_INI = $ENV{USERPROFILE} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini"; + $SOFFICEBIN = "soffice"; + $bootstrapini = "bootstrap.ini"; + $bootstrapiniTemp = $bootstrapini . "_"; + $CygwinLineends = $/; + $WinLineends = "\r\n"; + &SetWinLineends(); + $packpackage = "msi"; +} +else { + print_error ("not supported system\n",1); +} + +if ($is_oo) { + @install_list = ( 'instsetoo_native' + ); +} +else { + @install_list = ( 'instset_native' + ); +} + +@error_messages = ( '', + 'lock flag for pkgadd still exist. Installation not possible!', + 'Error during installation!', + 'Error: patching configuration failed!', + 'Error: starting office failed or office crashed!', + 'Error during testing', + 'can not copy extension', + 'Error in setup log', + 'installationsset is not complete', + 'can not copy all basic scripts', + 'can not patch bottstrapini', + 'msiexec failed. Maybe you have got an installed version', + 'deinstallation is incomplete', + 'this packformat is not supported for this environment' +); + +my $show_NoMessage = 0; +my $show_Message = 1; + +my $error_logflag = 1; +my $error_setup = 2; +my $error_patchConfig = 3; +my $error_startOffice = 4; +my $error_testResult = 5; +my $error_copyExtension = 6; +my $error_setup_log = 7; +my $error_installset = 8; +my $error_copyBasic = 9; +my $error_patchBootstrap = 10; +my $error_msiexec = 11; +my $error_deinst = 12; +my $error_packformat = 13; + +my $command_normal = 0; +my $command_withoutErrorcheck = 1; +my $command_withoutOutput = 2; + +if ($is_oo) { + $PRODUCT="OpenOffice"; +} +else { + $PRODUCT="StarOffice"; +} + +if (($ENV{PKGFORMAT} eq "installed") and (!defined ($ENV{FORCE2ARCHIVE}))) { + $packpackage = $ENV{PKGFORMAT}; # take it for all environments +} +elsif (defined ($ENV{FORCE2ARCHIVE})) { + $packpackage = "archive"; # take it for all environments +} +$StandDir = $ENV{SOLARSRC} . $PathSeparator; +$SHIP = defined $ENV{SHIPDRIVE} ? $ENV{SHIPDRIVE} . $PathSeparator : "shipdrive_not_set"; +$PORDUCT = "$SHIP$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator"; +$DATA="$ENV{DMAKE_WORK_DIR}$PathSeparator" . "data$PathSeparator"; +$WORK_STAMP_LC=$ENV{WORK_STAMP}; +$WORK_STAMP_LC =~ tr/A-Z/a-z/; +$ENV{DBGSV_INIT} = $DATA . "dbgsv.ini"; +$ExtensionDir = $ENV{DMAKE_WORK_DIR} . $PathSeparator . $ENV{OUTPATH} . $ENV{PROEXT} . $PathSeparator . "bin" . $PathSeparator; +if (defined($ENV{INSTALLPATH_SMOKETEST})) { + $installpath_without = $ENV{INSTALLPATH_SMOKETEST}; +} +else { + $installpath_without = $temp_path; +} + +if (defined($vcsid)) { + $installpath_without .= $PathSeparator . $vcsid; +} +if (!$is_oo) { + $installpath_without .= $PathSeparator . "StarOffice"; +} +else { + $installpath_without .= $PathSeparator . "OpenOffice"; +} + +$installpath = $installpath_without . $PathSeparator; +$installpath = glob $installpath; + +$ENV{STAR_REGISTRY}=""; +$milestone = ""; + +#### options #### + +$opt_nr = 0; +GetOptions('nr'); + +if ($opt_nr) { + $is_remove_at_end = 0; # do not remove installation +} +if ( $ARGV[0] ) { + $milestone = $ARGV[0]; +} +if ( $ARGV[1] ) { + $buildid = $ARGV[1]; +} + + +#### script id ##### + +( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; + +$id_str = ' $Revision: 1.35 $ '; +$id_str =~ /Revision:\s+(\S+)\s+\$/ + ? ($script_rev = $1) : ($script_rev = "-"); + +print "$script_name -- version: $script_rev\n"; + + +#### main #### + +if (!$is_debug) { + if ($is_do_deinstall) { + deinstallInstallation ($installpath); + } + removeOldInstallation($installpath); + save_sversion ($SVERSION_INI); +} + +($INSTSETNAME, $INSTALLSET) = getInstset(); + +print "Install: $INSTALLSET$INSTSETNAME\n"; +prepare(); +doTest(); + +if (!$is_debug) { + restore_sversion ($SVERSION_INI); + if ($is_remove_at_end) { + if ($is_do_deinstall) { + deinstallInstallation ($installpath); + } + removeInstallation($installpath); + } + else { + print_notRemoved ($installpath); + } +} +print "smoketest successful!\n"; +exit (0); + +######################### +# # +# Procedures # +# # +######################### + +sub getSubFiles { + my ($startDir, $DirArray_ref, $mask) = @_; + my ($dir); + opendir(DIR,"$startDir"); + while($dir = readdir(DIR)) { + if (($dir =~ /\.$/) or ($dir !~ /$mask/)) { + next; + } + push (@{$DirArray_ref}, "$dir"); + } + closedir(DIR); + +} + +sub getSubDirs { + my ($startDir, $DirArray_ref) = @_; + my ($dir); + opendir(DIR,"$startDir"); + while($dir = readdir(DIR)) { + if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { + push (@{$DirArray_ref}, "$dir"); + } + } + closedir(DIR); + +} + +sub getSubDirsFullPath { + my ($startDir, $DirArray_ref) = @_; + my ($dir); + opendir(DIR,"$startDir"); + while($dir = readdir(DIR)) { + if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { + push (@{$DirArray_ref}, "$startDir$dir"); + } + } + closedir(DIR); + +} + +sub findSubDir { + my ($DirArray_ref) = @_; + my (@sortedArray, $dir, $instdir); + @sortedArray = sort langsort @{$DirArray_ref}; + print "Langs: @sortedArray\n" if $is_command_infos; + foreach $dir (@sortedArray) { + if ($dir =~ /log$/) { + next; + } + $instdir = "$dir"; + return $instdir; + } + return ""; +} + +sub findMultiple { + my ($base, $name) = @_; + my ($f, @s, @res); + opendir(DIR, $base) or die "cannot open dir $base"; + while ($f = readdir(DIR)) { + push @res, "$base" if $f eq $name; + push @s, $f if + -d "$base$f" && ! -l "$base$f" && $f ne '.' && $f ne '..'; + } + closedir(DIR); + foreach $f (@s) { + push @res, findMultiple("$base$f$PathSeparator", $name); + } + return @res; +} + +sub findUnique { + my ($base, $name) = @_; + my @res = findMultiple($base, $name); + die "no unique $name in $base" unless @res == 1; + return $res[0]; +} + +sub prepare { + if ($gui eq "UNX") { + $ENV{ignore_patch_check}="t"; + $ENV{OOO_FORCE_DESKTOP} = "none"; + } + +} + +sub is_Installset_ok { + my ($installpath, $installname) = @_; + my ($is_ok, $infile); + $is_ok = 1; + $infile = $INSTALLSET. "log$PathSeparator"; + $infile =~ s/_pre_//; + $infile =~ s/[\/\\]normal[\/\\]//; + $infile =~ s/\.(\d+)$/_$1\.html/; + #if ($installname =~ /(?:_pre_){0,1}(.*)\.(\d+)/) { + # $infile .= "$1_$2.html"; + # print "protocol: $infile\n" if $is_debug; + #} + open INTABLE, "<$infile" or return errorFromOpen ($infile); + while(<INTABLE>) { + $line = $_; + if ( $line =~ />(error)(.*)</ ) { + print "ERROR: $1$2\n"; + $is_ok = 0; + } + } + close INTABLE; + return $is_ok; +} + +sub errorFromOpen { + my ($file) = @_; + print "ERROR: can't open $file\n"; + return 0; +} + +sub doTest { + my ($Command); + my (@Params, $basedir, $basisdir, $branddir); + + # check installset (error 8) + + if (($INSTSETNAME ne "") and $is_protocol_test) { + if (!is_Installset_ok ("$PORDUCT", $INSTSETNAME)) { + print_error ($error_messages[$error_installset], $error_installset); + } + } + + # install office (error 2) + + $basedir = doInstall ("$INSTALLSET$INSTSETNAME$PathSeparator", $installpath); + $basisdir = findUnique($basedir, 'ure-link'); + $branddir = findUnique($basedir, 'basis-link'); + if ( (defined($ENV{OS})) && ($ENV{OS} eq "MACOSX") ) { + $programpath = "$branddir". "MacOS$PathSeparator"; + } + else { + $programpath = "$branddir". "program$PathSeparator"; + } + $userinstallpath_without = $installpath . $userinstalldir; + $userinstallpath = $userinstallpath_without . $PathSeparator; + $userpath = "$userinstallpath" . "user$PathSeparator"; + $basicpath = $userpath . "basic$PathSeparator"; + $standardbasicpath = "$basisdir" . "presets$PathSeparator" . "basic$PathSeparator"; + $LOGPATH="$userinstallpath" . "user" . $PathSeparator . "temp"; + + if ($gui eq "UNX") { + $Command = "chmod -R 777 \"$basedir\"*"; + execute_system ("$Command"); + } + + # check setup log file (error 7) + +# $Command = "$PERL check_setup.pl \"$programpath" . "setup.log\""; +# execute_Command ($Command, $error_setup_log, $show_Message, $command_normal ); + + # patch config (error 3) + + $Command = "$PERL config.pl \"$basisdir \" \"$branddir \" \"$userinstallpath \" \"$DATA \" \"$buildid\""; + execute_Command ($Command, $error_patchConfig, $show_Message, $command_normal ); + + # copy basicscripts (error 9) + + $Command = "$COPY_FILE \"$DATA" . "scripts$PathSeparator" . "\"*.x* \"$standardbasicpath" . "Standard$PathSeparator\""; + execute_Command ($Command, $error_copyBasic, $show_Message, $command_withoutOutput); + + createPath("$basicpath", $error_copyBasic); + $Command = "$COPY_DIR \"$standardbasicpath\"* \"$basicpath\""; + execute_Command ($Command, $error_copyBasic, $show_Message, $command_withoutOutput); + + # patching bootstrap (error 11) + + if (!patch_bootstrap ("$programpath$bootstrapini", "$programpath$bootstrapiniTemp")) { + print_error ($error_messages[$error_patchBootstrap], $error_patchBootstrap); + } + + # copy extension (error 6) + + createPath ($LOGPATH, $error_copyExtension); + $Command = "$COPY_FILE \"$ExtensionDir" . "TestExtension.oxt\" " . "\"$LOGPATH$PathSeparator\""; + execute_Command ($Command, $error_copyExtension, $show_Message, $command_withoutOutput); + + + # start office (error 4) + + print "starting office ($INSTSETNAME)\n"; + + $Command = "\"$programpath" . "$SOFFICEBIN\" -norestore -nocrashreport macro:///Standard.Global.StartTestWithDefaultOptions"; + if ( (defined($ENV{OS})) && ($ENV{OS} eq "MACOSX") ) { + $Command = "cd \"$programpath\"; " . $Command; + } + execute_Command ($Command, $error_startOffice, $show_Message, $command_normal); + + # test if smoketest is ok (error 5) + + $Command = "$PERL testlog.pl \"$LOGPATH\""; + execute_Command ($Command, $error_testResult, $show_Message, $command_normal); + + # deinstall office (error 6) + + if ($is_remove_at_end) { + print "Deinstalling Office\n"; + } +# $Command = "$PERL deinstall.pl \"$LOGPATH\" \"$installpath\""; +# execute_Command ($Command, $error_deinstall, $show_NoMessage, $command_normal); +} + +sub doInstall { + my ($installsetpath, $dest_installdir) = @_; + my ($DirArray, $mask, $file, $Command, $optdir, $rpmdir, $system, $mach, $basedir, $output_ref, $olddir, $newdir); + if (($ENV{PKGFORMAT} eq "installed") and (!defined($ENV{FORCE2ARCHIVE}))) { + createPath ($dest_installdir, $error_setup); + $Command = "$COPY_DIR \"$installsetpath\" \"$dest_installdir\""; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + @DirArray = (); + getSubDirsFullPath ($dest_installdir, \@DirArray); + if ($#DirArray == 0) { + $basedir = $DirArray[0] . $PathSeparator; + } + elsif ($#DirArray == -1) { + print_error ($error_setup, $show_Message); + } + else { + $basedir = $dest_installdir; + } + } + elsif (($gui eq "WNT") or ($gui eq $cygwin)) { + if (defined($ENV{FORCE2ARCHIVE})) { + print_error ($error_messages[$error_packformat], $error_packformat); + } + $mask = "\\.msi\$"; + getSubFiles ("$installsetpath", \@DirArray, $mask); + if ($#DirArray == -1) { + print_error ("Installationset in $installsetpath is incomplete", 2); + } + foreach $file (@DirArray) { + if ($gui eq $cygwin) { + my $convertinstallset = ConvertCygwinToWin_Shell("$installsetpath$file"); + my $convertdestdir = ConvertCygwinToWin_Shell($dest_installdir); + $_inst_cmd=$ENV{SMOKETEST_SOINSTCMD}; + if ( defined($_inst_cmd) ) { + $Command = $_inst_cmd . " $convertinstallset -qn TARGETDIR=$convertdestdir"; + } + else { + if ($is_admin_installation) { + $Command = "msiexec.exe /a $convertinstallset -qn TARGETDIR=$convertdestdir ALLUSERS=2"; + } + else { + $Command = "msiexec.exe -i $convertinstallset -qn INSTALLLOCATION=$convertdestdir"; + } + } + } + else { + $_inst_cmd=$ENV{SMOKETEST_SOINSTCMD}; + if ( defined($_inst_cmd) ) { + $Command = $_inst_cmd . " $installsetpath$file -qn TARGETDIR=$dest_installdir"; + } + else { + if ($is_admin_installation) + { + $Command = "msiexec.exe /a $installsetpath$file -qn TARGETDIR=$dest_installdir ALLUSERS=2"; + } + else { + $Command = "msiexec.exe -i $installsetpath$file -qn INSTALLLOCATION=$dest_installdir"; + } + } + } + if (!$is_oo and !$is_admin_installation) { + if ($gui eq $cygwin) { + my $convertdata = ConvertCygwinToWin_Shell($DATA); + $Command .= " TRANSFORMS=$convertdata" . "staroffice.mst"; + } + else { + $Command .= " TRANSFORMS=$DATA" . "staroffice.mst"; + } + } + execute_Command ($Command, $error_msiexec, $show_Message, $command_normal); + } + if (!$is_admin_installation) { + $Command = "$COPY_FILE \"$installsetpath" . "setup.ini" . "\" \"$dest_installdir\""; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + } + $basedir = $dest_installdir; + } + elsif ($gui eq "UNX") { + $system = `uname -s`; + chomp $system; + $mach = `uname -m`; + chomp $mach; + if (defined ($ENV{EPM}) && ($ENV{EPM} eq 'NO')) { # do the install ourselves ... +# FIXME - this tool should work nicely without such hacks +# cut/paste from ooo-build/bin/ooinstall + my $instoo_dir = "$ENV{SRC_ROOT}/instsetoo_native"; + + if ( $ENV{'SYSTEM_MOZILLA'} eq 'YES' ) { + if (defined $ENV{'LD_LIBRARY_PATH'}) { + $ENV{'LD_LIBRARY_PATH'} = + "$ENV{'LD_LIBRARY_PATH'}:$ENV{'MOZ_LIB'}"; + } else { + $ENV{'LD_LIBRARY_PATH'} = $ENV{'MOZ_LIB'}; + } + } + $ENV{'PYTHONPATH'} = "$ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/bin:$ENV{SOLARVERSION}/$ENV{INPATH}/lib"; + $ENV{OUT} = "../$ENV{INPATH}"; + $ENV{LOCAL_OUT} = "../$ENV{INPATH}"; + $ENV{LOCAL_COMMON_OUT} = "../$ENV{INPATH}"; + my $sane_destdir = $dest_installdir; + $sane_destdir .= "oootest"; + createPath ($sane_destdir, $error_setup); + $Command = "cd $instoo_dir/util ; perl -w $ENV{SOLARENV}/bin/make_installer.pl " . + "-f openoffice.lst -l en-US -p OpenOffice " . + "-buildid \"smoketestoo\" -simple $sane_destdir"; +# FIXME - this tool should work nicely without such evil + execute_Command ($Command, $error_setup, $show_Message, $command_normal); + return "$sane_destdir/" + + } elsif ( (defined($system)) && ($system eq "Linux") ) { + if (defined ($ENV{FORCE2ARCHIVE}) and ($ENV{FORCE2ARCHIVE} eq "TRUE")) { + $optdir = $dest_installdir; #needed for getting work dir at the end + $mask = "\\.tar\\.gz\$"; + getSubFiles ("$installsetpath", \@DirArray, $mask); + if ($#DirArray == -1) { + print_error ("Installationset in $installsetpath is incomplete", 2); + } + elsif ($#DirArray == 0) { + createPath ($dest_installdir, $error_setup); + $Command = "cd \"$dest_installdir\" && tar xzvf \"$installsetpath$DirArray[0]\""; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + } + else { + print_error ($error_setup, $show_Message); + } + } + elsif ($ENV{PKGFORMAT} eq "deb") { # default is rpm + $installsetpath .= "DEBS$PathSeparator"; + $optdir = "$dest_installdir" . "opt" . $PathSeparator; + createPath ($optdir, $error_setup); + $mask = "\\.deb\$"; + getSubFiles ("$installsetpath", \@DirArray, $mask); + if ($#DirArray == -1) { + print_error ("Installationset in $installsetpath is incomplete", 2); + } + foreach $file (@DirArray) { + if ( ($file =~ /-menus-/) or ($file =~ /^adabas/) or (/^j2re-/) or ($file =~ /-gnome-/) ) { + next; + } + $Command = "dpkg-deb -x $installsetpath$file $dest_installdir"; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); + } + } + else { + $installsetpath .= "RPMS$PathSeparator"; + $optdir = "$dest_installdir" . "opt" . $PathSeparator; + $rpmdir = "$dest_installdir" . "rpm" . $PathSeparator; + createPath ($optdir, $error_setup); + createPath ($rpmdir, $error_setup); + $Command = "rpm --initdb --dbpath $rpmdir"; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + $mask = "\\.rpm\$"; + getSubFiles ("$installsetpath", \@DirArray, $mask); + if ($#DirArray == -1) { + print_error ("Installationset in $installsetpath is incomplete", 2); + } + foreach $file (@DirArray) { + if ( ($file =~ /-menus-/) or ($file =~ /^adabas/) or (/^j2re-/) or ($file =~ /-gnome-/) ) { + next; + } + $Command = "rpm --install --ignoresize --nodeps -vh --relocate /opt=${dest_installdir}opt --dbpath $rpmdir $installsetpath$file"; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); + } + } + } + elsif ( (defined($system)) && ($system eq "SunOS") ) { + if (defined($ENV{FORCE2ARCHIVE})) { + print_error ($error_messages[$error_packformat], $error_packformat); + } + @DirArray = (); + $mask = "^.ai.pkg.zone.lock"; + getSubFiles ("/tmp", \@DirArray, $mask); + if ($#DirArray >= 0) { + foreach $file (@DirArray) { + $Command = "$REMOVE_FILE /tmp/$file"; + execute_Command ($Command, $error_logflag, $show_Message, $command_withoutOutput); + } + } + if ($mach eq sun4u) { + $solarisdata = $DATA . "solaris$PathSeparator" . "sparc$PathSeparator"; + } + else { + $solarisdata = $DATA . "solaris$PathSeparator" . "x86$PathSeparator"; + } + $installsetpath .= "packages$PathSeparator"; + $optdir = "$dest_installdir" . "opt" . $PathSeparator; + createPath ($optdir, $error_setup); + createPath ($dest_installdir . "usr$PathSeparator" . "bin", $error_setup); + @DirArray = (); + getSubDirs ("$installsetpath", \@DirArray); + my $ld_preload = $ENV{LD_PRELOAD}; + $ENV{LD_PRELOAD} = $solarisdata . "getuid.so"; + if ($#DirArray == -1) { + print_error ("Installationset in $installsetpath is incomplete", 2); + } + foreach $file (@DirArray) { + if ( ($file =~ /-gnome/) or ($file =~ /-cde/) or ($file =~ /adabas/) or ($file =~ /j3/) or ($file =~ /-desktop-/) ) { + next; + } + $Command = "pkgparam -d $installsetpath $file BASEDIR"; + $output_ref = execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + if (($#{@$output_ref} > -1) and ($$output_ref[0] ne "") ) { + createPath ("$dest_installdir$$output_ref[0]", $error_setup); + } + $Command = "pkgadd -a $solarisdata" . "admin -d $installsetpath -R $dest_installdir $file"; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); + } + my $pkgadd_tmpfile = "/tmp/.ai.pkg.zone.lock*"; + $Command = "$REMOVE_FILE $pkgadd_tmpfile"; + execute_Command ($Command, $error_setup, $show_NoMessage, $command_withoutErrorcheck | $command_withoutOutput); + $ENV{LD_PRELOAD} = $ld_preload; + } + elsif ( (defined($ENV{OS})) && ($ENV{OS} eq "MACOSX") ) { + if (defined($ENV{FORCE2ARCHIVE})) { + print_error ($error_messages[$error_packformat], $error_packformat); + } + @DirArray = (); + my $install_dmg; + getSubFiles ("$installsetpath", \@DirArray, "^[a-zA-Z0-9].*\\.dmg\$"); + if ($#DirArray == 0) { + $install_dmg = "$installsetpath" . $DirArray[0]; + } + elsif ($#DirArray > 0) { + print_error ("more than one installset found in $installsetpath", 2); + } + else { + print_error ("no installset found in $installsetpath", 2); + } + $Command = "hdiutil attach " . $install_dmg; + my $output_ref; + $output_ref = execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + my $volumeinfo = $$output_ref[$#{@{$output_ref}}]; + if (!$volumeinfo =~ /OpenOffice/) { + print_error ("mount of $install_dmg failed", 2); + } + $volumeinfo =~ s/\s{2,}/;/g; + my @volumeinfos = split(/;/,$volumeinfo); + my $detachpath = $volumeinfos[0]; + my $newinstallsetpath = $volumeinfos[2] . $PathSeparator; + createPath ($dest_installdir, $error_setup); + $Command = "$COPY_DIR \"$newinstallsetpath\" \"$dest_installdir\""; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + $Command = "hdiutil detach " . $detachpath; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + @DirArray = (); + getSubFiles ("$dest_installdir", \@DirArray, "\\.app"); + if ($#DirArray == 0) { + $optdir = "$dest_installdir" . $DirArray[0] . $PathSeparator; + my $PListFile = "Info.plist"; + my $officeDir = "$optdir" . "Contents" . $PathSeparator; + my $programmDir = "$officeDir" . "MacOS" . $PathSeparator; + $Command = "$COPY_FILE \"$officeDir$PListFile\" \"$programmDir$PListFile\""; + execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); + } + else { + print_error ("Installation in $dest_installdir is incomplete", 2); + } + } + else { + print_error ("Plattform is not supported", 2); + } + @DirArray = (); + getSubDirsFullPath ($optdir, \@DirArray); + if ($#DirArray == 0) { + $basedir = $DirArray[0] . $PathSeparator; + } + elsif ($#DirArray == -1) { + print_error ($error_setup, $show_Message); + } + else { + $basedir = $optdir; + } + } + return ($basedir); +} + +sub langsort { + if ($a eq $prefered_lang) { + return -1; + } + elsif ($b eq $prefered_lang) { + return 1; + } + else { + $a cmp $b; + } +} + +sub getInstset { + my ($INSTSET, $NEWINSTSET); + my (@DirArray, $InstDir, $RootDir, $TestDir1, $TestDir2); + + if (defined ($ENV{EPM}) && ($ENV{EPM} eq 'NO') && ($gui eq "UNX")) { # we do the install ourselves ... + return (); + } + + print "get Instset\n" if $is_debug; + $NEWINSTSET = ""; + if (defined($smoketest_install)) { + my $mask = "\\" . $PathSeparator . "\$"; + $smoketest_install =~ s/$mask//; + my ($sufix); + ($NEWINSTSET, $INSTSET, $sufix) = fileparse ($smoketest_install); + return ($NEWINSTSET, $INSTSET); + } + if (!isLocalEnv() and !defined($ENV{CWS_WORK_STAMP}) and (-e $SHIP)) { + my $last_lineend = $/; + if ($gui eq $cygwin) { + &SetCygwinLineends(); + } + ($NEWINSTSET, $INSTSET) = getSetFromServer(); + $/ = $last_lineend; + } + else { + $InstDir=""; + $RootDir=$ENV{DMAKE_WORK_DIR}; + $RootDir=~s/\w+$//; + foreach $project (@install_list) { + @DirArray=(); + $TestDir1 = "$RootDir$project$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator"; + $TestDir2 = "$StandDir$project$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator"; + if (-e "$TestDir1") { + $InstDir= $TestDir1; + } + elsif (-e "$TestDir2") { + $InstDir="$TestDir2"; + } + if ($InstDir eq "") { + next; + } + getSubDirs ("$InstDir", \@DirArray); + $INSTSET = findSubDir (\@DirArray); + print "Lang-Sel: $INSTSET\n" if $is_command_infos; +; + if ($INSTSET ne "") { + $NEWINSTSET = $INSTSET; + $INSTSET = $InstDir; + print "new: $INSTSET\n"; + } + if (($INSTSET ne "") and (-e $INSTSET)) { + return ($NEWINSTSET, $INSTSET); + } + } + print_error ("no installationset found\n",2); + } + return ($NEWINSTSET, $INSTSET); +} + +sub isLocalEnv { + my $returnvalue = 0; + if (defined ($ENV{SOL_TMP}) && defined ($ENV{SOLARVERSION})) { + my $mask = $ENV{SOL_TMP}; + $mask =~ s/\\/\\\\/; + print "Mask: $mask\n" if $is_debug; + if ($ENV{SOLARVERSION}=~ /$mask/) { + $returnvalue = 1; + } + } + return $returnvalue; +} + +sub get_milestoneAndBuildID { + my ( $ws, $pf ) = @_; + my ($milestone, $buildid, $upd, $path, $updext); + + if ( $ws =~ /^\D+(\d+)$/) { + $upd = $1; + } + + if (defined ($ENV{UPDMINOREXT})) { + $updext = $ENV{UPDMINOREXT}; + } + else { + $updext = ""; + } + + $path = "$ENV{SOLARVER}$PathSeparator$pf$PathSeparator" . "inc$updext$PathSeparator$upd" . "minor.mk"; + print "$path\n" if $is_debug; + if ( !open(MINORMK,$path) ) { + print "FATAL: can't open $path\n"; + return (0,0); + } + + if (!eof(MINORMK)) { + while (<MINORMK>) { + chomp; + if ( /LAST_MINOR=(\w+)/ ) { + $milestone = $1; + } + elsif ( /BUILD=(\d+)/ ) { + $buildid = $1; + } + } + + close(MINORMK); + } + return ($milestone, $buildid); +} + +sub get_productcode { + my ( $installpath ) = @_; + my ($path, $productcode); + $productcode = ""; + $path = "$installpath" . "setup.ini"; + print "$path\n" if $is_debug; + if ( !open(SETUP,$path) ) { + print "FATAL: can't open $path\n" if ($is_command_infos); + return ($productcode); + } + + if (!eof(SETUP)) { + while (<SETUP>) { + chomp; + if ( /productcode=(\{[\d\w-]+\})/ ) { + $productcode = $1; + } + } + + close(SETUP); + } + return ($productcode); +} + +sub InstsetSort { + my ($a1, $b1); + if ($a =~ /$global_instset_mask/) { + $a1 = $1; + } + if ($b =~ /$global_instset_mask/) { + $b1 = $1; + } + $a1 <=> $b1; +} + +sub getSetFromServer { + my ($DirName, $SetupFullPath); + my $workspace = $ENV{WORK_STAMP}; + my $platform = $ENV{INPATH}; + my $latestset; + my (@DirArray, $mask, $buildid); + $SetupFullPath = $PORDUCT; + if ( ! ( $workspace && $platform ) ) { + print_error ( "Error: environment not set correctly.", 1); + } + # get latest broadcastet milestone and pack number + ($milestone, $buildid) = get_milestoneAndBuildID( $workspace, $platform ); + if (!defined($milestone)) { + print_error ("Milestone ist not defined!", 2); + } + if (!defined($buildid)) { + print_error ("Build-ID ist not defined!", 2); + } + +# if ( $SetupFullPath =~ /^\/s.*\/install\// ) { +# if ( $gui eq "UNX" ) { +# $SetupFullPath = "/net/jumbo.germany" . $SetupFullPath; +# } else { +# $SetupFullPath = "\\\\jumbo" . $SetupFullPath; +# } +# } + +# my $ws_lc = lc $workspace; + $mask = "^$workspace" . "_" . $milestone . "_native_packed-(\\d+)_en-US\\.$buildid"; + $global_instset_mask = $mask; + getSubFiles ($SetupFullPath, \@DirArray, $mask); + @DirArray = sort InstsetSort @DirArray; + if ($#DirArray > -1) { + $latestset = $DirArray [$#DirArray]; + $DirName = $latestset; + } + else { + print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); + } + print "Latest install sets: $latestset\n" if $is_debug; + + print "$DirName\t $SetupFullPath\n" if $is_debug; + + # compare with file system + # at the moment just the existence is checked. For security reasons it might be + # better to additionally check whether there are newer sets (this must not happen, + # but who knows ...) + if ( -d $SetupFullPath ) { + return ($DirName, $SetupFullPath); + } else { + print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); + } +} + +sub patch_bootstrap { + my ($sourcefile, $destfile) = @_; + my (@convert_split, $line); + my ($Error) = 1; + my ($lineend); + + if ($is_debug) { + print "patching bootstrap $sourcefile ...\n"; + return 1; + } + + $Error &= move ("$sourcefile", "$destfile"); + + open OUTFILE, ">$sourcefile" or return errorFromOpen ($sourcefile); + open INFILE, "<$destfile" or return errorFromOpen ($destfile); + binmode(OUTFILE); + binmode(INFILE); + while(<INFILE>) { + $line = $_; + + if ( $line =~ /UserInstallation/ ) { + if ($line =~ /(\r\n)/) { + $lineend = $1; + } + elsif ($line =~ /(\n)/) { + $lineend = $1; + } + else { + $lineend = $/; + } + @convert_split = split "=", $line; + $line = $convert_split[0]; + $line .= "="; + if ($gui eq $cygwin) { + $line .= ConvertToFileURL(ConvertCygwinToWin($userinstallpath_without)); + } + else { + $line .= ConvertToFileURL($userinstallpath_without); + } + $line .= $lineend; + } + print OUTFILE "$line"; + + } + + close OUTFILE; + close INFILE; + $Error &= unlink ($destfile); + return ($Error); +} + +sub SetWinLineends () { + $/ = $WinLineends; +} + +sub SetCygwinLineends () { + $/ = $CygwinLineends; +} + +sub ConvertToFileURL { + my ($filename) = @_; + my ($FileURL); + + $FileURL = $FileURLPrefix . $filename; + $FileURL =~ s/\\/\//g; + $FileURL =~ s/\/\/\/\//\/\/\//; # 4 slashes to 3 slashes + return ($FileURL); +} + +sub ConvertCygwinToWin_Shell { + my ($cygwinpath) = @_; + my ($winpath); + $winpath = ConvertCygwinToWin ($cygwinpath); + $winpath =~ s/\\/\\\\/g; + return ($winpath); +} + +sub ConvertCygwinToWin { + my ($cygwinpath) = @_; + my ($winpath); + my ($last_lineends) = $/; + SetCygwinLineends(); + $winpath=`cygpath --windows $cygwinpath`; + chomp($winpath); + $/ = $last_lineends; + return ($winpath); +} + +sub createPath { + my ($path, $Error) = @_; + if (!-d "$path") { + if (!$is_debug) { + eval {mkpath("$path", 0, 0777)}; + if ($@) { + print_error ($error_messages[$Error], $Error); + } + } + else { + print "mkpath($path, 0, 0777)\n"; + } + } +} + +sub save_sversion { + my ($sversion) = @_; + my ($sversion_bak) = $sversion . "_"; + if (-e $sversion) { + if (-e $sversion_bak) { + execute_system("$REMOVE_FILE \"$sversion_bak\""); + } + execute_system("$COPY_FILE \"$sversion\" \"$sversion_bak\""); + execute_system("$REMOVE_FILE \"$sversion\""); + $sversion_saved = 1; + } +} + +sub restore_sversion { + my ($sversion) = @_; + my ($sversion_bak) = $sversion . "_"; + if ($sversion_saved) { + if (-e $sversion) { + execute_system("$REMOVE_FILE \"$sversion\""); + } + execute_system("$COPY_FILE \"$sversion_bak\" \"$sversion\""); + execute_system("$REMOVE_FILE \"$sversion_bak\""); + $sversion_saved = 0; + } +} + +sub removeOldInstallation { + my ($installpath) = @_; + if (!$is_debug) { + if (-e $installpath) { + execute_system("$REMOVE_DIR \"$installpath\""); + } + if (-e $installpath) { + print_error ("can not clear old installation in $installpath\n", 3); + } + } +} + +sub removeInstallation { + my ($installpath) = @_; + if (!$is_debug) { + if (-e $installpath) { + execute_system("$REMOVE_DIR \"$installpath\""); + } + } +} + +sub deinstallInstallation { + my ($installpath) = @_; + my ($productcode); + if ($gui eq "UNX") { return; } + if (!$is_debug) { + if (-e $installpath) { + $productcode = get_productcode ($installpath); + print "Productcode: $productcode\n" if ($is_command_infos); + if ($productcode ne "") { + print "deinstalling $productcode ...\n"; + $Command = "msiexec.exe -x $productcode -qn"; + execute_Command ($Command, $error_deinst, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); + } + } + } +} + +sub setInstallpath { + my ($infile, $outfile, $installpath) = @_; + if (-e $outfile) { + execute_system ("$REMOVE_FILE \"$outfile\""); + + } + open OUTTABLE, ">$outfile" or die "Error: can\'t open solarfile $outfile"; + open INTABLE, "<$infile" or die "Error: can\'t open solarfile $infile"; + while(<INTABLE>) { + $line = $_; + if ( $line =~ /^DESTINATIONPATH=officeinstallpath/ ) { + $line =~ s/officeinstallpath/$installpath/; + } + print OUTTABLE "$line"; + } + close INTABLE; + close OUTTABLE; +} + +sub execute_Command { + my ($Command, $Errorcode, $showMessage, $command_action) = @_; + my ($Returncode, $output_ref); + if (!$is_debug) { + if ( ($command_action & $command_withoutOutput) == $command_withoutOutput) { + ($Returncode, $output_ref) = execute_system ("$Command"); + } + else { + print "$Command\n" if $is_command_infos; + $Returncode = system ("$Command"); + } + if ($Returncode) { + if ($showMessage) { + if (($command_action & $command_withoutErrorcheck) == $command_withoutErrorcheck) { + print_warning ($error_messages[$Errorcode], $Errorcode); + } + else { + print_error ($error_messages[$Errorcode], $Errorcode); + } + } + else { + if (($command_action & $command_withoutErrorcheck) != $command_withoutErrorcheck) { + do_exit ($Errorcode); + } + } + } + } + else { + print "$Command\n"; + } + return $output_ref; +} + +sub execute_system { + my ($command) = shift; + my (@output_array, $line); + if ( $is_command_infos ) { + print STDERR "TRACE_SYSTEM: $command\n"; + } + open( COMMAND, "$command 2>&1 |"); + while ($line = <COMMAND>) { + chomp $line; + push (@output_array, $line); + } + close(COMMAND); + return $?, \@output_array; +} + +sub print_warning +{ + my $message = shift; + + print STDERR "$script_name: "; + print STDERR "WARNING $message\n"; + return; +} + +sub print_error +{ + my $message = shift; + my $error_code = shift; + + print STDERR "$script_name: "; + print STDERR "ERROR: $message\n"; + + do_exit($error_code); +} + +sub print_notRemoved { + my ($installpath) = @_; + print "no deinstallation from $installpath\n"; +} + +sub do_exit +{ + my $error_code = shift; + + if ($sversion_saved) { + restore_sversion ($SVERSION_INI); + } + if ($is_remove_on_error) { + if ($is_do_deinstall) { + deinstallInstallation ($installpath); + } + removeInstallation($installpath); + } + else { + print_notRemoved ($installpath); + } + if ( $error_code ) { + print STDERR "\nFAILURE: $script_name aborted.\n"; + } + exit($error_code); + +} diff --git a/smoketestoo_native/testlog.pl b/smoketestoo_native/testlog.pl new file mode 100755 index 000000000000..99364cb9d1c0 --- /dev/null +++ b/smoketestoo_native/testlog.pl @@ -0,0 +1,290 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: testlog.pl,v $ +# +# $Revision: 1.6 $ +# +# 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. +# +#************************************************************************* + +### globals ### + +$is_debug = 0; + +$global_log = "log.dat"; + +%logfiles_list = ("writer", "swlog.dat", + "math", "smalog.dat", + "HTML", "shptlog.dat", + "draw", "sdrwlog.dat", + "impress", "sdlog.dat", + "calc", "sclog.dat", + "chart", "schlog.dat", + "Java", "javalog.dat", + "Database", "dblog.dat", + "Extension", "extlog.dat" +); + +%log = (); +@ApplicationLog = (); +$dont_kill ="dont_deinstall"; +$error_str = "error"; +$tests_complete = "---"; +$gui = $ENV{GUI}; +$inpath = $ENV{INPATH}; +$cygwin = "cygwin"; + +if ($^O =~ /cygwin/) { + $gui = $cygwin; +} + +if (($gui eq "UNX") or ($gui eq $cygwin)) { + $pathslash = "/"; +} +else +{ + $pathslash = "\\"; +} + +$misc = $inpath . $pathslash . "misc" . $pathslash; +$okfile = $misc . "ok.bat"; +umask (02); + +### sub routines ### + +sub test_logfile { + my ($file, $testname) = @_; + my ($line, $failed, $complete, $linecount, $LastLineError); + + $failed = 0; + $complete = 0; + $linecount = -1; + $LastLineError = 0; + + if (! -e $file) { + print "error: $testname failed! Logfile is missing.\n" if $is_debug; + + return (0,0); + } + + open TABLE, "<$file" or die "Error: canīt open log file $file]"; + + while(<TABLE>) { + $line = $_; + chomp $line; + $linecount++; + if ( $line =~ /$error_str/ ) { + print "error: $testname: $line\n"; + $failed = 1; + $LastLineError = 1; + } + elsif ( $line =~ /$tests_complete/ ) { + $complete = 1; + print "$file: $line\n" if $is_debug; + } + else + { + print "$testname: $line\n" if $is_debug; + $LastLineError = 0; + } + } + + close TABLE; + + print "$failed $complete $LastLineError $linecount\n" if $is_debug; + + if (!$complete) { + my $message = "error: $testname: the test was not complete!"; + if ((!$failed) || (($failed) && (!$LastLineError))) { + my $errormessage = getLog ($testname, $linecount+1); + if ($errormessage ne "") { + $message .= " $errormessage possibly failed!"; + } + } + if (!$failed && !$is_testerror) { + print "$message\n"; + } + } + + if (!$failed && $complete) { + print "true\n" if $is_debug; + return (1,1); + } + else + { + print "false\n" if $is_debug; + return (0,1); + } +} + +sub readGlobalLog { + my ($line); + my $logfilename = $logfiledir . $pathslash . $global_log; + if (! -e $logfilename) { + print "$logfilename: file is missing\n" if $is_debug; + return 0; + } + + open TABLE, "<$logfilename" or die "Error: canīt open log file $logfilename]"; + + my $failed = 0; + my $complete = 0; + my $FirstLine = 1; + while(defined($line = <TABLE>) and !$complete) { + chomp $line; + if ($FirstLine) { + if ( $line =~ /Sequence of testing/ ) { + $FirstLine = 0; + next; + } + else { + print "$logfilename: $line\n" if $is_debug; + $failed = 1; + return 0; + } + } + else { + if ( $line eq "" ) { + $complete = 1; + next; + } + my @splitedLine = split(/:/,$line); + my $testApplication = $splitedLine [0]; + $testApplication =~ s/^ *(.*?) *$/$1/g; #truncate + my $testAction = $splitedLine [1]; + @splitedLine = split(/,/,$testAction); + my @log_array = (); + foreach my $action (@splitedLine) { + $action =~ s/^ *(.*?) *$/$1/g; #truncate + if ($action =~ /\//) { + my @splitAction = split(/\//,$action); + my @specialAction; + foreach my $doubleaction (@splitAction) { + $doubleaction =~ s/^ *(.*?) *$/$1/g; #truncate + push (@specialAction, $doubleaction); + } + $action = join (' or ', @specialAction); + foreach my $doubleaction (@splitAction) { + push (@log_array, $action); + } + } + else { + push (@log_array, $action); + } + } + push (@ApplicationLog, $testApplication); + $log{$testApplication} = \@log_array; + } + } + + close TABLE; + + return 1; +} + +sub getLog { + my ($testname, $linecount) = @_; + if ($linecount <= $#{@{$log{$testname}}}) { + return $log{$testname}[$linecount]; + } + else { + return ""; + } +} + +### main ### + +$idStr = ' $Revision: 1.6 $ '; +$idStr =~ /Revision:\s+(\S+)\s+\$/ + ? ($cpflat2minor_rev = $1) : ($cpflat2minor_rev = "-"); + +print "TestLog -- Version: $cpflat2minor_rev\n"; + +if (-e $okfile) { + unlink ($okfile); +} + +if ( ($#ARGV >-1) && ($#ARGV < 1) ) { + $ARGV[0] =~ s/\"//g; +} + +if ( ! ( ($#ARGV < 1) && $ARGV[0] && (-d $ARGV[0]) ) ) { + print "Error! Usage: testlog <log_directory>\n" ; + exit(1); +} + +$logfiledir = $ARGV[0]; +$is_testerror = 0; +$is_OneTestAvailable = 0; + +print "%logfiles_list\n" if $is_debug; + +readGlobalLog(); + +foreach my $applog (@ApplicationLog) { + if (!exists($logfiles_list{$applog})) { + next; + } + my $logname = $logfiles_list{$applog}; + $current_file = $logfiledir . $pathslash . $logname; + my ($error, $logfile) = test_logfile ($current_file, $applog); + + if ($logfile) { + $is_OneTestAvailable = 1; + } + elsif (!$is_testerror) { + print "error: $applog failed! Logfile is missing.\n"; + } + + if (!$error) { + $is_testerror = 1; + } + +} + +# write file to prevent deinstallation of office +if ($is_testerror) { + $dont_del_file = $logfiledir . $pathslash . $dont_kill; + open (ERRFILE, ">$dont_del_file"); + print ERRFILE "dont delete flag"; + close (ERRFILE); +} +else { + print "$okfile\n" if $is_debug; + open( OKFILE, ">$okfile"); + print OKFILE "echo ok!\n"; + close( OKFILE ); + chmod (0775, "$okfile"); +} + +if (!$is_OneTestAvailable) { + print "error: no test succeeded! Maybe Office crashed during starting!\n"; + $is_testerror = 1; +} + +exit($is_testerror); |