2 eval 'exec perl -wS $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2000, 2010 Oracle and/or its affiliates.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # This file is part of OpenOffice.org.
14 # OpenOffice.org is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU Lesser General Public License version 3
16 # only, as published by the Free Software Foundation.
18 # OpenOffice.org is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Lesser General Public License version 3 for more details
22 # (a copy is included in the LICENSE file that accompanied this code).
24 # You should have received a copy of the GNU Lesser General Public License
25 # version 3 along with OpenOffice.org. If not, see
26 # <http://www.openoffice.org/license.html>
27 # for a copy of the LGPLv3 License.
29 #*************************************************************************
32 # deliver.pl - copy from module output tree to solver
35 my $progname = "testdefaultbootstrapping";
38 if ($ENV{GUI
} eq "WNT") {
40 'com.sun.star.uno.NamingService' => 'namingservice.uno.dll',
41 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.dll',
42 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.dll',
50 'com.sun.star.uno.NamingService' => 'namingservice.uno.so',
51 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.so',
52 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.so'
58 sub extendProgName
($) {
59 my $_extension = shift;
62 if ($ENV{GUI
} eq "WNT") {
63 $_result = $progname . $_extension;
66 $_result = $ENV{PWD
} . "/" . $progname . $_extension;
74 unlink $progname . "_services.rdb";
78 sub unregisterService
($){
79 my $service_name = shift;
81 my $rdb_name = $service_name . '.rdb';
88 sub testForServices
($$$) {
89 my $_services = shift;
94 # my $_rc = system 'echo', $_testexe, @{$_services}, $_pars;
95 my $_rc = system $_testexe, @
{$_services}, $_pars;
101 sub registerService
($$){
102 my $service_lib = shift;
103 my $rdb_name = shift;
105 # system 'echo', "regcomp -register -r " . $rdb_name . " -c $service_lib";
106 my $rc = system "regcomp -register -r " . $rdb_name . " -c $service_lib";
109 return ! ( $rc >> 8 );
116 my $allservices_rdbs="";
122 sub registerServices
() {
125 # ensure that services can not be instantiated
126 foreach $service ( keys %services ) {
127 # ensure that the current service is not reachable
128 unregisterService
($service);
129 $rc = !testForServices
([$service], "", $testexe);
131 $comment = $comment . "\tcouldn't unregister service " . $service . "\n";
136 # register the service and ensure that it is reachable
137 $rc = registerService
($services{$service}, $service . '.rdb');
139 $comment = $comment . "\tcouldn't register service " . $service . "\n";
143 $rc = testForServices
([$service], "-env:UNO_SERVICES=" . $service . ".rdb", $testexe);
145 $comment = $comment . "\tcouldn't reach service " . $service . "\n";
149 # memorize all services
150 if (length($allservices_rdbs)) {
151 $allservices_rdbs = $allservices_rdbs . " ";
153 $allservices_rdbs = $allservices_rdbs . "file://" . getcwd
() . "/" . $service . ".rdb";
154 push @allservices, $service;
158 sub testIndirection
() {
160 $rc = testForServices
(['com.sun.star.uno.NamingService'], '-env:UNO_SERVICES=${testrc:Tests:TestKey1}', $testexe);
162 $comment = $comment . "\tindirection test not passed\n";
168 sub testBeneathExe
() {
169 my $service = 'com.sun.star.reflection.CoreReflection';
172 my @_exes = (extendProgName
(".exe"),
173 extendProgName
(".Exe"),
174 extendProgName
(".bin"),
175 extendProgName
(".Bin"));
177 foreach $_testexe ( @_exes ) {
178 #test rdb found beneath executable
179 registerService
($services{$service}, $progname . "_services.rdb");
180 my $_rc = testForServices
([$service], "", $_testexe);
182 $comment = $comment . "\tbeneath executable test not passed: " . $_testexe . "\n";
188 sub testBeneathLib_rdb
() {
189 my $_service = 'com.sun.star.uno.NamingService';
195 if ($ENV{GUI
} eq "WNT") {
196 $_rdb_name = "UNO" . "_services.rdb";
199 $_rdb_name = "../lib/UNO" . "_services.rdb";
202 registerService
($services{$_service}, $_rdb_name);
203 my $_rc = UNO
::tryService
($_service);
205 $comment = $comment . "\tbeneath lib test not passed\n";
211 sub testBeneathLib_rc
() {
212 my $_service = 'com.sun.star.uno.NamingService';
218 if ($ENV{GUI
} eq "WNT") {
219 $_rc_name = "UNO.ini";
222 $_rc_name = "../lib/UNOrc";
225 my $_rdb_name = "../lib/test.rdb";
228 open $_handle, ">" . $_rc_name;
229 print $_handle "UNO_SERVICES=" . $_rdb_name . "\n";
232 registerService
($services{$_service}, $_rdb_name);
233 my $_rc = UNO
::tryService
($_service);
235 $comment = $comment . "\tbeneath lib rc test not passed\n";
242 sub testAllAvailable
() {
243 # test that all services are reachable through different rdbs
244 # change the directory to ensure, that all paths become expanded
247 $rc = testForServices
(\
@allservices, "-env:UNO_SERVICES=" . $allservices_rdbs, $testexe);
249 $comment = $comment . "\tmulti rdb test not passed\n";
254 $testexe = extendProgName
($defExeExt);
258 #print "alls:", @allservices, $allservices_rdbs, "\n";
263 testBeneathLib_rdb
();
266 print "**************************\n";
268 print "****** tests passed ******\n";
271 print "**** tests NOT passed ****\n";
272 print "Commnent:\n", $comment, "\n";
274 print "**************************\n";