1*87d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*87d2adbcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*87d2adbcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*87d2adbcSAndrew Rist * distributed with this work for additional information
6*87d2adbcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*87d2adbcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*87d2adbcSAndrew Rist * "License"); you may not use this file except in compliance
9*87d2adbcSAndrew Rist * with the License. You may obtain a copy of the License at
10*87d2adbcSAndrew Rist *
11*87d2adbcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*87d2adbcSAndrew Rist *
13*87d2adbcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*87d2adbcSAndrew Rist * software distributed under the License is distributed on an
15*87d2adbcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87d2adbcSAndrew Rist * KIND, either express or implied. See the License for the
17*87d2adbcSAndrew Rist * specific language governing permissions and limitations
18*87d2adbcSAndrew Rist * under the License.
19*87d2adbcSAndrew Rist *
20*87d2adbcSAndrew Rist *************************************************************/
21*87d2adbcSAndrew Rist
22*87d2adbcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sal.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // Documentation about bootstraping can be found at:
28cdf0e10cSrcweir // http://udk.openoffice.org/common/man/concept/micro_deployment.html
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <math.h>
31cdf0e10cSrcweir #include <stdio.h>
32cdf0e10cSrcweir #include <stdlib.h>
33cdf0e10cSrcweir #include <algorithm> // STL
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include "testshl/stringhelper.hxx"
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <testshl/simpleheader.hxx>
38cdf0e10cSrcweir //#include "stringhelper.hxx"
39cdf0e10cSrcweir //#include "valueequal.hxx"
40cdf0e10cSrcweir #include <rtl/bootstrap.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
43cdf0e10cSrcweir #include <rtl/ustring.h>
44cdf0e10cSrcweir #include <rtl/ustring.hxx>
45cdf0e10cSrcweir #include <osl/file.hxx>
46cdf0e10cSrcweir #include <osl/module.hxx>
47cdf0e10cSrcweir #include <osl/process.h> /* osl_getExecutableFile() */
48cdf0e10cSrcweir
49cdf0e10cSrcweir #include <osl/thread.hxx>
50cdf0e10cSrcweir
51cdf0e10cSrcweir // using namespace osl;
52cdf0e10cSrcweir using namespace rtl;
53cdf0e10cSrcweir
54cdf0e10cSrcweir #define TESTSHL2_INI "testshl2"
55cdf0e10cSrcweir #define PSEUDO_INI "pseudo"
56cdf0e10cSrcweir
57cdf0e10cSrcweir /** print a UNI_CODE String. And also print some comments of the string.
58cdf0e10cSrcweir */
printUString(const::rtl::OUString & str,const sal_Char * msg="")59cdf0e10cSrcweir inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir
62cdf0e10cSrcweir if (strlen(msg) > 0)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir t_print("%s: ", msg );
65cdf0e10cSrcweir }
66cdf0e10cSrcweir rtl::OString aString;
67cdf0e10cSrcweir aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
68cdf0e10cSrcweir t_print("%s\n", (char *)aString.getStr( ) );
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir /** if the file exist
72cdf0e10cSrcweir */
t_fileExist(rtl::OUString const & _sFilename)73cdf0e10cSrcweir bool t_fileExist(rtl::OUString const& _sFilename)
74cdf0e10cSrcweir {
75cdf0e10cSrcweir ::osl::FileBase::RC nError1;
76cdf0e10cSrcweir ::osl::File aTestFile( _sFilename );
77cdf0e10cSrcweir nError1 = aTestFile.open ( OpenFlag_Read );
78cdf0e10cSrcweir if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir aTestFile.close( );
81cdf0e10cSrcweir return true;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir return false;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
86cdf0e10cSrcweir /** get the exectutable path ( here is bootstrap_process), on Linux, such as "sal/unxlngi4.pro/bin/"
87cdf0e10cSrcweir */
getModulePath(void)88cdf0e10cSrcweir inline ::rtl::OUString getModulePath( void )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir ::rtl::OUString suDirPath;
91cdf0e10cSrcweir ::osl::Module::getUrlFromAddress( ( oslGenericFunction ) &getModulePath, suDirPath );
92cdf0e10cSrcweir
93cdf0e10cSrcweir suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
94cdf0e10cSrcweir suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1);
95cdf0e10cSrcweir suDirPath += rtl::OUString::createFromAscii("bin");
96cdf0e10cSrcweir return suDirPath;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
99cdf0e10cSrcweir #define TESTSHL2_INI "testshl2"
100cdf0e10cSrcweir #define PSEUDO_INI "pseudo"
101cdf0e10cSrcweir
102cdf0e10cSrcweir
getExecutableDirectory()103cdf0e10cSrcweir static rtl::OUString getExecutableDirectory()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir rtl::OUString fileName;
106cdf0e10cSrcweir osl_getExecutableFile(&fileName.pData);
107cdf0e10cSrcweir
108cdf0e10cSrcweir sal_Int32 nDirEnd = fileName.lastIndexOf('/');
109cdf0e10cSrcweir
110cdf0e10cSrcweir OSL_ENSURE(nDirEnd >= 0, "Cannot locate executable directory");
111cdf0e10cSrcweir
112cdf0e10cSrcweir rtl::OUString aDirURL = fileName.copy(0, nDirEnd);
113cdf0e10cSrcweir return aDirURL;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
116cdf0e10cSrcweir
117cdf0e10cSrcweir // get the URL of testshl2rc/rtlrc/pseudorc
t_getSourcePath(rtl::OString const & _sFilename)118cdf0e10cSrcweir inline rtl::OUString t_getSourcePath(rtl::OString const& _sFilename)
119cdf0e10cSrcweir {
120cdf0e10cSrcweir
121cdf0e10cSrcweir rtl::OUString aDirURL(getExecutableDirectory());
122cdf0e10cSrcweir aDirURL += OUString::createFromAscii( "/");
123cdf0e10cSrcweir aDirURL += OUString::createFromAscii( _sFilename.getStr() );
124cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
125cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii(".ini");
126cdf0e10cSrcweir #else
127cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii("rc");
128cdf0e10cSrcweir #endif
129cdf0e10cSrcweir return aDirURL;
130cdf0e10cSrcweir
131cdf0e10cSrcweir // LLA: does not right work on my personal laptop, SRC_ROOT does not show where the source is :-(.
132cdf0e10cSrcweir /*
133cdf0e10cSrcweir sal_Char * pStr = getenv("SRC_ROOT");
134cdf0e10cSrcweir rtl::OUString suPath;
135cdf0e10cSrcweir if (filename != "")
136cdf0e10cSrcweir {
137cdf0e10cSrcweir suPath = rtl::OUString::createFromAscii(pStr) + rtl::OUString::createFromAscii( "/sal/qa/rtl/bootstrap/" )
138cdf0e10cSrcweir + rtl::OUString::createFromAscii( filename );
139cdf0e10cSrcweir }
140cdf0e10cSrcweir else
141cdf0e10cSrcweir {
142cdf0e10cSrcweir suPath = rtl::OUString::createFromAscii(pStr) + rtl::OUString::createFromAscii( "/sal/qa/rtl/bootstrap" );
143cdf0e10cSrcweir }
144cdf0e10cSrcweir rtl::OUString suURL;
145cdf0e10cSrcweir ::osl::FileBase::getFileURLFromSystemPath( suPath, suURL );
146cdf0e10cSrcweir return suURL;
147cdf0e10cSrcweir */
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
thread_sleep_tenth_sec(sal_Int32 _nTenthSec)150cdf0e10cSrcweir void thread_sleep_tenth_sec(sal_Int32 _nTenthSec)
151cdf0e10cSrcweir {
152cdf0e10cSrcweir #ifdef WNT //Windows
153cdf0e10cSrcweir Sleep(_nTenthSec * 100 );
154cdf0e10cSrcweir #endif
155cdf0e10cSrcweir #if ( defined UNX ) || ( defined OS2 ) //Unix
156cdf0e10cSrcweir TimeValue nTV;
157cdf0e10cSrcweir nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
158cdf0e10cSrcweir nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
159cdf0e10cSrcweir osl_waitThread(&nTV);
160cdf0e10cSrcweir #endif
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir // -----------------------------------------------------------------------------
164cdf0e10cSrcweir
165cdf0e10cSrcweir namespace rtl_Bootstrap
166cdf0e10cSrcweir {
167cdf0e10cSrcweir class ctor : public CppUnit::TestFixture
168cdf0e10cSrcweir {
169cdf0e10cSrcweir public:
170cdf0e10cSrcweir // initialise your test code values here.
setUp()171cdf0e10cSrcweir void setUp()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
tearDown()175cdf0e10cSrcweir void tearDown()
176cdf0e10cSrcweir {
177cdf0e10cSrcweir }
178cdf0e10cSrcweir
179cdf0e10cSrcweir // ctor with ini name
ctor_001()180cdf0e10cSrcweir void ctor_001()
181cdf0e10cSrcweir {
182cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
183cdf0e10cSrcweir printUString( suIniname );
184cdf0e10cSrcweir Bootstrap aBootstrap( suIniname );
185cdf0e10cSrcweir rtl::OUString suGetname; // = rtl::OUString::createFromAscii("");
186cdf0e10cSrcweir aBootstrap.getIniName( suGetname );
187cdf0e10cSrcweir printUString( suGetname );
188cdf0e10cSrcweir
189cdf0e10cSrcweir // LLA: first: this seems to be a wrong test.
190cdf0e10cSrcweir // second: there seems to be a design hole, if I give a absolute path ini file,
191cdf0e10cSrcweir // but try to use ${file::KEYVALUE} than 'file' will only used out of the 'executable path'/file
192cdf0e10cSrcweir // not from the path given from the absolute path.
193cdf0e10cSrcweir
194cdf0e10cSrcweir // Due to the fact, we create at this position a file (createTestshl2rc() ), we check for existance
195cdf0e10cSrcweir bool bFileExist = t_fileExist( suGetname );
196cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("ctor error with initial file.", bFileExist == true );
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
ctor_002()199cdf0e10cSrcweir void ctor_002()
200cdf0e10cSrcweir {
201cdf0e10cSrcweir rtl::Bootstrap aBootstrap;
202cdf0e10cSrcweir rtl::OUString suGetname;
203cdf0e10cSrcweir aBootstrap.getIniName( suGetname );
204cdf0e10cSrcweir printUString( suGetname );
205cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("ctor error without initial file.", suGetname.getLength() != 0 );
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
208cdf0e10cSrcweir CPPUNIT_TEST_SUITE(ctor);
209cdf0e10cSrcweir CPPUNIT_TEST(ctor_001);
210cdf0e10cSrcweir CPPUNIT_TEST(ctor_002);
211cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
212cdf0e10cSrcweir }; // class ctor
213cdf0e10cSrcweir
214cdf0e10cSrcweir class getFrom : public CppUnit::TestFixture
215cdf0e10cSrcweir {
216cdf0e10cSrcweir public:
217cdf0e10cSrcweir // initialise your test code values here.
setUp()218cdf0e10cSrcweir void setUp()
219cdf0e10cSrcweir {
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
tearDown()222cdf0e10cSrcweir void tearDown()
223cdf0e10cSrcweir {
224cdf0e10cSrcweir }
225cdf0e10cSrcweir // get the value of env variable
getFrom_001()226cdf0e10cSrcweir void getFrom_001()
227cdf0e10cSrcweir {
228cdf0e10cSrcweir Bootstrap aBootstrap;
229cdf0e10cSrcweir rtl::OUString suValue;
230cdf0e10cSrcweir rtl::OUString suValuename = rtl::OUString::createFromAscii( "SOLAR_JAVA" );
231cdf0e10cSrcweir //aBootstrap.getFrom( suValuename, suValue );
232cdf0e10cSrcweir aBootstrap.getFrom( suValuename, suValue );
233cdf0e10cSrcweir sal_Char * pStr = getenv("SOLAR_JAVA");
234cdf0e10cSrcweir // printUString( suGetname );
235cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("get the value of environment variable.", suValue.compareToAscii( pStr ) == 0 );
236cdf0e10cSrcweir }
237cdf0e10cSrcweir /* Notes on Windows:
238cdf0e10cSrcweir void getFrom_001_1()
239cdf0e10cSrcweir {
240cdf0e10cSrcweir Bootstrap aBootstrap;
241cdf0e10cSrcweir rtl::OUString suValue;
242cdf0e10cSrcweir rtl::OUString suValuename = rtl::OUString::createFromAscii( "SRC_ROOT" );
243cdf0e10cSrcweir //aBootstrap.getFrom( suValuename, suValue );
244cdf0e10cSrcweir aBootstrap.getFrom( suValuename, suValue );
245cdf0e10cSrcweir sal_Char * pStr = getenv("SRC_ROOT");
246cdf0e10cSrcweir // printUString( suGetname );
247cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("get the value of environment variable.", suValue.compareToAscii( pStr ) == 0 );
248cdf0e10cSrcweir }
249cdf0e10cSrcweir The result on Windows:
250cdf0e10cSrcweir # # the SRC_ROOT is e:\Qadev\cvs\m19
251cdf0e10cSrcweir # # suValue is e:Qadevcvsm19
252cdf0e10cSrcweir reason:
253cdf0e10cSrcweir The problem is that the internally getenv()ed variable SRC_ROOT is macro expanded,
254cdf0e10cSrcweir thus every \ will introduce an escape.
255cdf0e10cSrcweir */
256cdf0e10cSrcweir
257cdf0e10cSrcweir // get the value of a variable in ini file
getFrom_002()258cdf0e10cSrcweir void getFrom_002()
259cdf0e10cSrcweir {
260cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
261cdf0e10cSrcweir Bootstrap aBootstrap( suIniname );
262cdf0e10cSrcweir rtl::OUString suGetname;
263cdf0e10cSrcweir rtl::OUString suValuename = rtl::OUString::createFromAscii( "INHERITED_VALUE" );
264cdf0e10cSrcweir aBootstrap.getFrom( suValuename, suGetname );
265cdf0e10cSrcweir printUString( suGetname );
266cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("get the value of a variable in ini file.", suGetname.getLength() != 0 );
267cdf0e10cSrcweir }
268cdf0e10cSrcweir
269cdf0e10cSrcweir //use defaut value
getFrom_003()270cdf0e10cSrcweir void getFrom_003()
271cdf0e10cSrcweir {
272cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
273cdf0e10cSrcweir Bootstrap aBootstrap( suIniname );
274cdf0e10cSrcweir rtl::OUString suGetname;
275cdf0e10cSrcweir rtl::OUString suValuename = rtl::OUString::createFromAscii( "MY_VALUE" );
276cdf0e10cSrcweir rtl::OUString myDefault = rtl::OUString::createFromAscii( "2" );
277cdf0e10cSrcweir aBootstrap.getFrom( suValuename, suGetname, myDefault );
278cdf0e10cSrcweir //printUString( suGetname );
279cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("getFrom use default.", suGetname.compareTo( myDefault ) == 0 );
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
getFrom_004()282cdf0e10cSrcweir void getFrom_004()
283cdf0e10cSrcweir {
284cdf0e10cSrcweir t_print("1\n");
285cdf0e10cSrcweir // initialise Bootstrap with an own ini file
286cdf0e10cSrcweir // PSEUDO_INI is pseudo(rc|.ini) created be create_pseudorc()
287cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
288cdf0e10cSrcweir Bootstrap aBootstrap( suIniname );
289cdf0e10cSrcweir
290cdf0e10cSrcweir rtl::OUString suGetIniName;
291cdf0e10cSrcweir aBootstrap.getIniName( suGetIniName );
292cdf0e10cSrcweir
293cdf0e10cSrcweir printUString(suGetIniName, "Current bootstrap file");
294cdf0e10cSrcweir sal_Int32 nIndex = suGetIniName.indexOf(rtl::OUString::createFromAscii( "pseudo" ));
295cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("ini name must have 'pseudo' in name.", nIndex > 0);
296cdf0e10cSrcweir
297cdf0e10cSrcweir // rtlBootstrapHandle bsHandle = aBootstrap.getHandle();
298cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("getHandle return NULL!", bsHandle != 0);
299cdf0e10cSrcweir
300cdf0e10cSrcweir rtl::OUString suValue;
301cdf0e10cSrcweir rtl::OUString suKeyName = rtl::OUString::createFromAscii( "FILE" );
302cdf0e10cSrcweir aBootstrap.getFrom( suKeyName, suValue );
303cdf0e10cSrcweir printUString( suValue );
304cdf0e10cSrcweir sal_Int32 nCompare = suValue.compareTo( rtl::OUString::createFromAscii("pseudo file") );
305cdf0e10cSrcweir
306cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("<Bootstrap('pseudo')>.getFrom('FILE', ...) result is unexpected.", nCompare == 0);
307cdf0e10cSrcweir }
getFrom_004_1()308cdf0e10cSrcweir void getFrom_004_1()
309cdf0e10cSrcweir {
310cdf0e10cSrcweir // get the same key out of the default context
311cdf0e10cSrcweir rtl::OUString suKeyName = rtl::OUString::createFromAscii( "FILE" );
312cdf0e10cSrcweir rtl::OUString suGetValue;
313cdf0e10cSrcweir Bootstrap::get( suKeyName, suGetValue );
314cdf0e10cSrcweir printUString( suGetValue );
315cdf0e10cSrcweir
316cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Bootstrap::get('FILE', ...)", suGetValue.compareTo( rtl::OUString::createFromAscii("testshl2 file") ) == 0 );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir
319cdf0e10cSrcweir /** helper function: return the child process's ret value( typedef sal_uInt32 oslProcessExitCode;)
320cdf0e10cSrcweir * param1 is the process's name(only file name, not include path)
321cdf0e10cSrcweir */
ini_execProcess(const sal_Char * process_name,const sal_Char * flag)322cdf0e10cSrcweir oslProcessExitCode ini_execProcess( const sal_Char* process_name, const sal_Char * flag )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir rtl::OUString suCWD = getModulePath();
325cdf0e10cSrcweir oslProcess hProcess = NULL;
326cdf0e10cSrcweir rtl::OUString suFileURL = suCWD;
327cdf0e10cSrcweir suFileURL += rtl::OUString::createFromAscii("/") + rtl::OUString::createFromAscii(process_name) ;
328cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
329cdf0e10cSrcweir suFileURL += rtl::OUString::createFromAscii(".exe");
330cdf0e10cSrcweir #endif
331cdf0e10cSrcweir const int nParameterCount = 3;
332cdf0e10cSrcweir rtl_uString* pParameters[ nParameterCount ];
333cdf0e10cSrcweir OUString suFlag( OUString::createFromAscii(flag) );
334cdf0e10cSrcweir OUString suEnv1( OUString::createFromAscii("-env:UNO_SERVICES=service.rdb"));
335cdf0e10cSrcweir OUString suIniname = t_getSourcePath("rtl");
336cdf0e10cSrcweir printUString( suIniname, "rtl path:");
337cdf0e10cSrcweir //OUString suEnv2( OUString::createFromAscii("-env:MYENV=bootstrap_process"));
338cdf0e10cSrcweir
339cdf0e10cSrcweir pParameters[0] = suFlag.pData;
340cdf0e10cSrcweir pParameters[1] = suEnv1.pData;
341cdf0e10cSrcweir // the custom ini/rc file's URL
342cdf0e10cSrcweir pParameters[2] = suIniname.pData;
343cdf0e10cSrcweir
344cdf0e10cSrcweir oslProcessError osl_error = osl_executeProcess(
345cdf0e10cSrcweir suFileURL.pData,
346cdf0e10cSrcweir pParameters,
347cdf0e10cSrcweir nParameterCount,
348cdf0e10cSrcweir osl_Process_WAIT,
349cdf0e10cSrcweir 0,
350cdf0e10cSrcweir suCWD.pData,
351cdf0e10cSrcweir NULL,
352cdf0e10cSrcweir 0,
353cdf0e10cSrcweir &hProcess );
354cdf0e10cSrcweir
355cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE
356cdf0e10cSrcweir (
357cdf0e10cSrcweir "osl_createProcess failed",
358cdf0e10cSrcweir osl_error == osl_Process_E_None
359cdf0e10cSrcweir );
360cdf0e10cSrcweir osl_joinProcess(hProcess);
361cdf0e10cSrcweir oslProcessInfo* pInfo = new oslProcessInfo;
362cdf0e10cSrcweir pInfo->Size = sizeof( oslProcessInfo );
363cdf0e10cSrcweir osl_error = osl_getProcessInfo( hProcess, osl_Process_EXITCODE, pInfo );
364cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE
365cdf0e10cSrcweir (
366cdf0e10cSrcweir "osl_getProcessInfo returned with failure",
367cdf0e10cSrcweir osl_Process_E_None == osl_error
368cdf0e10cSrcweir );
369cdf0e10cSrcweir
370cdf0e10cSrcweir t_print("the exit code is %d.\n", pInfo->Code );
371cdf0e10cSrcweir oslProcessExitCode nCode = pInfo->Code;
372cdf0e10cSrcweir delete pInfo;
373cdf0e10cSrcweir return nCode;
374cdf0e10cSrcweir }
375cdf0e10cSrcweir
getFrom_005_1()376cdf0e10cSrcweir void getFrom_005_1()
377cdf0e10cSrcweir {
378cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "1" );
379cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by command line can not be gotten!",
380cdf0e10cSrcweir nExitCode == 10 );
381cdf0e10cSrcweir }
getFrom_005_2()382cdf0e10cSrcweir void getFrom_005_2()
383cdf0e10cSrcweir {
384cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "2" );
385cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by .ini/rc file can not be gotten!",
386cdf0e10cSrcweir nExitCode == 20 );
387cdf0e10cSrcweir }
getFrom_005_3()388cdf0e10cSrcweir void getFrom_005_3()
389cdf0e10cSrcweir {
390cdf0e10cSrcweir #if (defined WNT) || (defined SOLARIS)
391cdf0e10cSrcweir putenv(const_cast< char * >("QADEV_BOOTSTRAP=sun&ms"));
392cdf0e10cSrcweir #else
393cdf0e10cSrcweir setenv("QADEV_BOOTSTRAP", "sun&ms", 0);
394cdf0e10cSrcweir #endif
395cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "3" );
396cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by environment variables can not be gotten!",
397cdf0e10cSrcweir nExitCode == 30 );
398cdf0e10cSrcweir }
getFrom_005_4()399cdf0e10cSrcweir void getFrom_005_4()
400cdf0e10cSrcweir {
401cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "4" );
402cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by customed .ini/rc file can not be gotten!",
403cdf0e10cSrcweir nExitCode == 40 );
404cdf0e10cSrcweir }
getFrom_005_5()405cdf0e10cSrcweir void getFrom_005_5()
406cdf0e10cSrcweir {
407cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "5" );
408cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by inheritance can not be gotten!",
409cdf0e10cSrcweir nExitCode == 50 );
410cdf0e10cSrcweir }
getFrom_005_6()411cdf0e10cSrcweir void getFrom_005_6()
412cdf0e10cSrcweir {
413cdf0e10cSrcweir oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "6" );
414cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Parameters passed by default can not be gotten!",
415cdf0e10cSrcweir nExitCode == 60 );
416cdf0e10cSrcweir }
417cdf0e10cSrcweir
418cdf0e10cSrcweir CPPUNIT_TEST_SUITE(getFrom);
419cdf0e10cSrcweir CPPUNIT_TEST(getFrom_001);
420cdf0e10cSrcweir CPPUNIT_TEST(getFrom_002);
421cdf0e10cSrcweir CPPUNIT_TEST(getFrom_003);
422cdf0e10cSrcweir CPPUNIT_TEST(getFrom_004);
423cdf0e10cSrcweir CPPUNIT_TEST(getFrom_004_1);
424cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_1);
425cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_2);
426cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_3);
427cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_4);
428cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_5);
429cdf0e10cSrcweir CPPUNIT_TEST(getFrom_005_6);
430cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
431cdf0e10cSrcweir }; // class getFrom
432cdf0e10cSrcweir
433cdf0e10cSrcweir class setIniFilename : public CppUnit::TestFixture
434cdf0e10cSrcweir {
435cdf0e10cSrcweir public:
436cdf0e10cSrcweir // initialise your test code values here.
setUp()437cdf0e10cSrcweir void setUp()
438cdf0e10cSrcweir {
439cdf0e10cSrcweir }
440cdf0e10cSrcweir
tearDown()441cdf0e10cSrcweir void tearDown()
442cdf0e10cSrcweir {
443cdf0e10cSrcweir }
444cdf0e10cSrcweir
setIniFilename_001()445cdf0e10cSrcweir void setIniFilename_001()
446cdf0e10cSrcweir {
447cdf0e10cSrcweir Bootstrap aBootstrap;
448cdf0e10cSrcweir
449cdf0e10cSrcweir rtl::OUString suGetIniname;
450cdf0e10cSrcweir aBootstrap.getIniName( suGetIniname );
451cdf0e10cSrcweir //which should be .....testshl2rc
452cdf0e10cSrcweir //printUString( suGetIniname );
453cdf0e10cSrcweir
454cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
455cdf0e10cSrcweir Bootstrap::setIniFilename( suIniname );
456cdf0e10cSrcweir
457cdf0e10cSrcweir rtl::OUString suGetname;
458cdf0e10cSrcweir aBootstrap.getIniName( suGetname );
459cdf0e10cSrcweir
460cdf0e10cSrcweir printUString( suGetname );
461cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("setIniFilename then get it.", suGetname.compareTo( suIniname ) == 0
462cdf0e10cSrcweir && suGetname.compareTo( suGetIniname ) != 0 );
463cdf0e10cSrcweir }
464cdf0e10cSrcweir
setIniFilename_002()465cdf0e10cSrcweir void setIniFilename_002()
466cdf0e10cSrcweir {
467cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
468cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("test failed, Bootstrap ini does not exist.", t_fileExist(suIniname ) == true);
469cdf0e10cSrcweir
470cdf0e10cSrcweir Bootstrap::setIniFilename( suIniname );
471cdf0e10cSrcweir //rtl_bootstrap_args_open( suIniname.pData );
472cdf0e10cSrcweir rtl::OUString suGetname;
473cdf0e10cSrcweir rtl::OUString suValuename = rtl::OUString::createFromAscii( "INHERITED_VALUE" );
474cdf0e10cSrcweir //aBootstrap.getFrom( suValuename, suGetname );
475cdf0e10cSrcweir Bootstrap::get( suValuename, suGetname );
476cdf0e10cSrcweir printUString( suGetname );
477cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("setIniFilename and get value of the argument.", suGetname.getLength() != 0 );
478cdf0e10cSrcweir }
479cdf0e10cSrcweir
480cdf0e10cSrcweir CPPUNIT_TEST_SUITE(setIniFilename);
481cdf0e10cSrcweir CPPUNIT_TEST(setIniFilename_001);
482cdf0e10cSrcweir CPPUNIT_TEST(setIniFilename_002);
483cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
484cdf0e10cSrcweir }; // class setIniFilename
485cdf0e10cSrcweir
486cdf0e10cSrcweir class getHandle : public CppUnit::TestFixture
487cdf0e10cSrcweir {
488cdf0e10cSrcweir public:
489cdf0e10cSrcweir // initialise your test code values here.
setUp()490cdf0e10cSrcweir void setUp()
491cdf0e10cSrcweir {
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
tearDown()494cdf0e10cSrcweir void tearDown()
495cdf0e10cSrcweir {
496cdf0e10cSrcweir }
497cdf0e10cSrcweir
getHandle_001()498cdf0e10cSrcweir void getHandle_001()
499cdf0e10cSrcweir {
500cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
501cdf0e10cSrcweir Bootstrap aBootstrap;
502cdf0e10cSrcweir rtlBootstrapHandle bsHandle = aBootstrap.getHandle();
503cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("getHandle should return 0 if the bootstrap has no ini file!", bsHandle == 0 );
504cdf0e10cSrcweir }
getHandle_002()505cdf0e10cSrcweir void getHandle_002()
506cdf0e10cSrcweir {
507cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
508cdf0e10cSrcweir Bootstrap aBootstrap( suIniname );
509cdf0e10cSrcweir
510cdf0e10cSrcweir rtlBootstrapHandle bsHandle = aBootstrap.getHandle();
511cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("getHandle return NULL!", bsHandle != 0);
512cdf0e10cSrcweir
513cdf0e10cSrcweir //rtl::OUString iniName;
514cdf0e10cSrcweir //rtl_bootstrap_get_iniName_from_handle( bsHandle, &iniName.pData );
515cdf0e10cSrcweir
516cdf0e10cSrcweir rtl::OUString suValue;
517cdf0e10cSrcweir rtl::OUString suKeyName = rtl::OUString::createFromAscii( "PSEUDOFILE" );
518cdf0e10cSrcweir rtl_bootstrap_get_from_handle(bsHandle, suKeyName.pData, &suValue.pData, NULL);
519cdf0e10cSrcweir printUString( suValue);
520cdf0e10cSrcweir
521cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Can not use the handle which is returned by getHandle!", suValue.equals( rtl::OUString::createFromAscii("be pseudo") ) == sal_True );
522cdf0e10cSrcweir
523cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("Can not use the handle which is returned by getHandle!",
524cdf0e10cSrcweir // suGetname.equalsIgnoreAsciiCase( iniName ) == sal_True );
525cdf0e10cSrcweir }
526cdf0e10cSrcweir
527cdf0e10cSrcweir CPPUNIT_TEST_SUITE(getHandle);
528cdf0e10cSrcweir CPPUNIT_TEST(getHandle_001);
529cdf0e10cSrcweir CPPUNIT_TEST(getHandle_002);
530cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
531cdf0e10cSrcweir }; // class getHandle
532cdf0e10cSrcweir
533cdf0e10cSrcweir class set : public CppUnit::TestFixture
534cdf0e10cSrcweir {
535cdf0e10cSrcweir public:
536cdf0e10cSrcweir // initialise your test code values here.
setUp()537cdf0e10cSrcweir void setUp()
538cdf0e10cSrcweir {
539cdf0e10cSrcweir }
540cdf0e10cSrcweir
tearDown()541cdf0e10cSrcweir void tearDown()
542cdf0e10cSrcweir {
543cdf0e10cSrcweir }
544cdf0e10cSrcweir
set_001()545cdf0e10cSrcweir void set_001()
546cdf0e10cSrcweir {
547cdf0e10cSrcweir //in ini fle, INHERITED_VALUE=inherited_value
548cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
549cdf0e10cSrcweir Bootstrap aBootstrap( suIniname);
550cdf0e10cSrcweir rtl::OUString suName = rtl::OUString::createFromAscii( "INHERITED_VALUE" );
551cdf0e10cSrcweir rtl::OUString suValue = rtl::OUString::createFromAscii( "ok" );
552cdf0e10cSrcweir // set to another value
553cdf0e10cSrcweir Bootstrap::set( suName, suValue );
554cdf0e10cSrcweir rtl::OUString suGetValue;
555cdf0e10cSrcweir Bootstrap::get( suName, suGetValue);
556cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("set and get argument failed.", suGetValue.compareTo(suValue) == 0 );
557cdf0e10cSrcweir }
set_002()558cdf0e10cSrcweir void set_002()
559cdf0e10cSrcweir {
560cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
561cdf0e10cSrcweir Bootstrap myBootstrap( suIniname);
562cdf0e10cSrcweir rtl::OUString suName = rtl::OUString::createFromAscii( "INHERITED_VALUE" );
563cdf0e10cSrcweir rtl::OUString suGetOrientValue;
564cdf0e10cSrcweir Bootstrap::get( suName, suGetOrientValue);
565cdf0e10cSrcweir // ?? INHERITED_VALUE = ok now, which is set in set_001
566cdf0e10cSrcweir printUString( suGetOrientValue );
567cdf0e10cSrcweir
568cdf0e10cSrcweir rtl::OUString suValue = rtl::OUString::createFromAscii( TESTSHL2_INI );
569cdf0e10cSrcweir // set to another value
570cdf0e10cSrcweir Bootstrap::set( suName, suValue );
571cdf0e10cSrcweir rtl::OUString suGetValue;
572cdf0e10cSrcweir Bootstrap::get( suName, suGetValue);
573cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("set and get argument failed.", suGetValue.compareTo(suValue) == 0 );
574cdf0e10cSrcweir }
575cdf0e10cSrcweir
576cdf0e10cSrcweir CPPUNIT_TEST_SUITE(set);
577cdf0e10cSrcweir CPPUNIT_TEST(set_001);
578cdf0e10cSrcweir CPPUNIT_TEST(set_002);
579cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
580cdf0e10cSrcweir }; // class set
581cdf0e10cSrcweir
582cdf0e10cSrcweir class expandMacrosFrom : public CppUnit::TestFixture
583cdf0e10cSrcweir {
584cdf0e10cSrcweir public:
setUp()585cdf0e10cSrcweir void setUp()
586cdf0e10cSrcweir {
587cdf0e10cSrcweir }
588cdf0e10cSrcweir
tearDown()589cdf0e10cSrcweir void tearDown()
590cdf0e10cSrcweir {
591cdf0e10cSrcweir }
expandMacrosFrom_001()592cdf0e10cSrcweir void expandMacrosFrom_001()
593cdf0e10cSrcweir {
594cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
595cdf0e10cSrcweir Bootstrap aBootstrap( suIniname);
596cdf0e10cSrcweir rtl::OUString suMacro = rtl::OUString::createFromAscii( "$MYVAR/expand1" );
597cdf0e10cSrcweir //printUString( suMacro );
598cdf0e10cSrcweir //expandMacro now
599cdf0e10cSrcweir aBootstrap.expandMacrosFrom( suMacro );
600cdf0e10cSrcweir rtl::OUString suExpectedMacro = rtl::OUString::createFromAscii( "src680_test/expand1" );
601cdf0e10cSrcweir //printUString( suMacro );
602cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("expandMacrosFrom failed.", suMacro.compareTo(suExpectedMacro) == 0 );
603cdf0e10cSrcweir }
604cdf0e10cSrcweir
605cdf0e10cSrcweir /** here a special macro should expand
606cdf0e10cSrcweir * if rtlrc is under sal/qa/rtl/bootstrap/, "${rtlrc:Bootstrap:RTLVALUE}" could be expanded
607cdf0e10cSrcweir * else rtlrc is under solver/680/unxlngi4.pro/bin/, "${file:/// ....solver/680/unxlngi4.pro/bin/rtlrc:Bootstrap:RTLVALUE}"
608cdf0e10cSrcweir * could not be expanded
609cdf0e10cSrcweir */
expandMacrosFrom_002()610cdf0e10cSrcweir void expandMacrosFrom_002()
611cdf0e10cSrcweir {
612cdf0e10cSrcweir // Build a string with '${rtl.ini:RTLVALUE}' and try to expand it.
613cdf0e10cSrcweir // In function 'create_rtlrc() is the content of the rtl.ini file.
614cdf0e10cSrcweir
615cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
616cdf0e10cSrcweir t_print("inifile is:");
617cdf0e10cSrcweir printUString( suIniname );
618cdf0e10cSrcweir Bootstrap aBootstrap( suIniname) ;
619cdf0e10cSrcweir rtl::OUString suMacro = rtl::OUString::createFromAscii( "${" ); //rtlrc:Bootstrap:RTLVALUE}");
620cdf0e10cSrcweir
621cdf0e10cSrcweir rtl::OUString aDirURL = OUString::createFromAscii( "$ORIGIN");
622cdf0e10cSrcweir aDirURL += OUString::createFromAscii( "/");
623cdf0e10cSrcweir aDirURL += OUString::createFromAscii( "rtl" );
624cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
625cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii(".ini");
626cdf0e10cSrcweir #else
627cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii("rc");
628cdf0e10cSrcweir #endif
629cdf0e10cSrcweir
630cdf0e10cSrcweir suMacro += aDirURL;//t_getSourcePath("rtl");
631cdf0e10cSrcweir suMacro += rtl::OUString::createFromAscii( "::RTLVALUE}");
632cdf0e10cSrcweir
633cdf0e10cSrcweir t_print("created macro is: ");
634cdf0e10cSrcweir printUString( suMacro );
635cdf0e10cSrcweir //expandMacro now
636cdf0e10cSrcweir aBootstrap.expandMacrosFrom( suMacro );
637cdf0e10cSrcweir t_print("expanded macro is:");
638cdf0e10cSrcweir printUString( suMacro );
639cdf0e10cSrcweir rtl::OUString suExpectedMacro = rtl::OUString::createFromAscii( "qadev17" );
640cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("failed, can't expand '${file:///.../" SAL_CONFIGFILE("rtl") "::RTLVALUE}' to 'qadev17'", suMacro.compareTo(suExpectedMacro) == 0 );
641cdf0e10cSrcweir }
expandMacrosFrom_002_1()642cdf0e10cSrcweir void expandMacrosFrom_002_1()
643cdf0e10cSrcweir {
644cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
645cdf0e10cSrcweir t_print("inifile is:");
646cdf0e10cSrcweir printUString( suIniname );
647cdf0e10cSrcweir Bootstrap aBootstrap( suIniname);
648cdf0e10cSrcweir
649cdf0e10cSrcweir rtl::OUString suMacro;
650cdf0e10cSrcweir // just a simple test, if this really work.
651cdf0e10cSrcweir aBootstrap.getFrom(rtl::OUString::createFromAscii( "SOFROMVALUE2" ), suMacro );
652cdf0e10cSrcweir t_print("SOFROMVALUE2:");
653cdf0e10cSrcweir printUString( suMacro );
654cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("'SOFROMVALUE2' seems to do not exist.", suMacro.getLength() > 0 );
655cdf0e10cSrcweir
656cdf0e10cSrcweir aBootstrap.getFrom(rtl::OUString::createFromAscii( "SOFROMVALUE" ), suMacro );
657cdf0e10cSrcweir
658cdf0e10cSrcweir t_print("SOFROMVALUE:");
659cdf0e10cSrcweir printUString( suMacro );
660cdf0e10cSrcweir
661cdf0e10cSrcweir //expandMacro now
662cdf0e10cSrcweir // seems to be, that getFrom() already expand the string
663cdf0e10cSrcweir // t_print("expanded macro is:");
664cdf0e10cSrcweir // aBootstrap.expandMacrosFrom( suMacro );
665cdf0e10cSrcweir // printUString( suMacro );
666cdf0e10cSrcweir rtl::OUString suExpectedMacro = rtl::OUString::createFromAscii( "src680_qadev" );
667cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("failed, can't expand '${" SAL_CONFIGFILE("rtl") "::SOVALUE}' to 'src680_qadev'", suMacro.compareTo(suExpectedMacro) == 0 );
668cdf0e10cSrcweir }
expandMacrosFrom_002_2()669cdf0e10cSrcweir void expandMacrosFrom_002_2()
670cdf0e10cSrcweir {
671cdf0e10cSrcweir // test, to read and expand SOFROMVALUE3
672cdf0e10cSrcweir // SOFROMVALUE3 is 'rtl(.ini|rc)::TESTSHL_SOVALUE' which should expand to 'rtlfile' if all is ok.
673cdf0e10cSrcweir
674cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
675cdf0e10cSrcweir t_print("inifile is:");
676cdf0e10cSrcweir printUString( suIniname );
677cdf0e10cSrcweir Bootstrap aBootstrap( suIniname);
678cdf0e10cSrcweir
679cdf0e10cSrcweir rtl::OUString suMacro;
680cdf0e10cSrcweir aBootstrap.getFrom(rtl::OUString::createFromAscii( "SOFROMVALUE3" ), suMacro );
681cdf0e10cSrcweir
682cdf0e10cSrcweir t_print("SOFROMVALUE3:");
683cdf0e10cSrcweir printUString( suMacro );
684cdf0e10cSrcweir
685cdf0e10cSrcweir if (suMacro.equals(rtl::OUString::createFromAscii("testshl2_file") ) == sal_True)
686cdf0e10cSrcweir {
687cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("Value 'SOFROMVALUE3' is read from the wrong ini file.", 0 );
688cdf0e10cSrcweir }
689cdf0e10cSrcweir else
690cdf0e10cSrcweir {
691cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("SOFROMVALUE3 should contain 'rtlfile'.", suMacro.equals(rtl::OUString::createFromAscii("rtlfile") ) == sal_True );
692cdf0e10cSrcweir }
693cdf0e10cSrcweir }
694cdf0e10cSrcweir //? I don't know if this is a right test.
695cdf0e10cSrcweir // void expandMacrosFrom_002_3()
696cdf0e10cSrcweir // {
697cdf0e10cSrcweir // // test, to read and expand SOFROMVALUE4
698cdf0e10cSrcweir // // SOFROMVALUE4 is 'rtl(.ini|rc):Other_Section:TESTSHL_SOVALUE' which should expand to '' if all is ok.
699cdf0e10cSrcweir //
700cdf0e10cSrcweir // rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
701cdf0e10cSrcweir // t_print("inifile is:");
702cdf0e10cSrcweir // printUString( suIniname );
703cdf0e10cSrcweir // Bootstrap aBootstrap( suIniname);
704cdf0e10cSrcweir //
705cdf0e10cSrcweir // rtl::OUString suMacro;
706cdf0e10cSrcweir // aBootstrap.getFrom(rtl::OUString::createFromAscii( "SOFROMVALUE4" ), suMacro );
707cdf0e10cSrcweir //
708cdf0e10cSrcweir // t_print("SOFROMVALUE4:");
709cdf0e10cSrcweir // printUString( suMacro );
710cdf0e10cSrcweir //
711cdf0e10cSrcweir // if (suMacro.equals(rtl::OUString::createFromAscii("testshl2_file") ) == sal_True)
712cdf0e10cSrcweir // {
713cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("Value 'SOFROMVALUE4' is read from the wrong section out of the wrong ini file.", 0 );
714cdf0e10cSrcweir // }
715cdf0e10cSrcweir // else if (suMacro.equals(rtl::OUString::createFromAscii("testshl2_file_other") ) == sal_True)
716cdf0e10cSrcweir // {
717cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("Value 'SOFROMVALUE4' is read from the wrong ini file.", 0 );
718cdf0e10cSrcweir // }
719cdf0e10cSrcweir // else
720cdf0e10cSrcweir // {
721cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("Value 'SOFROMVALUE4' should contain 'rtlfile_other'.", suMacro.equals(rtl::OUString::createFromAscii("rtlfile_other") ) == sal_True );
722cdf0e10cSrcweir // }
723cdf0e10cSrcweir // }
expandMacrosFrom_003()724cdf0e10cSrcweir void expandMacrosFrom_003()
725cdf0e10cSrcweir {
726cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
727cdf0e10cSrcweir Bootstrap aBootstrap( suIniname);
728cdf0e10cSrcweir rtl::OUString suMacro[4];
729cdf0e10cSrcweir suMacro[0] = rtl::OUString::createFromAscii( "$SYSUSERCONFIG" );
730cdf0e10cSrcweir suMacro[1] = rtl::OUString::createFromAscii( "$SYSUSERHOME" );
731cdf0e10cSrcweir suMacro[2] = rtl::OUString::createFromAscii( "$SYSBINDIR" );
732cdf0e10cSrcweir suMacro[3] = rtl::OUString::createFromAscii( "$ORIGIN" );
733cdf0e10cSrcweir
734cdf0e10cSrcweir for ( int i = 0; i < 4; i++ )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir aBootstrap.expandMacrosFrom( suMacro[i] );
737cdf0e10cSrcweir printUString(suMacro[i]);
738cdf0e10cSrcweir }
739cdf0e10cSrcweir // printUString( t_getSourcePath("") );
740cdf0e10cSrcweir // CPPUNIT_ASSERT_MESSAGE("some integral variables.", suMacro[3].equalsIgnoreAsciiCase(t_getSourcePath("")) == sal_True );
741cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("some integral variables.", suMacro[0].getLength() > 0 &&
742cdf0e10cSrcweir suMacro[1].getLength() > 0 &&
743cdf0e10cSrcweir suMacro[2].getLength() > 0 &&
744cdf0e10cSrcweir suMacro[3].getLength() > 0);
745cdf0e10cSrcweir }
746cdf0e10cSrcweir
testRecursion()747cdf0e10cSrcweir void testRecursion() {
748cdf0e10cSrcweir rtl::OUString t(RTL_CONSTASCII_USTRINGPARAM("$RECURSIVE"));
749cdf0e10cSrcweir Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
750cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
751cdf0e10cSrcweir "recursion detection",
752cdf0e10cSrcweir t.equalsAsciiL(
753cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("***RECURSION DETECTED***")));
754cdf0e10cSrcweir }
755cdf0e10cSrcweir
testLink()756cdf0e10cSrcweir void testLink() {
757cdf0e10cSrcweir rtl::OUString t(RTL_CONSTASCII_USTRINGPARAM("$LINKED"));
758cdf0e10cSrcweir Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
759cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
760cdf0e10cSrcweir "link file",
761cdf0e10cSrcweir t.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("qadev17")));
762cdf0e10cSrcweir }
763cdf0e10cSrcweir
testOverride()764cdf0e10cSrcweir void testOverride() {
765cdf0e10cSrcweir rtl::OUString t1(
766cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
767cdf0e10cSrcweir "${.override:$ORIGIN/" SAL_CONFIGFILE("rtl") ":ORIGIN}"));
768cdf0e10cSrcweir Bootstrap(t_getSourcePath("rtl")).expandMacrosFrom(t1);
769cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
770cdf0e10cSrcweir "override ORIGIN",
771cdf0e10cSrcweir t1.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("direct")));
772cdf0e10cSrcweir rtl::OUString t2(
773cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
774cdf0e10cSrcweir "${.override:$ORIGIN/" SAL_CONFIGFILE("none") ":MYVAR}"));
775cdf0e10cSrcweir Bootstrap::expandMacros(t2);
776cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
777cdf0e10cSrcweir "override MYVAR",
778cdf0e10cSrcweir t2.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("src680_test")));
779cdf0e10cSrcweir }
780cdf0e10cSrcweir
testNonexisting()781cdf0e10cSrcweir void testNonexisting() {
782cdf0e10cSrcweir rtl::OUString t(
783cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
784cdf0e10cSrcweir "${$ORIGIN/" SAL_CONFIGFILE("none") ":MYVAR}"));
785cdf0e10cSrcweir Bootstrap::expandMacros(t);
786cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
787cdf0e10cSrcweir "nonexisting",
788cdf0e10cSrcweir t.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("src680_test")));
789cdf0e10cSrcweir }
790cdf0e10cSrcweir
testSection()791cdf0e10cSrcweir void testSection() {
792cdf0e10cSrcweir rtl::OUStringBuffer b;
793cdf0e10cSrcweir b.appendAscii(RTL_CONSTASCII_STRINGPARAM("${"));
794cdf0e10cSrcweir rtl::OUString p(t_getSourcePath(TESTSHL2_INI));
795cdf0e10cSrcweir for (sal_Int32 i = 0; i < p.getLength(); ++i) {
796cdf0e10cSrcweir if (p[i] != 'u') {
797cdf0e10cSrcweir b.append(static_cast< sal_Unicode >('\\'));
798cdf0e10cSrcweir }
799cdf0e10cSrcweir b.append(p[i]);
800cdf0e10cSrcweir }
801cdf0e10cSrcweir b.appendAscii(RTL_CONSTASCII_STRINGPARAM(":Other_Section:EXPAND}"));
802cdf0e10cSrcweir rtl::OUString t(b.makeStringAndClear());
803cdf0e10cSrcweir Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
804cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE(
805cdf0e10cSrcweir "section expansion",
806cdf0e10cSrcweir t.equalsAsciiL(
807cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("$FILE")));
808cdf0e10cSrcweir // the correct answer would be "testshl2 file" instead, but
809cdf0e10cSrcweir // expansion including a section currently erroneously does not
810cdf0e10cSrcweir // recursively expand macros in the resulting replacement text
811cdf0e10cSrcweir }
812cdf0e10cSrcweir
813cdf0e10cSrcweir CPPUNIT_TEST_SUITE(expandMacrosFrom);
814cdf0e10cSrcweir CPPUNIT_TEST(expandMacrosFrom_001);
815cdf0e10cSrcweir CPPUNIT_TEST(expandMacrosFrom_002);
816cdf0e10cSrcweir CPPUNIT_TEST(expandMacrosFrom_002_1);
817cdf0e10cSrcweir CPPUNIT_TEST(expandMacrosFrom_002_2);
818cdf0e10cSrcweir //? CPPUNIT_TEST(expandMacrosFrom_002_3);
819cdf0e10cSrcweir CPPUNIT_TEST(expandMacrosFrom_003);
820cdf0e10cSrcweir CPPUNIT_TEST(testRecursion);
821cdf0e10cSrcweir CPPUNIT_TEST(testLink);
822cdf0e10cSrcweir CPPUNIT_TEST(testOverride);
823cdf0e10cSrcweir CPPUNIT_TEST(testNonexisting);
824cdf0e10cSrcweir CPPUNIT_TEST(testSection);
825cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
826cdf0e10cSrcweir }; // class expandMacrosFrom
827cdf0e10cSrcweir
828cdf0e10cSrcweir class expandMacros : public CppUnit::TestFixture
829cdf0e10cSrcweir {
830cdf0e10cSrcweir public:
831cdf0e10cSrcweir // initialise your test code values here.
setUp()832cdf0e10cSrcweir void setUp()
833cdf0e10cSrcweir {
834cdf0e10cSrcweir }
835cdf0e10cSrcweir
tearDown()836cdf0e10cSrcweir void tearDown()
837cdf0e10cSrcweir {
838cdf0e10cSrcweir }
839cdf0e10cSrcweir
expandMacros_001()840cdf0e10cSrcweir void expandMacros_001()
841cdf0e10cSrcweir {
842cdf0e10cSrcweir rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
843cdf0e10cSrcweir Bootstrap aBootstrap( suIniname) ;
844cdf0e10cSrcweir rtl::OUString suMacro = rtl::OUString::createFromAscii( "$INHERITED_VALUE/well" );
845cdf0e10cSrcweir Bootstrap::expandMacros( suMacro );
846cdf0e10cSrcweir
847cdf0e10cSrcweir rtl::OUString suName = rtl::OUString::createFromAscii( "INHERITED_VALUE" );
848cdf0e10cSrcweir OUString suGetValue;
849cdf0e10cSrcweir Bootstrap::get( suName, suGetValue );
850cdf0e10cSrcweir suGetValue += OUString::createFromAscii( "/well" );
851cdf0e10cSrcweir CPPUNIT_ASSERT_MESSAGE("expandMacros failed.", suGetValue.compareTo(suMacro) == 0 );
852cdf0e10cSrcweir }
853cdf0e10cSrcweir
854cdf0e10cSrcweir CPPUNIT_TEST_SUITE(expandMacros);
855cdf0e10cSrcweir CPPUNIT_TEST(expandMacros_001);
856cdf0e10cSrcweir // CPPUNIT_TEST(expandMacros_002);
857cdf0e10cSrcweir CPPUNIT_TEST_SUITE_END();
858cdf0e10cSrcweir }; // class expandMacros
859cdf0e10cSrcweir
860cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::ctor, "rtl_Bootstrap");
861cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::getFrom, "rtl_Bootstrap");
862cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::setIniFilename, "rtl_Bootstrap");
863cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::getHandle, "rtl_Bootstrap");
864cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::set, "rtl_Bootstrap");
865cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::expandMacrosFrom, "rtl_Bootstrap");
866cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::expandMacros, "rtl_Bootstrap");
867cdf0e10cSrcweir
868cdf0e10cSrcweir } // namespace rtl_Bootstrap
869cdf0e10cSrcweir
870cdf0e10cSrcweir // -----------------------------------------------------------------------------
871cdf0e10cSrcweir
872cdf0e10cSrcweir // this macro creates an empty function, which will called by the RegisterAllFunctions()
873cdf0e10cSrcweir // to let the user the possibility to also register some functions by hand.
874cdf0e10cSrcweir // NOADDITIONAL;
875cdf0e10cSrcweir
876cdf0e10cSrcweir
877cdf0e10cSrcweir // Here are some helpers, which create a new file 'rtlrc' at the executable path position
878cdf0e10cSrcweir // and fill the file with some information.
879cdf0e10cSrcweir // static rtl::OUString getExecutableDirectory()
880cdf0e10cSrcweir // {
881cdf0e10cSrcweir // rtl::OUString fileName;
882cdf0e10cSrcweir // osl_getExecutableFile(&fileName.pData);
883cdf0e10cSrcweir //
884cdf0e10cSrcweir // sal_Int32 nDirEnd = fileName.lastIndexOf('/');
885cdf0e10cSrcweir //
886cdf0e10cSrcweir // OSL_ENSURE(nDirEnd >= 0, "Cannot locate executable directory");
887cdf0e10cSrcweir //
888cdf0e10cSrcweir // rtl::OUString aDirURL = fileName.copy(0, nDirEnd);
889cdf0e10cSrcweir // return aDirURL;
890cdf0e10cSrcweir // }
891cdf0e10cSrcweir
removeAndCreateFile(rtl::OUString const & _suFileURL,rtl::OString const & _sContent)892cdf0e10cSrcweir static void removeAndCreateFile(rtl::OUString const& _suFileURL, rtl::OString const& _sContent)
893cdf0e10cSrcweir {
894cdf0e10cSrcweir osl::File::remove(_suFileURL);
895cdf0e10cSrcweir
896cdf0e10cSrcweir ::std::auto_ptr<osl::File> pFile( new osl::File( _suFileURL ) );
897cdf0e10cSrcweir ::osl::FileBase::RC nError = pFile->open( OpenFlag_Write | OpenFlag_Create );
898cdf0e10cSrcweir if ( ::osl::FileBase::E_None == nError || ::osl::FileBase::E_EXIST == nError )
899cdf0e10cSrcweir {
900cdf0e10cSrcweir t_print(T_VERBOSE, "%s\n" , OString(_suFileURL, _suFileURL.getLength(), RTL_TEXTENCODING_ASCII_US).getStr());
901cdf0e10cSrcweir sal_uInt64 nWritenBytes;
902cdf0e10cSrcweir pFile->write(_sContent.getStr(), _sContent.getLength(), nWritenBytes);
903cdf0e10cSrcweir // t_print("nBytes: %ld\n", nBytes);
904cdf0e10cSrcweir
905cdf0e10cSrcweir rtl::OString sError = "can't write enough bytes to file";
906cdf0e10cSrcweir sError += OString(_suFileURL, _suFileURL.getLength(), RTL_TEXTENCODING_ASCII_US);
907cdf0e10cSrcweir OSL_ENSURE(nWritenBytes == _sContent.getLength(), sError.getStr());
908cdf0e10cSrcweir
909cdf0e10cSrcweir pFile->close();
910cdf0e10cSrcweir }
911cdf0e10cSrcweir else
912cdf0e10cSrcweir {
913cdf0e10cSrcweir rtl::OString sError = "can't create file URL: '";
914cdf0e10cSrcweir rtl::OString sFile;
915cdf0e10cSrcweir sFile <<= _suFileURL;
916cdf0e10cSrcweir sError += sFile;
917cdf0e10cSrcweir sError += "' maybe no write access. If it is true with no write access, please create a local environment and start these tests again. rtl::Bootstrap test must quit.";
918cdf0e10cSrcweir t_print("%s\n", sError.getStr() );
919cdf0e10cSrcweir exit(1);
920cdf0e10cSrcweir }
921cdf0e10cSrcweir OSL_ASSERT(t_fileExist(_suFileURL) == true);
922cdf0e10cSrcweir }
923cdf0e10cSrcweir
924cdf0e10cSrcweir // -----------------------------------------------------------------------------
create_rtlrc()925cdf0e10cSrcweir static void create_rtlrc()
926cdf0e10cSrcweir {
927cdf0e10cSrcweir rtl::OUString aFileURL(getExecutableDirectory());
928cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
929cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/rtl.ini");
930cdf0e10cSrcweir #else
931cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/rtlrc");
932cdf0e10cSrcweir #endif
933cdf0e10cSrcweir
934cdf0e10cSrcweir rtl::OString sLines;
935cdf0e10cSrcweir sLines += "[Bootstrap]\n";
936cdf0e10cSrcweir sLines += "SOVALUE=src680_qadev\n";
937cdf0e10cSrcweir sLines += "RTLVALUE=qadev17\n";
938cdf0e10cSrcweir sLines += "TESTSHL_SOVALUE=rtlfile\n";
939cdf0e10cSrcweir sLines += "RECURSIVE=${$ORIGIN/" SAL_CONFIGFILE("testshl2") ":RECURSIVE}\n";
940cdf0e10cSrcweir sLines += "ORIGIN=direct\n";
941cdf0e10cSrcweir sLines += "[Other_Section]\n";
942cdf0e10cSrcweir sLines += "TESTSHL_SOVALUE=rtlfile_other\n";
943cdf0e10cSrcweir
944cdf0e10cSrcweir removeAndCreateFile(aFileURL, sLines);
945cdf0e10cSrcweir }
946cdf0e10cSrcweir
947cdf0e10cSrcweir // -----------------------------------------------------------------------------
create_testshl2rc()948cdf0e10cSrcweir static void create_testshl2rc()
949cdf0e10cSrcweir {
950cdf0e10cSrcweir rtl::OUString aFileURL(getExecutableDirectory());
951cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
952cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/testshl2.ini");
953cdf0e10cSrcweir #else
954cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/testshl2rc");
955cdf0e10cSrcweir #endif
956cdf0e10cSrcweir rtl::OString sLines;
957cdf0e10cSrcweir sLines += "[Bootstrap]\n";
958cdf0e10cSrcweir sLines += "FILE=testshl2 file\n";
959cdf0e10cSrcweir sLines += "MYBOOTSTRAPTESTVALUE=file\n";
960cdf0e10cSrcweir sLines += "INHERITED_VALUE=inherited_value\n";
961cdf0e10cSrcweir sLines += "INHERITED_OVERWRITTEN_VALUE=not_overwritten\n";
962cdf0e10cSrcweir sLines += "MYVAR=src680_test\n";
963cdf0e10cSrcweir sLines += "SOFROMVALUE=${$ORIGIN/" SAL_CONFIGFILE("rtl") "::SOVALUE}\n";
964cdf0e10cSrcweir sLines += "SOFROMVALUE2=test\n";
965cdf0e10cSrcweir sLines += "SOFROMVALUE3=${$ORIGIN/" SAL_CONFIGFILE("rtl") "::TESTSHL_SOVALUE}\n";
966cdf0e10cSrcweir sLines += "TESTSHL_SOVALUE=testshl2_file\n";
967cdf0e10cSrcweir //? sLines += "SOFROMVALUE4=${" SAL_CONFIGFILE("rtl") ":Other_Section:TESTSHL_SOVALUE}\n";
968cdf0e10cSrcweir sLines += "ILLEGAL VALUE=test\n";
969cdf0e10cSrcweir sLines += "ILLEGAL.DOT=test\n";
970cdf0e10cSrcweir sLines += "ILLEGAL;SEMICOLON=test\n";
971cdf0e10cSrcweir sLines += "ILLEGAL:COLON=test\n";
972cdf0e10cSrcweir sLines += " KEY_FOR_TRIM_TEST = value for trim test \n";
973cdf0e10cSrcweir sLines += "RECURSIVE=${$ORIGIN/" SAL_CONFIGFILE("rtl") ":RECURSIVE}\n";
974cdf0e10cSrcweir sLines += "LINKED=${${.link:$ORIGIN/testshl2-link}:RTLVALUE}\n";
975cdf0e10cSrcweir sLines += "[Other_Section]\n";
976cdf0e10cSrcweir sLines += "FILE=testshl2 file other\n";
977cdf0e10cSrcweir sLines += "EXPAND=$FILE\n";
978cdf0e10cSrcweir //? sLines += "TESTSHL_SOVALUE=testshl2_file_other\n";
979cdf0e10cSrcweir
980cdf0e10cSrcweir removeAndCreateFile(aFileURL, sLines);
981cdf0e10cSrcweir
982cdf0e10cSrcweir removeAndCreateFile(
983cdf0e10cSrcweir (getExecutableDirectory() +
984cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/testshl2-link"))),
985cdf0e10cSrcweir SAL_CONFIGFILE("rtl"));
986cdf0e10cSrcweir }
987cdf0e10cSrcweir
988cdf0e10cSrcweir // -----------------------------------------------------------------------------
989cdf0e10cSrcweir
create_pseudorc()990cdf0e10cSrcweir static void create_pseudorc()
991cdf0e10cSrcweir {
992cdf0e10cSrcweir rtl::OUString aFileURL(getExecutableDirectory());
993cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
994cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/pseudo.ini");
995cdf0e10cSrcweir #else
996cdf0e10cSrcweir aFileURL += rtl::OUString::createFromAscii("/pseudorc");
997cdf0e10cSrcweir #endif
998cdf0e10cSrcweir rtl::OString sLines;
999cdf0e10cSrcweir sLines += "[Bootstrap]\n";
1000cdf0e10cSrcweir sLines += "FILE=pseudo file\n";
1001cdf0e10cSrcweir sLines += "PSEUDOFILE=be pseudo\n";
1002cdf0e10cSrcweir
1003cdf0e10cSrcweir removeAndCreateFile(aFileURL, sLines);
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir
1006cdf0e10cSrcweir // -----------------------------------------------------------------------------
create_bootstrap_processrc()1007cdf0e10cSrcweir void create_bootstrap_processrc()
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir rtl::OUString aDirURL(getModulePath());
1010cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
1011cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii("/bootstrap_process.ini");
1012cdf0e10cSrcweir #else
1013cdf0e10cSrcweir aDirURL += rtl::OUString::createFromAscii("/bootstrap_processrc");
1014cdf0e10cSrcweir #endif
1015cdf0e10cSrcweir rtl::OString sLines;
1016cdf0e10cSrcweir sLines += "[Bootstrap]\n";
1017cdf0e10cSrcweir sLines += "EXECUTABLE_RC=true\n";
1018cdf0e10cSrcweir sLines += "IF_CUSTOM_RC=false\n";
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir removeAndCreateFile(aDirURL, sLines);
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir // -----------------------------------------------------------------------------
1023cdf0e10cSrcweir
RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)1024cdf0e10cSrcweir void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir (void) _pFunc;
1027cdf0e10cSrcweir // start message
1028cdf0e10cSrcweir t_print(T_VERBOSE, "Initializing ...\n" );
1029cdf0e10cSrcweir create_rtlrc();
1030cdf0e10cSrcweir create_testshl2rc();
1031cdf0e10cSrcweir create_pseudorc();
1032cdf0e10cSrcweir create_bootstrap_processrc();
1033cdf0e10cSrcweir
1034cdf0e10cSrcweir t_print(T_VERBOSE, "Initialization Done.\n" );
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir
1037