2 eval 'exec perl -wS $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: testdefaultbootstrapping.pl,v $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
36 # deliver.pl - copy from module output tree to solver
39 my $progname = "testdefaultbootstrapping";
42 if ($ENV{GUI
} eq "WNT") {
44 'com.sun.star.uno.NamingService' => 'namingservice.uno.dll',
45 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.dll',
46 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.dll',
54 'com.sun.star.uno.NamingService' => 'namingservice.uno.so',
55 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.so',
56 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.so'
62 sub extendProgName
($) {
63 my $_extension = shift;
66 if ($ENV{GUI
} eq "WNT") {
67 $_result = $progname . $_extension;
70 $_result = $ENV{PWD
} . "/" . $progname . $_extension;
78 unlink $progname . "_services.rdb";
82 sub unregisterService
($){
83 my $service_name = shift;
85 my $rdb_name = $service_name . '.rdb';
92 sub testForServices
($$$) {
93 my $_services = shift;
98 # my $_rc = system 'echo', $_testexe, @{$_services}, $_pars;
99 my $_rc = system $_testexe, @
{$_services}, $_pars;
105 sub registerService
($$){
106 my $service_lib = shift;
107 my $rdb_name = shift;
109 # system 'echo', "regcomp -register -r " . $rdb_name . " -c $service_lib";
110 my $rc = system "regcomp -register -r " . $rdb_name . " -c $service_lib";
113 return ! ( $rc >> 8 );
120 my $allservices_rdbs="";
126 sub registerServices
() {
129 # ensure that services can not be instantiated
130 foreach $service ( keys %services ) {
131 # ensure that the current service is not reachable
132 unregisterService
($service);
133 $rc = !testForServices
([$service], "", $testexe);
135 $comment = $comment . "\tcouldn't unregister service " . $service . "\n";
140 # register the service and ensure that it is reachable
141 $rc = registerService
($services{$service}, $service . '.rdb');
143 $comment = $comment . "\tcouldn't register service " . $service . "\n";
147 $rc = testForServices
([$service], "-env:UNO_SERVICES=" . $service . ".rdb", $testexe);
149 $comment = $comment . "\tcouldn't reach service " . $service . "\n";
153 # memorize all services
154 if (length($allservices_rdbs)) {
155 $allservices_rdbs = $allservices_rdbs . " ";
157 $allservices_rdbs = $allservices_rdbs . "file://" . getcwd
() . "/" . $service . ".rdb";
158 push @allservices, $service;
162 sub testIndirection
() {
164 $rc = testForServices
(['com.sun.star.uno.NamingService'], '-env:UNO_SERVICES=${testrc:Tests:TestKey1}', $testexe);
166 $comment = $comment . "\tindirection test not passed\n";
172 sub testBeneathExe
() {
173 my $service = 'com.sun.star.reflection.CoreReflection';
176 my @_exes = (extendProgName
(".exe"),
177 extendProgName
(".Exe"),
178 extendProgName
(".bin"),
179 extendProgName
(".Bin"));
181 foreach $_testexe ( @_exes ) {
182 #test rdb found beneath executable
183 registerService
($services{$service}, $progname . "_services.rdb");
184 my $_rc = testForServices
([$service], "", $_testexe);
186 $comment = $comment . "\tbeneath executable test not passed: " . $_testexe . "\n";
192 sub testBeneathLib_rdb
() {
193 my $_service = 'com.sun.star.uno.NamingService';
199 if ($ENV{GUI
} eq "WNT") {
200 $_rdb_name = "UNO" . "_services.rdb";
203 $_rdb_name = "../lib/UNO" . "_services.rdb";
206 registerService
($services{$_service}, $_rdb_name);
207 my $_rc = UNO
::tryService
($_service);
209 $comment = $comment . "\tbeneath lib test not passed\n";
215 sub testBeneathLib_rc
() {
216 my $_service = 'com.sun.star.uno.NamingService';
222 if ($ENV{GUI
} eq "WNT") {
223 $_rc_name = "UNO.ini";
226 $_rc_name = "../lib/UNOrc";
229 my $_rdb_name = "../lib/test.rdb";
232 open $_handle, ">" . $_rc_name;
233 print $_handle "UNO_SERVICES=" . $_rdb_name . "\n";
236 registerService
($services{$_service}, $_rdb_name);
237 my $_rc = UNO
::tryService
($_service);
239 $comment = $comment . "\tbeneath lib rc test not passed\n";
246 sub testAllAvailable
() {
247 # test that all services are reachable through different rdbs
248 # change the directory to ensure, that all paths become expanded
251 $rc = testForServices
(\
@allservices, "-env:UNO_SERVICES=" . $allservices_rdbs, $testexe);
253 $comment = $comment . "\tmulti rdb test not passed\n";
258 $testexe = extendProgName
($defExeExt);
262 #print "alls:", @allservices, $allservices_rdbs, "\n";
267 testBeneathLib_rdb
();
270 print "**************************\n";
272 print "****** tests passed ******\n";
275 print "**** tests NOT passed ****\n";
276 print "Commnent:\n", $comment, "\n";
278 print "**************************\n";