bump product version to 5.0.4.1
[LibreOffice.git] / sal / test / bootstrap.pl
blobc14a5f73e4af3ced1fcb98b350945f0e5c8ee546
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
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 my $rc;
24 my $state = 1;
25 my $comment = "";
27 $ENV{MYBOOTSTRAPTESTVALUE}=0;
29 $rc = system "./testbootstrap", 1, "-env:MYBOOTSTRAPTESTVALUE=1";
30 if (!$rc) {
31 $comment = $comment . "commandline over environment test not passed\n";
32 $state = 0;
35 $rc = system "./testbootstrap", "0", "-env:INIFILENAME=";
36 if (!$rc) {
37 $comment = $comment . "exe custom ini test not passed\n";
38 $state = 0;
41 delete $ENV{MYBOOTSTRAPTESTVALUE};
43 $rc = system "./testbootstrap.bin", "file";
44 if (!$rc) {
45 $comment = $comment . "extensions cut test not passed with .bin\n";
46 $state = 0;
49 $rc = system "./testbootstrap.Bin", "file";
50 if (!$rc) {
51 $comment = $comment . "extensions cut test not passed with .Bin\n";
52 $state = 0;
55 $rc = system "./testbootstrap.exe", "file";
56 if (!$rc) {
57 $comment = $comment . "extensions cut test not passed with .exe\n";
58 $state = 0;
61 $rc = system "./testbootstrap.Exe", "file";
62 if (!$rc) {
63 $comment = $comment . "extensions cut test not passed with .Exe\n";
64 $state = 0;
67 if ($ENV{OS} eq "WNT") {
68 $rc = system "./testbootstrap", "auxaux", "-env:iniName=ini.ini", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
70 else {
71 $rc = system "./testbootstrap", "auxaux", "-env:iniName=inirc", '-env:MYBOOTSTRAPTESTVALUE=$CUSTOMINIVALUE';
73 if (!$rc) {
74 $comment = $comment . "custom ini test not passed\n";
75 $state = 0;
78 if ($ENV{OS} eq "WNT") {
79 $comment = $comment . '$SYSUSERHOME not testable under windows' . "\n";
81 else {
82 $rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERHOME';
83 if (!$rc) {
84 $comment = $comment . '$SYSUSERHOME test not passed' . "\n";
85 $state = 0;
89 if ($ENV{OS} eq "WNT") {
90 $comment = $comment . '$SYSUSERCONFIG' . " not testable under windows\n";
92 else {
93 $rc = system "./testbootstrap", "file://$ENV{HOME}", '-env:MYBOOTSTRAPTESTVALUE=$SYSUSERCONFIG';
94 if (!$rc) {
95 $comment = $comment . '$SYSUSERCONFIG test not passed' . "\n";
96 $state = 0;
100 if ($ENV{OS} eq "WNT") {
101 $comment = $comment . '$SYSBINDIR' . " not testable under windows\n";
103 else {
104 $rc = system "./testbootstrap", "file://$ENV{PWD}", '-env:MYBOOTSTRAPTESTVALUE=$SYSBINDIR';
105 if (!$rc) {
106 $comment = $comment . '$SYSBINDIR test not passed' . "\n";
107 $state = 0;
111 if ($ENV{OS} eq "WNT") {
112 $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=ini.ini";
114 else {
115 $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=inirc";
117 if (!$rc) {
118 $comment = $comment . "inherited value not passed\n";
119 $state = 0;
122 if ($ENV{OS} eq "WNT") {
123 $rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=ini.ini";
125 else {
126 $rc = system "./testbootstrap", "not_overwritten", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=inirc";
128 if (!$rc) {
129 $comment = $comment . "inherited overwritten value not passed\n";
130 $state = 0;
134 $rc = system "./testbootstrap", "defaultvalue", "-env:INIFILENAME=", "-env:Default=defaultvalue", "-env:USEDEFAULT=1";
135 if (!$rc) {
136 $comment = $comment . "default test from parameter not passed\n";
137 $state = 0;
140 if ($ENV{OS} eq "WNT") {
141 $rc = system "./testbootstrap", "defaultValue", "-env:iniName=default.ini", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
143 else {
144 $rc = system "./testbootstrap", "defaultValue", "-env:iniName=defaultrc", "-env:INIFILENAME=", "-env:USEDEFAULT=1";
146 if (!$rc) {
147 $comment = $comment . "default test from custom ini not passed\n";
148 $state = 0;
151 # simple macro expansion
152 $rc = system "./testbootstrap",
153 "_first_second_third_",
154 "-env:FIRST=first",
155 "-env:SECOND=second",
156 "-env:THIRD=third",
157 '-env:MYBOOTSTRAPTESTVALUE=_${FIRST}_${SECOND}_${THIRD}_';
158 if (!$rc) {
159 $comment = $comment . "simple macro expansion test not passed\n";
160 $state = 0;
163 # simple quoting
164 $rc = system "./testbootstrap",
165 '_${FIRST}_${SECOND}_${THIRD}_',
166 "-env:FIRST=first",
167 "-env:SECOND=second",
168 "-env:THIRD=third",
169 '-env:MYBOOTSTRAPTESTVALUE=_\$\{FIRST\}_\$\{SECOND\}_\$\{THIRD\}_';
170 if (!$rc) {
171 $comment = $comment . "simple macro quoting test not passed\n";
172 $state = 0;
175 # simple ini access
176 $rc = system "./testbootstrap",
177 "TheIniKeysValue",
178 '-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheIniKey}';
179 if (!$rc) {
180 $comment = $comment . "simple macro ini access test not passed\n";
181 $state = 0;
184 # simple profile access
185 $rc = system "./testbootstrap",
186 "TheKeysValue",
187 '-env:MYBOOTSTRAPTESTVALUE=${./bootstraptest.ini:TheSection:TheKey}';
188 if (!$rc) {
189 $comment = $comment . "simple macro profile access test not passed\n";
190 $state = 0;
193 # profile access with simple macro expansion
194 $rc = system "./testbootstrap",
195 "TheKeysValue",
196 "-env:ININAME=./bootstraptest.ini",
197 "-env:SECTIONNAME=TheSection",
198 "-env:KEYNAME=TheKey",
199 '-env:MYBOOTSTRAPTESTVALUE=${$ININAME:$SECTIONNAME:$KEYNAME}';
200 if (!$rc) {
201 $comment = $comment . "profile access with simple macro expansion test not passed\n";
202 $state = 0;
205 # profile access with complex macro expansion
206 $rc = system "./testbootstrap",
207 "TheKeysValue",
208 "-env:ININAME=./bootstraptest.ini",
209 '-env:MYBOOTSTRAPTESTVALUE=${$ININAME:${$ININAME:SecondSection:IndirectSection}:${$ININAME:SecondSection:IndirectKey}}';
210 if (!$rc) {
211 $comment = $comment . "profile access with complex macro expansion test not passed\n";
212 $state = 0;
215 # test no infinite recursion
216 if ($ENV{OS} eq "WNT") {
217 $rc = system "./testbootstrap",
218 '"***RECURSION DETECTED***"',
219 '-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
221 else {
222 $rc = system "./testbootstrap",
223 '***RECURSION DETECTED***',
224 '-env:MYBOOTSTRAPTESTVALUE=$MYBOOTSTRAPTESTVALUE';
226 if (!$rc) {
227 $comment = $comment . "no infinite recursion test not passed\n";
228 $state = 0;
231 # test unicode
232 $rc = system "./testbootstrap",
233 "AAABBBCCC000",
234 '-env:MYBOOTSTRAPTESTVALUE=\u0041\u0041\u0041\u0042\u0042\u0042\u0043\u0043\u0043\u0030\u0030\u0030';
235 if (!$rc) {
236 $comment = $comment . "uncode not passed\n";
237 $state = 0;
240 print "**************************\n";
241 if($state) {
242 print "****** tests passed ******\n";
244 else {
245 print "**** tests NOT passed ****\n";
246 print "Commnent:\n", $comment, "\n";
248 print "**************************\n";