2001-07-24 06:20:32 -05:00
|
|
|
:
|
|
|
|
eval 'exec perl -wS $0 ${1+"$@"}'
|
|
|
|
if 0;
|
|
|
|
#*************************************************************************
|
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2010-02-12 08:01:35 -06:00
|
|
|
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# This file is part of OpenOffice.org.
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# 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.
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# 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).
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
2008-04-11 05:40:43 -05:00
|
|
|
# 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.
|
2001-07-24 06:20:32 -05:00
|
|
|
#
|
|
|
|
#*************************************************************************
|
|
|
|
|
|
|
|
#
|
|
|
|
# deliver.pl - copy from module output tree to solver
|
|
|
|
#
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
my $progname = "testdefaultbootstrapping";
|
|
|
|
my $defExeExt;
|
2001-07-24 06:20:32 -05:00
|
|
|
|
|
|
|
if ($ENV{GUI} eq "WNT") {
|
|
|
|
%services = (
|
2007-09-27 06:51:34 -05:00
|
|
|
'com.sun.star.uno.NamingService' => 'namingservice.uno.dll',
|
|
|
|
'com.sun.star.reflection.CoreReflection' => 'reflection.uno.dll',
|
|
|
|
'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.dll',
|
2001-07-24 06:20:32 -05:00
|
|
|
);
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
$defExeExt = ".exe";
|
2001-07-24 06:20:32 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
%services = (
|
2007-09-27 06:51:34 -05:00
|
|
|
'com.sun.star.uno.NamingService' => 'namingservice.uno.so',
|
|
|
|
'com.sun.star.reflection.CoreReflection' => 'reflection.uno.so',
|
|
|
|
'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.so'
|
2001-07-24 06:20:32 -05:00
|
|
|
);
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
$defExeExt = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub extendProgName($) {
|
|
|
|
my $_extension = shift;
|
|
|
|
my $_result;
|
|
|
|
|
|
|
|
if ($ENV{GUI} eq "WNT") {
|
|
|
|
$_result = $progname . $_extension;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$_result = $ENV{PWD} . "/" . $progname . $_extension;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub rmDefRDB() {
|
|
|
|
unlink $progname . "_services.rdb";
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub unregisterService($){
|
|
|
|
my $service_name = shift;
|
|
|
|
|
|
|
|
my $rdb_name = $service_name . '.rdb';
|
|
|
|
|
|
|
|
unlink $rdb_name;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
sub testForServices($$$) {
|
|
|
|
my $_services = shift;
|
|
|
|
my $_pars = shift;
|
|
|
|
my $_testexe = shift;
|
|
|
|
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
# my $_rc = system 'echo', $_testexe, @{$_services}, $_pars;
|
|
|
|
my $_rc = system $_testexe, @{$_services}, $_pars;
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
return $_rc >> 8;
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub registerService($$){
|
|
|
|
my $service_lib = shift;
|
2001-07-25 03:20:13 -05:00
|
|
|
my $rdb_name = shift;
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2006-12-01 10:19:52 -06:00
|
|
|
# system 'echo', "regcomp -register -r " . $rdb_name . " -c $service_lib";
|
2001-07-24 06:20:32 -05:00
|
|
|
my $rc = system "regcomp -register -r " . $rdb_name . " -c $service_lib";
|
|
|
|
|
2006-12-01 10:19:52 -06:00
|
|
|
|
2001-07-24 06:20:32 -05:00
|
|
|
return ! ( $rc >> 8 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $state = 1;
|
|
|
|
my @allservices;
|
2006-12-01 10:19:52 -06:00
|
|
|
my $allservices_rdbs="";
|
2001-07-24 06:20:32 -05:00
|
|
|
my $rc;
|
|
|
|
my $comment;
|
2001-07-25 03:20:13 -05:00
|
|
|
my $testexe;
|
2001-07-24 06:20:32 -05:00
|
|
|
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
sub registerServices() {
|
2006-12-01 10:19:52 -06:00
|
|
|
use Cwd;
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
# ensure that services can not be instantiated
|
|
|
|
foreach $service ( keys %services ) {
|
|
|
|
# ensure that the current service is not reachable
|
|
|
|
unregisterService($service);
|
|
|
|
$rc = !testForServices([$service], "", $testexe);
|
|
|
|
if(!$rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tcouldn't unregister service " . $service . "\n";
|
2001-07-25 03:20:13 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# register the service and ensure that it is reachable
|
|
|
|
$rc = registerService($services{$service}, $service . '.rdb');
|
|
|
|
if(!$rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tcouldn't register service " . $service . "\n";
|
2001-07-25 03:20:13 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$rc = testForServices([$service], "-env:UNO_SERVICES=" . $service . ".rdb", $testexe);
|
|
|
|
if(!$rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tcouldn't reach service " . $service . "\n";
|
2001-07-25 03:20:13 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
# memorize all services
|
2006-12-01 10:19:52 -06:00
|
|
|
if (length($allservices_rdbs)) {
|
|
|
|
$allservices_rdbs = $allservices_rdbs . " ";
|
|
|
|
}
|
|
|
|
$allservices_rdbs = $allservices_rdbs . "file://" . getcwd() . "/" . $service . ".rdb";
|
2001-07-25 03:20:13 -05:00
|
|
|
push @allservices, $service;
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
2001-07-25 03:20:13 -05:00
|
|
|
}
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
sub testIndirection() {
|
|
|
|
#test indirection
|
2006-12-01 10:19:52 -06:00
|
|
|
$rc = testForServices(['com.sun.star.uno.NamingService'], '-env:UNO_SERVICES=${testrc:Tests:TestKey1}', $testexe);
|
2001-07-25 03:20:13 -05:00
|
|
|
if (!$rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tindirection test not passed\n";
|
2001-07-24 06:20:32 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
sub testBeneathExe() {
|
2006-12-01 10:19:52 -06:00
|
|
|
my $service = 'com.sun.star.reflection.CoreReflection';
|
2001-07-25 03:20:13 -05:00
|
|
|
my $_testexe;
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
my @_exes = (extendProgName(".exe"),
|
|
|
|
extendProgName(".Exe"),
|
|
|
|
extendProgName(".bin"),
|
|
|
|
extendProgName(".Bin"));
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
foreach $_testexe ( @_exes ) {
|
|
|
|
#test rdb found beneath executable
|
|
|
|
registerService($services{$service}, $progname . "_services.rdb");
|
|
|
|
my $_rc = testForServices([$service], "", $_testexe);
|
|
|
|
if (!$_rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tbeneath executable test not passed: " . $_testexe . "\n";
|
2001-07-25 03:20:13 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
}
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
|
|
|
|
2001-09-03 08:28:17 -05:00
|
|
|
sub testBeneathLib_rdb() {
|
2006-12-01 10:19:52 -06:00
|
|
|
my $_service = 'com.sun.star.uno.NamingService';
|
2001-09-03 08:28:17 -05:00
|
|
|
|
|
|
|
use UNO;
|
|
|
|
|
|
|
|
my $_rdb_name;
|
|
|
|
|
|
|
|
if ($ENV{GUI} eq "WNT") {
|
|
|
|
$_rdb_name = "UNO" . "_services.rdb";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$_rdb_name = "../lib/UNO" . "_services.rdb";
|
|
|
|
}
|
|
|
|
|
|
|
|
registerService($services{$_service}, $_rdb_name);
|
|
|
|
my $_rc = UNO::tryService($_service);
|
|
|
|
if (!$_rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tbeneath lib test not passed\n";
|
2001-09-03 08:28:17 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
unlink $_rdb_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub testBeneathLib_rc() {
|
2006-12-01 10:19:52 -06:00
|
|
|
my $_service = 'com.sun.star.uno.NamingService';
|
2001-09-03 08:28:17 -05:00
|
|
|
|
|
|
|
use UNO;
|
|
|
|
|
|
|
|
my $_rc_name;
|
|
|
|
|
|
|
|
if ($ENV{GUI} eq "WNT") {
|
|
|
|
$_rc_name = "UNO.ini";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$_rc_name = "../lib/UNOrc";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $_rdb_name = "../lib/test.rdb";
|
|
|
|
|
|
|
|
my $_handle;
|
|
|
|
open $_handle, ">" . $_rc_name;
|
|
|
|
print $_handle "UNO_SERVICES=" . $_rdb_name . "\n";
|
|
|
|
close $_handle;
|
|
|
|
|
|
|
|
registerService($services{$_service}, $_rdb_name);
|
|
|
|
my $_rc = UNO::tryService($_service);
|
|
|
|
if (!$_rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tbeneath lib rc test not passed\n";
|
2001-09-03 08:28:17 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
|
|
|
unlink $_rdb_name;
|
|
|
|
unlink $_rc_name;
|
|
|
|
}
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
sub testAllAvailable() {
|
|
|
|
# test that all services are reachable through different rdbs
|
|
|
|
# change the directory to ensure, that all paths become expanded
|
|
|
|
chdir "..";
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
$rc = testForServices(\@allservices, "-env:UNO_SERVICES=" . $allservices_rdbs, $testexe);
|
|
|
|
if (!$rc) {
|
2006-12-01 10:19:52 -06:00
|
|
|
$comment = $comment . "\tmulti rdb test not passed\n";
|
2001-07-25 03:20:13 -05:00
|
|
|
$state = 0;
|
|
|
|
}
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
$testexe = extendProgName($defExeExt);
|
|
|
|
|
|
|
|
rmDefRDB();
|
|
|
|
registerServices();
|
|
|
|
#print "alls:", @allservices, $allservices_rdbs, "\n";
|
2001-07-24 06:20:32 -05:00
|
|
|
|
2001-07-25 03:20:13 -05:00
|
|
|
testIndirection();
|
|
|
|
testBeneathExe();
|
2001-09-03 08:28:17 -05:00
|
|
|
testBeneathLib_rc();
|
|
|
|
testBeneathLib_rdb();
|
2001-07-25 03:20:13 -05:00
|
|
|
testAllAvailable();
|
2001-07-24 06:20:32 -05:00
|
|
|
|
|
|
|
print "**************************\n";
|
|
|
|
if($state) {
|
|
|
|
print "****** tests passed ******\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print "**** tests NOT passed ****\n";
|
2001-09-03 08:28:17 -05:00
|
|
|
print "Commnent:\n", $comment, "\n";
|
2001-07-24 06:20:32 -05:00
|
|
|
}
|
|
|
|
print "**************************\n";
|
|
|
|
|
|
|
|
|
|
|
|
|