xref: /aoo41x/main/sal/test/bootstrap.pl (revision cdf0e10c)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4#*************************************************************************
5#
6# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7#
8# Copyright 2000, 2010 Oracle and/or its affiliates.
9#
10# OpenOffice.org - a multi-platform office productivity suite
11#
12# This file is part of OpenOffice.org.
13#
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.
17#
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).
23#
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.
28#
29#*************************************************************************
30
31
32my $rc;
33my $state = 1;
34my $comment = "";
35
36$ENV{MYBOOTSTRAPTESTVALUE}=0;
37
38$rc = system "./testbootstrap", 1, "-env:MYBOOTSTRAPTESTVALUE=1";
39if (!$rc) {
40	$comment = $comment . "commandline over environment test not passed\n";
41	$state = 0;
42}
43
44$rc = system "./testbootstrap", "0", "-env:INIFILENAME=";
45if (!$rc) {
46	$comment = $comment . "exe custom ini test not passed\n";
47	$state = 0;
48}
49
50delete $ENV{MYBOOTSTRAPTESTVALUE};
51
52$rc = system "./testbootstrap.bin", "file";
53if (!$rc) {
54	$comment = $comment . "extensions cut test not passed with .bin\n";
55	$state = 0;
56}
57
58$rc = system "./testbootstrap.Bin", "file";
59if (!$rc) {
60	$comment = $comment . "extensions cut test not passed with .Bin\n";
61	$state = 0;
62}
63
64$rc = system "./testbootstrap.exe", "file";
65if (!$rc) {
66	$comment = $comment . "extensions cut test not passed with .exe\n";
67	$state = 0;
68}
69
70$rc = system "./testbootstrap.Exe", "file";
71if (!$rc) {
72	$comment = $comment . "extensions cut test not passed with .Exe\n";
73	$state = 0;
74}
75
76if ($ENV{GUI} eq "WNT") {
77	$rc = system "./testbootstrap", "auxaux", "-env:iniName=ini.ini", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
78}
79else {
80	$rc = system "./testbootstrap", "auxaux", "-env:iniName=inirc", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
81}
82if (!$rc) {
83	$comment = $comment . "custom ini test not passed\n";
84	$state = 0;
85}
86
87if ($ENV{GUI} eq "WNT") {
88	$comment = $comment . '$SYSUSERHOME not testable under windows' . "\n";
89}
90else {
91	$rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERHOME';
92	if (!$rc) {
93		$comment = $comment . '$SYSUSERHOME test not passed' . "\n";
94		$state = 0;
95	}
96}
97
98if ($ENV{GUI} eq "WNT") {
99	$comment = $comment . '$SYSUSERCONFIG' . " not testable under windows\n";
100}
101else {
102	$rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERCONFIG';
103	if (!$rc) {
104		$comment = $comment . '$SYSUSERCONFIG test not passed' . "\n";
105		$state = 0;
106	}
107}
108
109if ($ENV{GUI} eq "WNT") {
110	$comment = $comment . '$SYSBINDIR' . " not testable under windows\n";
111}
112else {
113	$rc = system "./testbootstrap", "file://$ENV{PWD}", '-env:MYBOOTSTRAPTESTVALUE=$SYSBINDIR';
114	if (!$rc) {
115		$comment = $comment . '$SYSBINDIR test not passed' . "\n";
116		$state = 0;
117	}
118}
119
120if ($ENV{GUI} eq "WNT") {
121	$rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=ini.ini";
122}
123else {
124	$rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=inirc";
125}
126if (!$rc) {
127	$comment = $comment . "inherited value not passed\n";
128	$state = 0;
129}
130
131if ($ENV{GUI} eq "WNT") {
132	$rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=ini.ini";
133}
134else {
135	$rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=inirc";
136}
137if (!$rc) {
138	$comment = $comment . "inherited overwritten value not passed\n";
139	$state = 0;
140}
141
142
143$rc = system "./testbootstrap", "defaultvalue", "-env:INIFILENAME=", "-env:Default=defaultvalue", "-env:USEDEFAULT=1";
144if (!$rc) {
145	$comment = $comment . "default test from parameter not passed\n";
146	$state = 0;
147}
148
149if ($ENV{GUI} eq "WNT") {
150	$rc = system "./testbootstrap",  "defaultValue", "-env:iniName=default.ini", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
151}
152else {
153	$rc = system "./testbootstrap",  "defaultValue", "-env:iniName=defaultrc", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
154}
155if (!$rc) {
156	$comment = $comment . "default test from custom ini not passed\n";
157	$state = 0;
158}
159
160# simple macro expansion
161$rc = system "./testbootstrap",
162	"_first_second_third_",
163	"-env:FIRST=first",
164	"-env:SECOND=second",
165	"-env:THIRD=third",
166	'-env:MYBOOTSTRAPTESTVALUE=_${FIRST}_${SECOND}_${THIRD}_';
167if (!$rc) {
168	$comment = $comment . "simple macro expansion test not passed\n";
169	$state = 0;
170}
171
172# simple quoting
173$rc = system "./testbootstrap",
174	'_${FIRST}_${SECOND}_${THIRD}_',
175	"-env:FIRST=first",
176	"-env:SECOND=second",
177	"-env:THIRD=third",
178	'-env:MYBOOTSTRAPTESTVALUE=_\$\{FIRST\}_\$\{SECOND\}_\$\{THIRD\}_';
179if (!$rc) {
180	$comment = $comment . "simple macro quoting test not passed\n";
181	$state = 0;
182}
183
184# simple ini access
185$rc = system "./testbootstrap",
186	"TheIniKeysValue",
187	'-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheIniKey}';
188if (!$rc) {
189	$comment = $comment . "simple macro ini access test not passed\n";
190	$state = 0;
191}
192
193# simple profile access
194$rc = system "./testbootstrap",
195	"TheKeysValue",
196	'-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheSection:TheKey}';
197if (!$rc) {
198	$comment = $comment . "simple macro profile access test not passed\n";
199	$state = 0;
200}
201
202# profile access with simple macro expansion
203$rc = system "./testbootstrap",
204	"TheKeysValue",
205	"-env:ININAME=./bootstraptest.ini",
206	"-env:SECTIONNAME=TheSection",
207	"-env:KEYNAME=TheKey",
208	'-env:MYBOOTSTRAPTESTVALUE=${$ININAME:$SECTIONNAME:$KEYNAME}';
209if (!$rc) {
210	$comment = $comment . "profile access with simple macro expansion test not passed\n";
211	$state = 0;
212}
213
214# profile access with complex macro expansion
215$rc = system "./testbootstrap",
216	"TheKeysValue",
217	"-env:ININAME=./bootstraptest.ini",
218	'-env:MYBOOTSTRAPTESTVALUE=${$ININAME:${$ININAME:SecondSection:IndirectSection}:${$ININAME:SecondSection:IndirectKey}}';
219if (!$rc) {
220	$comment = $comment . "profile access with complex macro expansion test not passed\n";
221	$state = 0;
222}
223
224# test no infinit recursion
225if ($ENV{GUI} eq "WNT") {
226	$rc = system "./testbootstrap",
227	'"***RECURSION DETECTED***"',
228	'-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
229}
230else {
231	$rc = system "./testbootstrap",
232	'***RECURSION DETECTED***',
233	'-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
234}
235if (!$rc) {
236	$comment = $comment . "no infinit recursion test not passed\n";
237	$state = 0;
238}
239
240# test unicode
241$rc = system "./testbootstrap",
242	"AAABBBCCC000",
243	'-env:MYBOOTSTRAPTESTVALUE=\u0041\u0041\u0041\u0042\u0042\u0042\u0043\u0043\u0043\u0030\u0030\u0030';
244if (!$rc) {
245	$comment = $comment . "uncode not passed\n";
246	$state = 0;
247}
248
249print "**************************\n";
250if($state) {
251	print "****** tests passed ******\n";
252}
253else {
254	print "**** tests NOT passed ****\n";
255	print "Commnent:\n", $comment, "\n";
256}
257print "**************************\n";
258
259
260
261