2 eval 'exec perl -wS $0 ${1+"$@"}'
5 # This file is part of the LibreOffice project.
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distributed with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # This file incorporates work covered by the following license notice:
13 # Licensed to the Apache Software Foundation (ASF) under one or more
14 # contributor license agreements. See the NOTICE file distributed
15 # with this work for additional information regarding copyright
16 # ownership. The ASF licenses this file to you under the Apache
17 # License, Version 2.0 (the "License"); you may not use this file
18 # except in compliance with the License. You may obtain a copy of
19 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 # deliver.pl - copy from module output tree to solver
26 my $progname = "testdefaultbootstrapping";
29 if ($ENV{OS
} eq "WNT") {
31 'com.sun.star.uno.NamingService' => 'namingservice.uno.dll',
32 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.dll',
33 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.dll',
41 'com.sun.star.uno.NamingService' => 'namingservice.uno.so',
42 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.so',
43 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.so'
49 sub extendProgName
($) {
50 my $_extension = shift;
53 if ($ENV{OS
} eq "WNT") {
54 $_result = $progname . $_extension;
57 $_result = $ENV{PWD
} . "/" . $progname . $_extension;
65 unlink $progname . "_services.rdb";
69 sub unregisterService
($){
70 my $service_name = shift;
72 my $rdb_name = $service_name . '.rdb';
79 sub testForServices
($$$) {
80 my $_services = shift;
85 # my $_rc = system 'echo', $_testexe, @{$_services}, $_pars;
86 my $_rc = system $_testexe, @
{$_services}, $_pars;
92 sub registerService
($$){
93 my $service_lib = shift;
96 # system 'echo', "regcomp -register -r " . $rdb_name . " -c $service_lib";
97 my $rc = system "regcomp -register -r " . $rdb_name . " -c $service_lib";
100 return ! ( $rc >> 8 );
107 my $allservices_rdbs="";
113 sub registerServices
() {
116 # ensure that services can not be instantiated
117 foreach $service ( keys %services ) {
118 # ensure that the current service is not reachable
119 unregisterService
($service);
120 $rc = !testForServices
([$service], "", $testexe);
122 $comment = $comment . "\tcouldn't unregister service " . $service . "\n";
127 # register the service and ensure that it is reachable
128 $rc = registerService
($services{$service}, $service . '.rdb');
130 $comment = $comment . "\tcouldn't register service " . $service . "\n";
134 $rc = testForServices
([$service], "-env:UNO_SERVICES=" . $service . ".rdb", $testexe);
136 $comment = $comment . "\tcouldn't reach service " . $service . "\n";
140 # memorize all services
141 if (length($allservices_rdbs)) {
142 $allservices_rdbs = $allservices_rdbs . " ";
144 $allservices_rdbs = $allservices_rdbs . "file://" . getcwd
() . "/" . $service . ".rdb";
145 push @allservices, $service;
149 sub testIndirection
() {
151 $rc = testForServices
(['com.sun.star.uno.NamingService'], '-env:UNO_SERVICES=${testrc:Tests:TestKey1}', $testexe);
153 $comment = $comment . "\tindirection test not passed\n";
159 sub testBeneathExe
() {
160 my $service = 'com.sun.star.reflection.CoreReflection';
163 my @_exes = (extendProgName
(".exe"),
164 extendProgName
(".Exe"),
165 extendProgName
(".bin"),
166 extendProgName
(".Bin"));
168 foreach $_testexe ( @_exes ) {
169 #test rdb found beneath executable
170 registerService
($services{$service}, $progname . "_services.rdb");
171 my $_rc = testForServices
([$service], "", $_testexe);
173 $comment = $comment . "\tbeneath executable test not passed: " . $_testexe . "\n";
179 sub testBeneathLib_rdb
() {
180 my $_service = 'com.sun.star.uno.NamingService';
186 if ($ENV{OS
} eq "WNT") {
187 $_rdb_name = "UNO" . "_services.rdb";
190 $_rdb_name = "../lib/UNO" . "_services.rdb";
193 registerService
($services{$_service}, $_rdb_name);
194 my $_rc = UNO
::tryService
($_service);
196 $comment = $comment . "\tbeneath lib test not passed\n";
202 sub testBeneathLib_rc
() {
203 my $_service = 'com.sun.star.uno.NamingService';
209 if ($ENV{OS
} eq "WNT") {
210 $_rc_name = "UNO.ini";
213 $_rc_name = "../lib/UNOrc";
216 my $_rdb_name = "../lib/test.rdb";
219 open $_handle, ">" . $_rc_name;
220 print $_handle "UNO_SERVICES=" . $_rdb_name . "\n";
223 registerService
($services{$_service}, $_rdb_name);
224 my $_rc = UNO
::tryService
($_service);
226 $comment = $comment . "\tbeneath lib rc test not passed\n";
233 sub testAllAvailable
() {
234 # test that all services are reachable through different rdbs
235 # change the directory to ensure, that all paths become expanded
238 $rc = testForServices
(\
@allservices, "-env:UNO_SERVICES=" . $allservices_rdbs, $testexe);
240 $comment = $comment . "\tmulti rdb test not passed\n";
245 $testexe = extendProgName
($defExeExt);
249 #print "alls:", @allservices, $allservices_rdbs, "\n";
254 testBeneathLib_rdb
();
257 print "**************************\n";
259 print "****** tests passed ******\n";
262 print "**** tests NOT passed ****\n";
263 print "Commnent:\n", $comment, "\n";
265 print "**************************\n";