quieten and quicken some of these tests
This commit is contained in:
@@ -62,23 +62,6 @@ inline void printUString( const ::rtl::OUString & str )
|
|||||||
printf("%s\n", aString.getStr( ) );
|
printf("%s\n", aString.getStr( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** wait _nSec seconds.
|
|
||||||
*/
|
|
||||||
void thread_sleep( sal_Int32 _nSec )
|
|
||||||
{
|
|
||||||
/// print statement in thread process must use fflush() to force display.
|
|
||||||
printf("# wait %d seconds. ", (int) _nSec );
|
|
||||||
fflush( stdout );
|
|
||||||
|
|
||||||
#ifdef WNT //Windows
|
|
||||||
Sleep( _nSec * 1000 );
|
|
||||||
#endif
|
|
||||||
#if ( defined UNX ) || ( defined OS2 ) //Unix
|
|
||||||
sleep( _nSec );
|
|
||||||
#endif
|
|
||||||
printf("# done\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ConditionType
|
enum ConditionType
|
||||||
{
|
{
|
||||||
thread_type_set,
|
thread_type_set,
|
||||||
@@ -189,11 +172,10 @@ namespace osl_Condition
|
|||||||
|
|
||||||
ConditionThread myThread2( aCond, thread_type_set );
|
ConditionThread myThread2( aCond, thread_type_set );
|
||||||
myThread2.create();
|
myThread2.create();
|
||||||
thread_sleep(1);
|
|
||||||
bRes1 = myThread1.isRunning( );
|
|
||||||
bRes2 = aCond.check( );
|
|
||||||
|
|
||||||
myThread1.join( );
|
myThread1.join( );
|
||||||
|
bRes1 = myThread1.isRunning( );
|
||||||
|
bRes2 = aCond.check( );
|
||||||
myThread2.join( );
|
myThread2.join( );
|
||||||
|
|
||||||
CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.",
|
CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.",
|
||||||
@@ -287,12 +269,11 @@ namespace osl_Condition
|
|||||||
osl::Condition::Result r1=cond1.wait(tv1);
|
osl::Condition::Result r1=cond1.wait(tv1);
|
||||||
osl::Condition::Result r2=cond2.wait();
|
osl::Condition::Result r2=cond2.wait();
|
||||||
osl::Condition::Result r3=cond3.wait(tv1);
|
osl::Condition::Result r3=cond3.wait(tv1);
|
||||||
fprintf(stderr,"%d %d %d\n",r1,r2,r3);
|
|
||||||
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test three types of wait.",
|
|
||||||
(cond1.wait(tv1) == ::osl::Condition::result_ok) &&
|
|
||||||
(cond2.wait() == ::osl::Condition::result_ok) &&
|
|
||||||
(cond3.wait(tv1) == ::osl::Condition::result_timeout) );
|
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test three types of wait.",
|
||||||
|
(r1 == ::osl::Condition::result_ok) &&
|
||||||
|
(r2 == ::osl::Condition::result_ok) &&
|
||||||
|
(r3 == ::osl::Condition::result_timeout) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wait_002( )
|
void wait_002( )
|
||||||
|
@@ -180,25 +180,6 @@ inline void printFileAttributes( const sal_Int64 nAttributes )
|
|||||||
printf( ") file!\n" );
|
printf( ") file!\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** print a UNI_CODE file name.
|
|
||||||
*/
|
|
||||||
inline void printFileName( const ::rtl::OUString & str )
|
|
||||||
{
|
|
||||||
rtl::OString aString;
|
|
||||||
|
|
||||||
printf( "#printFileName_u# " );
|
|
||||||
aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
|
|
||||||
printf( "%s\n", aString.getStr( ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** print a ASCII_CODE file name.
|
|
||||||
*/
|
|
||||||
inline void printFileName( const sal_Char * str )
|
|
||||||
{
|
|
||||||
printf( "#printFileName_a# " );
|
|
||||||
printf( "%s\n", str );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** print an output wrong message.
|
/** print an output wrong message.
|
||||||
*/
|
*/
|
||||||
inline void printError( const ::osl::FileBase::RC nError )
|
inline void printError( const ::osl::FileBase::RC nError )
|
||||||
@@ -465,10 +446,8 @@ inline void createTestDirectory( const ::rtl::OUString basename, const ::rtl::OU
|
|||||||
*/
|
*/
|
||||||
inline void deleteTestDirectory( const ::rtl::OUString dirname )
|
inline void deleteTestDirectory( const ::rtl::OUString dirname )
|
||||||
{
|
{
|
||||||
// LLA: printf("deleteTestDirectory\n");
|
|
||||||
::rtl::OUString aPathURL = dirname.copy( 0 );
|
::rtl::OUString aPathURL = dirname.copy( 0 );
|
||||||
::osl::FileBase::RC nError;
|
::osl::FileBase::RC nError;
|
||||||
// LLA: printFileName(aPathURL);
|
|
||||||
if ( !isURL( dirname ) )
|
if ( !isURL( dirname ) )
|
||||||
::osl::FileBase::getFileURLFromSystemPath( dirname, aPathURL ); //convert if not full qualified URL
|
::osl::FileBase::getFileURLFromSystemPath( dirname, aPathURL ); //convert if not full qualified URL
|
||||||
|
|
||||||
@@ -1482,7 +1461,6 @@ namespace osl_FileBase
|
|||||||
{
|
{
|
||||||
nError1 = FileBase::createTempFile( pUStr_DirURL, pHandle, pUStr_FileURL );
|
nError1 = FileBase::createTempFile( pUStr_DirURL, pHandle, pUStr_FileURL );
|
||||||
::osl::File testFile( *pUStr_FileURL );
|
::osl::File testFile( *pUStr_FileURL );
|
||||||
//printFileName(*pUStr_FileURL);
|
|
||||||
nError2 = testFile.open( osl_File_OpenFlag_Create );
|
nError2 = testFile.open( osl_File_OpenFlag_Create );
|
||||||
if ( osl::FileBase::E_EXIST == nError2 ) {
|
if ( osl::FileBase::E_EXIST == nError2 ) {
|
||||||
osl_closeFile( *pHandle );
|
osl_closeFile( *pHandle );
|
||||||
@@ -2678,7 +2656,6 @@ namespace osl_FileStatus
|
|||||||
sal_uInt32 mask_link = FileStatusMask_FileName | FileStatusMask_LinkTargetURL;
|
sal_uInt32 mask_link = FileStatusMask_FileName | FileStatusMask_LinkTargetURL;
|
||||||
::osl::FileStatus rFileStatus( mask_link );
|
::osl::FileStatus rFileStatus( mask_link );
|
||||||
rItem_link.getFileStatus( rFileStatus );
|
rItem_link.getFileStatus( rFileStatus );
|
||||||
//printFileName( rFileStatus.getFileName( ) );
|
|
||||||
if ( compareFileName( rFileStatus.getFileName( ), aFileName) == sal_True )
|
if ( compareFileName( rFileStatus.getFileName( ), aFileName) == sal_True )
|
||||||
{
|
{
|
||||||
//printf("find the link file");
|
//printf("find the link file");
|
||||||
@@ -2754,7 +2731,6 @@ namespace osl_FileStatus
|
|||||||
// use $ROOT/staroffice as volume ---> use dev/fd as volume.
|
// use $ROOT/staroffice as volume ---> use dev/fd as volume.
|
||||||
// and get their directory item.
|
// and get their directory item.
|
||||||
createTestDirectory( aTmpName3 );
|
createTestDirectory( aTmpName3 );
|
||||||
//printFileName( aTmpName2);
|
|
||||||
createTestFile( aTmpName3, aTmpName2 );
|
createTestFile( aTmpName3, aTmpName2 );
|
||||||
createTestDirectory( aTmpName3, aTmpName1 );
|
createTestDirectory( aTmpName3, aTmpName1 );
|
||||||
|
|
||||||
@@ -3023,7 +2999,6 @@ namespace osl_FileStatus
|
|||||||
{
|
{
|
||||||
::rtl::OUString aUserHiddenFileURL (RTL_CONSTASCII_USTRINGPARAM("file:///c:/AUTOEXEC.BAT"));
|
::rtl::OUString aUserHiddenFileURL (RTL_CONSTASCII_USTRINGPARAM("file:///c:/AUTOEXEC.BAT"));
|
||||||
nError = ::osl::DirectoryItem::get( aUserHiddenFileURL, rItem_hidden );
|
nError = ::osl::DirectoryItem::get( aUserHiddenFileURL, rItem_hidden );
|
||||||
//printFileName( aUserHiddenFileURL );
|
|
||||||
CPPUNIT_ASSERT_MESSAGE("get item fail", nError == FileBase::E_None );
|
CPPUNIT_ASSERT_MESSAGE("get item fail", nError == FileBase::E_None );
|
||||||
::osl::FileStatus rFileStatus( FileStatusMask_Attributes );
|
::osl::FileStatus rFileStatus( FileStatusMask_Attributes );
|
||||||
nError = rItem_hidden.getFileStatus( rFileStatus );
|
nError = rItem_hidden.getFileStatus( rFileStatus );
|
||||||
@@ -4491,7 +4466,6 @@ namespace osl_File
|
|||||||
createTestDirectory( aTmpName8 );
|
createTestDirectory( aTmpName8 );
|
||||||
//move directory $TEMP/tmpname to $TEMP/tmpname/tmpdir/tmpname
|
//move directory $TEMP/tmpname to $TEMP/tmpname/tmpdir/tmpname
|
||||||
rtl::OUString newName = aTmpName8 + OUString(RTL_CONSTASCII_USTRINGPARAM("/tmpname"));
|
rtl::OUString newName = aTmpName8 + OUString(RTL_CONSTASCII_USTRINGPARAM("/tmpname"));
|
||||||
//printFileName( newName );
|
|
||||||
nError1 = ::osl::File::move( aTmpName3, newName );
|
nError1 = ::osl::File::move( aTmpName3, newName );
|
||||||
//deleteTestDirectory( newName + OUString(RTL_CONSTASCII_USTRINGPARAM("/tmpname")) );
|
//deleteTestDirectory( newName + OUString(RTL_CONSTASCII_USTRINGPARAM("/tmpname")) );
|
||||||
//deleteTestDirectory( newName );
|
//deleteTestDirectory( newName );
|
||||||
|
@@ -80,17 +80,6 @@ inline ::rtl::OUString getDllURL( void )
|
|||||||
return dllPath;
|
return dllPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** print a UNI_CODE file name.
|
|
||||||
*/
|
|
||||||
inline void printFileName( const ::rtl::OUString & str )
|
|
||||||
{
|
|
||||||
rtl::OString aString;
|
|
||||||
|
|
||||||
printf("#printFileName_u# " );
|
|
||||||
aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
|
|
||||||
printf("%s\n", aString.getStr( ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sal_Bool isURL( const ::rtl::OUString pathname )
|
inline sal_Bool isURL( const ::rtl::OUString pathname )
|
||||||
{
|
{
|
||||||
::rtl::OUString aPreURL( RTL_CONSTASCII_USTRINGPARAM("file:///") );
|
::rtl::OUString aPreURL( RTL_CONSTASCII_USTRINGPARAM("file:///") );
|
||||||
@@ -507,8 +496,6 @@ namespace osl_Module
|
|||||||
::rtl::OUString aLibraryURL;
|
::rtl::OUString aLibraryURL;
|
||||||
bRes = ::osl::Module::getUrlFromAddress( oslFunc, aLibraryURL);
|
bRes = ::osl::Module::getUrlFromAddress( oslFunc, aLibraryURL);
|
||||||
aMod.unload();
|
aMod.unload();
|
||||||
printFileName( aLibraryURL );
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_MESSAGE( "#test comment#: load a dll and get its function addr and get its URL.",
|
CPPUNIT_ASSERT_MESSAGE( "#test comment#: load a dll and get its function addr and get its URL.",
|
||||||
sal_True == bRes && aLibraryURL.equalsIgnoreAsciiCase( getDllURL() ) );
|
sal_True == bRes && aLibraryURL.equalsIgnoreAsciiCase( getDllURL() ) );
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user