Update ooo320-m1
[ooovba.git] / sal / test / bootstrap.pl
blobbc8e31627ad73356632dedab70d0f13f8056ebfd
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 #
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: bootstrap.pl,v $
14 # $Revision: 1.8 $
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 my $rc;
37 my $state = 1;
38 my $comment = "";
40 $ENV{MYBOOTSTRAPTESTVALUE}=0;
42 $rc = system "./testbootstrap", 1, "-env:MYBOOTSTRAPTESTVALUE=1";
43 if (!$rc) {
44 $comment = $comment . "commandline over environment test not passed\n";
45 $state = 0;
48 $rc = system "./testbootstrap", "0", "-env:INIFILENAME=";
49 if (!$rc) {
50 $comment = $comment . "exe custom ini test not passed\n";
51 $state = 0;
54 delete $ENV{MYBOOTSTRAPTESTVALUE};
56 $rc = system "./testbootstrap.bin", "file";
57 if (!$rc) {
58 $comment = $comment . "extensions cut test not passed with .bin\n";
59 $state = 0;
62 $rc = system "./testbootstrap.Bin", "file";
63 if (!$rc) {
64 $comment = $comment . "extensions cut test not passed with .Bin\n";
65 $state = 0;
68 $rc = system "./testbootstrap.exe", "file";
69 if (!$rc) {
70 $comment = $comment . "extensions cut test not passed with .exe\n";
71 $state = 0;
74 $rc = system "./testbootstrap.Exe", "file";
75 if (!$rc) {
76 $comment = $comment . "extensions cut test not passed with .Exe\n";
77 $state = 0;
80 if ($ENV{GUI} eq "WNT") {
81 $rc = system "./testbootstrap", "auxaux", "-env:iniName=ini.ini", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
83 else {
84 $rc = system "./testbootstrap", "auxaux", "-env:iniName=inirc", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
86 if (!$rc) {
87 $comment = $comment . "custom ini test not passed\n";
88 $state = 0;
91 if ($ENV{GUI} eq "WNT") {
92 $comment = $comment . '$SYSUSERHOME not testable under windows' . "\n";
94 else {
95 $rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERHOME';
96 if (!$rc) {
97 $comment = $comment . '$SYSUSERHOME test not passed' . "\n";
98 $state = 0;
102 if ($ENV{GUI} eq "WNT") {
103 $comment = $comment . '$SYSUSERCONFIG' . " not testable under windows\n";
105 else {
106 $rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERCONFIG';
107 if (!$rc) {
108 $comment = $comment . '$SYSUSERCONFIG test not passed' . "\n";
109 $state = 0;
113 if ($ENV{GUI} eq "WNT") {
114 $comment = $comment . '$SYSBINDIR' . " not testable under windows\n";
116 else {
117 $rc = system "./testbootstrap", "file://$ENV{PWD}", '-env:MYBOOTSTRAPTESTVALUE=$SYSBINDIR';
118 if (!$rc) {
119 $comment = $comment . '$SYSBINDIR test not passed' . "\n";
120 $state = 0;
124 if ($ENV{GUI} eq "WNT") {
125 $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=ini.ini";
127 else {
128 $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=inirc";
130 if (!$rc) {
131 $comment = $comment . "inherited value not passed\n";
132 $state = 0;
135 if ($ENV{GUI} eq "WNT") {
136 $rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=ini.ini";
138 else {
139 $rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=inirc";
141 if (!$rc) {
142 $comment = $comment . "inherited overwritten value not passed\n";
143 $state = 0;
147 $rc = system "./testbootstrap", "defaultvalue", "-env:INIFILENAME=", "-env:Default=defaultvalue", "-env:USEDEFAULT=1";
148 if (!$rc) {
149 $comment = $comment . "default test from parameter not passed\n";
150 $state = 0;
153 if ($ENV{GUI} eq "WNT") {
154 $rc = system "./testbootstrap", "defaultValue", "-env:iniName=default.ini", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
156 else {
157 $rc = system "./testbootstrap", "defaultValue", "-env:iniName=defaultrc", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
159 if (!$rc) {
160 $comment = $comment . "default test from custom ini not passed\n";
161 $state = 0;
164 # simple macro expansion
165 $rc = system "./testbootstrap",
166 "_first_second_third_",
167 "-env:FIRST=first",
168 "-env:SECOND=second",
169 "-env:THIRD=third",
170 '-env:MYBOOTSTRAPTESTVALUE=_${FIRST}_${SECOND}_${THIRD}_';
171 if (!$rc) {
172 $comment = $comment . "simple macro expansion test not passed\n";
173 $state = 0;
176 # simple quoting
177 $rc = system "./testbootstrap",
178 '_${FIRST}_${SECOND}_${THIRD}_',
179 "-env:FIRST=first",
180 "-env:SECOND=second",
181 "-env:THIRD=third",
182 '-env:MYBOOTSTRAPTESTVALUE=_\$\{FIRST\}_\$\{SECOND\}_\$\{THIRD\}_';
183 if (!$rc) {
184 $comment = $comment . "simple macro quoting test not passed\n";
185 $state = 0;
188 # simple ini access
189 $rc = system "./testbootstrap",
190 "TheIniKeysValue",
191 '-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheIniKey}';
192 if (!$rc) {
193 $comment = $comment . "simple macro ini access test not passed\n";
194 $state = 0;
197 # simple profile access
198 $rc = system "./testbootstrap",
199 "TheKeysValue",
200 '-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheSection:TheKey}';
201 if (!$rc) {
202 $comment = $comment . "simple macro profile access test not passed\n";
203 $state = 0;
206 # profile access with simple macro expansion
207 $rc = system "./testbootstrap",
208 "TheKeysValue",
209 "-env:ININAME=./bootstraptest.ini",
210 "-env:SECTIONNAME=TheSection",
211 "-env:KEYNAME=TheKey",
212 '-env:MYBOOTSTRAPTESTVALUE=${$ININAME:$SECTIONNAME:$KEYNAME}';
213 if (!$rc) {
214 $comment = $comment . "profile access with simple macro expansion test not passed\n";
215 $state = 0;
218 # profile access with complex macro expansion
219 $rc = system "./testbootstrap",
220 "TheKeysValue",
221 "-env:ININAME=./bootstraptest.ini",
222 '-env:MYBOOTSTRAPTESTVALUE=${$ININAME:${$ININAME:SecondSection:IndirectSection}:${$ININAME:SecondSection:IndirectKey}}';
223 if (!$rc) {
224 $comment = $comment . "profile access with complex macro expansion test not passed\n";
225 $state = 0;
228 # test no infinit recursion
229 if ($ENV{GUI} eq "WNT") {
230 $rc = system "./testbootstrap",
231 '"***RECURSION DETECTED***"',
232 '-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
234 else {
235 $rc = system "./testbootstrap",
236 '***RECURSION DETECTED***',
237 '-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
239 if (!$rc) {
240 $comment = $comment . "no infinit recursion test not passed\n";
241 $state = 0;
244 # test unicode
245 $rc = system "./testbootstrap",
246 "AAABBBCCC000",
247 '-env:MYBOOTSTRAPTESTVALUE=\u0041\u0041\u0041\u0042\u0042\u0042\u0043\u0043\u0043\u0030\u0030\u0030';
248 if (!$rc) {
249 $comment = $comment . "uncode not passed\n";
250 $state = 0;
253 print "**************************\n";
254 if($state) {
255 print "****** tests passed ******\n";
257 else {
258 print "**** tests NOT passed ****\n";
259 print "Commnent:\n", $comment, "\n";
261 print "**************************\n";