[Libreoffice-commits] .: 7 commits - sal/prj sal/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Feb 22 07:40:01 PST 2011
sal/prj/build.lst | 4
sal/qa/osl/pipe/makefile.mk | 2
sal/qa/osl/process/batch.sh | 2
sal/qa/osl/process/export.exp | 1
sal/qa/osl/process/makefile.mk | 38 +--
sal/qa/osl/process/osl_Thread.cxx | 271 ++++++-----------------
sal/qa/osl/process/osl_process.cxx | 26 +-
sal/qa/osl/process/osl_process_child.cxx | 53 +---
sal/qa/osl/security/makefile.mk | 2
sal/qa/osl/security/osl_Security.cxx | 351 ++++++++++++++++---------------
sal/qa/osl/security/osl_Security_Const.h | 8
sal/qa/osl/socket/makefile.mk | 2
sal/qa/rtl/alloc/makefile.mk | 3
sal/qa/rtl/bootstrap/makefile.mk | 3
sal/qa/rtl/cipher/makefile.mk | 3
sal/qa/rtl/crc32/makefile.mk | 3
sal/qa/rtl/digest/makefile.mk | 3
sal/qa/rtl/doublelock/makefile.mk | 2
sal/qa/rtl/locale/makefile.mk | 3
sal/qa/rtl/logfile/makefile.mk | 2
sal/qa/rtl/math/makefile.mk | 3
sal/qa/rtl/ostring/makefile.mk | 3
sal/qa/rtl/oustring/makefile.mk | 3
sal/qa/rtl/process/makefile.mk | 2
sal/qa/rtl/random/makefile.mk | 2
sal/qa/rtl/textenc/makefile.mk | 2
sal/qa/rtl/uri/makefile.mk | 2
sal/qa/rtl/uuid/makefile.mk | 3
sal/qa/rtl_strings/makefile.mk | 4
sal/qa/systools/makefile.mk | 3
sal/qa/testHelperFunctions/makefile.mk | 2
31 files changed, 344 insertions(+), 467 deletions(-)
New commits:
commit 7f3f8fe0490fd11e050091855aaeedb4ab0a957b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 15:34:30 2011 +0000
get to build under windows
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 8508f60..31c318e 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -546,21 +546,21 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
{
dwSidSize+=wsprintf(Ident + strlen(Ident),
TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
- (USHORT)psia->Value[0],
- (USHORT)psia->Value[1],
- (USHORT)psia->Value[2],
- (USHORT)psia->Value[3],
- (USHORT)psia->Value[4],
- (USHORT)psia->Value[5]);
+ (sal_uInt16)psia->Value[0],
+ (sal_uInt16)psia->Value[1],
+ (sal_uInt16)psia->Value[2],
+ (sal_uInt16)psia->Value[3],
+ (sal_uInt16)psia->Value[4],
+ (sal_uInt16)psia->Value[5]);
}
else
{
dwSidSize+=wsprintf(Ident + strlen(Ident),
TEXT("%lu"),
- (ULONG)(psia->Value[5] ) +
- (ULONG)(psia->Value[4] << 8) +
- (ULONG)(psia->Value[3] << 16) +
- (ULONG)(psia->Value[2] << 24) );
+ (sal_uInt32)(psia->Value[5] ) +
+ (sal_uInt32)(psia->Value[4] << 8) +
+ (sal_uInt32)(psia->Value[3] << 16) +
+ (sal_uInt32)(psia->Value[2] << 24) );
}
/* loop through SidSubAuthorities */
commit 3fc9745c19b3775b21f99adfefb9c4b8cff0e7da
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 15:30:36 2011 +0000
fix to build under windows
diff --git a/sal/qa/osl/process/export.exp b/sal/qa/osl/process/export.exp
deleted file mode 100644
index a13529d..0000000
--- a/sal/qa/osl/process/export.exp
+++ /dev/null
@@ -1 +0,0 @@
-registerAllTestFunction
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index 3388b5d..8e050cf 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -45,28 +45,21 @@ CXXFLAGS+= $(LFS_CFLAGS)
CFLAGS+=/Ob1
.ENDIF
-SHL1OBJS= \
- $(SLO)$/osl_Thread.obj
-
-SHL1TARGET= osl_Thread
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME =$(SHL1TARGET)
-
+SHL1OBJS=$(SLO)$/osl_Thread.obj
+SHL1TARGET=osl_Thread
+SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
+SHL1IMPLIB=i$(SHL1TARGET)
+DEF1NAME=$(SHL1TARGET)
SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
# END ------------------------------------------------------------------
SHL2OBJS=$(SLO)$/osl_process.obj
SHL2TARGET=osl_process
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
+SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
SHL2IMPLIB=i$(SHL2TARGET)
-SHL2DEF=$(MISC)$/$(SHL2TARGET).def
DEF2NAME=$(SHL2TARGET)
-DEF2EXPORTFILE=export.exp
+SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
# END ------------------------------------------------------------------
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 9bcd99f..ec4bd7b 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -28,6 +28,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
+
+#ifdef WNT
+#define NOMINMAX
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <time.h>
+#endif
+
//------------------------------------------------------------------------
// include files
//------------------------------------------------------------------------
@@ -53,10 +62,6 @@
using namespace osl;
using namespace rtl;
-#ifdef UNX
-#include <unistd.h>
-#include <time.h>
-#endif
// -----------------------------------------------------------------------------
// Kleine Stopuhr
class StopWatch {
@@ -110,14 +115,6 @@ void StopWatch::stop()
if (m_bIsRunning)
{ // check ob gestartet.
-// LLA: old m_nNanoSec = static_cast<sal_Int32>(t2.Nanosec) - static_cast<sal_Int32>(t1.Nanosec);
-// LLA: old m_nSeconds = static_cast<sal_Int32>(t2.Seconds) - static_cast<sal_Int32>(t1.Seconds);
-// LLA: old if (m_nNanoSec < 0)
-// LLA: old {
-// LLA: old m_nNanoSec += 1000000000;
-// LLA: old m_nSeconds -= 1;
-// LLA: old }
- //m_nNanoSec = t2.Nanosec - t1.Nanosec;
m_nSeconds = static_cast<sal_Int32>(t2.Seconds) - static_cast<sal_Int32>(t1.Seconds);
if ( t2.Nanosec > t1.Nanosec )
m_nNanoSec = static_cast<sal_Int32>(t2.Nanosec) - static_cast<sal_Int32>(t1.Nanosec);
@@ -187,31 +184,16 @@ public:
// -----------------------------------------------------------------------------
namespace ThreadHelper
{
- // typedef enum {
- // QUIET=1,
- // VERBOSE
- // } eSleepVerboseMode;
-
- void thread_sleep_tenth_sec(sal_Int32 _nTenthSec/*, eSleepVerboseMode nVerbose = VERBOSE*/)
+ void thread_sleep_tenth_sec(sal_Int32 _nTenthSec)
{
- // if (nVerbose == VERBOSE)
- // {
- // t_print("wait %d tenth seconds. ", _nTenthSec );
- // fflush(stdout);
- // }
-#ifdef WNT //Windows
+#ifdef WNT
Sleep(_nTenthSec * 100 );
-#endif
-#if ( defined UNX ) || ( defined OS2 ) //Unix
+#else
TimeValue nTV;
nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
osl_waitThread(&nTV);
#endif
- // if (nVerbose == VERBOSE)
- // {
- // t_print("done\n");
- // }
}
void outputPriority(oslThreadPriority const& _aPriority)
@@ -324,14 +306,9 @@ protected:
{
m_aFlag.addValue(1);
ThreadHelper::thread_sleep_tenth_sec(1);
- // TimeValue nTV;
- // nTV.Seconds = 1;
- // nTV.Nanosec = 0;
- // wait(nTV);
if (m_nWaitSec != 0)
{
- //ThreadHelper::thread_sleep_tenth_sec(m_nWaitSec * 10);
TimeValue nTV;
nTV.Seconds = m_nWaitSec / 10 ;
nTV.Nanosec = ( m_nWaitSec%10 ) * 100000000 ;
@@ -384,11 +361,6 @@ protected:
m_aFlag.addValue(1);
ThreadHelper::thread_sleep_tenth_sec(1);
- // m_bWait = sal_False;
- // TimeValue nTV;
- // nTV.Seconds = 1;
- // nTV.Nanosec = 0;
- // wait(nTV);
if (m_bSuspend == sal_True)
{
suspend();
@@ -429,10 +401,6 @@ protected:
{
m_aFlag.addValue(1);
ThreadHelper::thread_sleep_tenth_sec(1);
- // TimeValue nTV;
- // nTV.Seconds = 1;
- // nTV.Nanosec = 0;
- // wait(nTV);
}
}
void SAL_CALL onTerminated()
@@ -513,9 +481,6 @@ namespace osl_Thread
#else
_pThread->resume();
#endif
- // ThreadHelper::thread_sleep_tenth_sec(1);
- // _pThread->suspend();
- // ThreadHelper::thread_sleep_tenth_sec(1);
}
// kill a running thread and join it, if it has terminated, do nothing
@@ -2141,8 +2106,6 @@ namespace osl_ThreadData
CPPUNIT_TEST_SUITE_END();
}; // class setData
- //sal_Bool buildTwoThreads(char)
-
class getData : public CppUnit::TestFixture
{
public:
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 5cfee5c..d8219eb 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -677,8 +677,11 @@ public:
}
CPPUNIT_TEST_SUITE(Test_osl_executeProcess);
+ //TODO: Repair these under windows.
+#ifndef WNT
CPPUNIT_TEST(osl_execProc_parent_equals_child_environment);
CPPUNIT_TEST(osl_execProc_merged_child_environment);
+#endif
///TODO: Repair makefile to get the batch.sh, batch.bat copied to $(BIN) for test execution
// CPPUNIT_TEST(osl_execProc_test_batch);
///TODO: Repair test (or tested function ;-) - test fails.
commit 9333e5ed15b83de9172ec05e34805ec2cba9a342
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 13:38:15 2011 +0000
tweak .mk to copy necessary files
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index c1f87ae..3388b5d 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -75,10 +75,9 @@ APP3TARGET=osl_process_child
APP3OBJS=$(OBJ3FILES)
APP3STDLIBS=$(SALLIB)
-SHL2DEPN=$(APP3TARGETN)
-
-#TODO: The Linux and WinDOS batch file must be copied to $(BIN) directory!
-# I dont't know how to do this....
+SHL2DEPN=$(APP3TARGETN) \
+ $(BIN)/batch.sh \
+ $(BIN)/batch.bat
#------------------------------- All object files -------------------------------
# do this here, so we get right dependencies
@@ -96,4 +95,11 @@ SLOFILES=$(SHL1OBJS) $(SHL2OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+$(BIN)/batch.sh: batch.sh
+ $(COPY) $< $@
+
+$(BIN)/batch.bat: batch.bat
+ $(COPY) $< $@
+
.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
commit e46d8107b61dc5fdcdc6f03ceead377b4193c354
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 13:18:09 2011 +0000
set test dependency order
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index c9417e9..c1f87ae 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_osl_process
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
@@ -77,6 +75,8 @@ APP3TARGET=osl_process_child
APP3OBJS=$(OBJ3FILES)
APP3STDLIBS=$(SALLIB)
+SHL2DEPN=$(APP3TARGETN)
+
#TODO: The Linux and WinDOS batch file must be copied to $(BIN) directory!
# I dont't know how to do this....
commit d0c677028589dcf3f22aea45337a1553eb382be1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 13:08:47 2011 +0000
change all _cppunit.mk to local version
diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk
index 6350cdb..fc6728a 100644
--- a/sal/qa/osl/pipe/makefile.mk
+++ b/sal/qa/osl/pipe/makefile.mk
@@ -65,6 +65,6 @@ SHL1RPATH = NONE
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
.END
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index e04bebc..c9417e9 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -96,5 +96,4 @@ SLOFILES=$(SHL1OBJS) $(SHL2OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/osl/security/makefile.mk b/sal/qa/osl/security/makefile.mk
index c371bbf..0fe9b05 100755
--- a/sal/qa/osl/security/makefile.mk
+++ b/sal/qa/osl/security/makefile.mk
@@ -61,4 +61,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/osl/socket/makefile.mk b/sal/qa/osl/socket/makefile.mk
index bd92b5f..98e347b 100755
--- a/sal/qa/osl/socket/makefile.mk
+++ b/sal/qa/osl/socket/makefile.mk
@@ -220,4 +220,4 @@ SHL8VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/alloc/makefile.mk b/sal/qa/rtl/alloc/makefile.mk
index 37ae371..efc23ec 100755
--- a/sal/qa/rtl/alloc/makefile.mk
+++ b/sal/qa/rtl/alloc/makefile.mk
@@ -66,5 +66,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/bootstrap/makefile.mk b/sal/qa/rtl/bootstrap/makefile.mk
index 1cf9815..4d0efaa 100644
--- a/sal/qa/rtl/bootstrap/makefile.mk
+++ b/sal/qa/rtl/bootstrap/makefile.mk
@@ -72,5 +72,4 @@ APP2STDLIBS=$(SALLIB)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/cipher/makefile.mk b/sal/qa/rtl/cipher/makefile.mk
index b89e392..06b30ff 100644
--- a/sal/qa/rtl/cipher/makefile.mk
+++ b/sal/qa/rtl/cipher/makefile.mk
@@ -66,5 +66,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk
index 6bd3bd8..0002e53 100755
--- a/sal/qa/rtl/crc32/makefile.mk
+++ b/sal/qa/rtl/crc32/makefile.mk
@@ -66,5 +66,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/digest/makefile.mk b/sal/qa/rtl/digest/makefile.mk
index c084b5c..8d6077a 100644
--- a/sal/qa/rtl/digest/makefile.mk
+++ b/sal/qa/rtl/digest/makefile.mk
@@ -58,5 +58,4 @@ SLOFILES= \
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk
index b13ccf4..622eca8 100644
--- a/sal/qa/rtl/doublelock/makefile.mk
+++ b/sal/qa/rtl/doublelock/makefile.mk
@@ -69,4 +69,4 @@ SLOFILES=$(SHL1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk
index 329769b..a9c6973 100644
--- a/sal/qa/rtl/locale/makefile.mk
+++ b/sal/qa/rtl/locale/makefile.mk
@@ -67,5 +67,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/logfile/makefile.mk b/sal/qa/rtl/logfile/makefile.mk
index 9b52e0a..d6b2065 100644
--- a/sal/qa/rtl/logfile/makefile.mk
+++ b/sal/qa/rtl/logfile/makefile.mk
@@ -60,4 +60,4 @@ SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk
index 3b35e52..6b7a8c2 100644
--- a/sal/qa/rtl/math/makefile.mk
+++ b/sal/qa/rtl/math/makefile.mk
@@ -93,5 +93,4 @@ SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/ostring/makefile.mk b/sal/qa/rtl/ostring/makefile.mk
index 06469b3..0ff4245 100644
--- a/sal/qa/rtl/ostring/makefile.mk
+++ b/sal/qa/rtl/ostring/makefile.mk
@@ -89,5 +89,4 @@ SHL3VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/oustring/makefile.mk b/sal/qa/rtl/oustring/makefile.mk
index 6f15637..936f9f6 100644
--- a/sal/qa/rtl/oustring/makefile.mk
+++ b/sal/qa/rtl/oustring/makefile.mk
@@ -78,5 +78,4 @@ SHL2VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/process/makefile.mk b/sal/qa/rtl/process/makefile.mk
index 81fc0b6..c680c19 100644
--- a/sal/qa/rtl/process/makefile.mk
+++ b/sal/qa/rtl/process/makefile.mk
@@ -73,4 +73,4 @@ SLOFILES=$(SHL1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk
index c82ae0a..6835a1a 100644
--- a/sal/qa/rtl/random/makefile.mk
+++ b/sal/qa/rtl/random/makefile.mk
@@ -55,4 +55,4 @@ SLOFILES= \
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/textenc/makefile.mk b/sal/qa/rtl/textenc/makefile.mk
index 597309d..8353621 100644
--- a/sal/qa/rtl/textenc/makefile.mk
+++ b/sal/qa/rtl/textenc/makefile.mk
@@ -72,4 +72,4 @@ SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/uri/makefile.mk b/sal/qa/rtl/uri/makefile.mk
index d4a8814..9972705 100644
--- a/sal/qa/rtl/uri/makefile.mk
+++ b/sal/qa/rtl/uri/makefile.mk
@@ -72,4 +72,4 @@ SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/uuid/makefile.mk b/sal/qa/rtl/uuid/makefile.mk
index 40e583f..0158741 100644
--- a/sal/qa/rtl/uuid/makefile.mk
+++ b/sal/qa/rtl/uuid/makefile.mk
@@ -64,5 +64,4 @@ SLOFILES=$(SHL1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl_strings/makefile.mk b/sal/qa/rtl_strings/makefile.mk
index 387f067..1774928 100644
--- a/sal/qa/rtl_strings/makefile.mk
+++ b/sal/qa/rtl_strings/makefile.mk
@@ -148,6 +148,4 @@ SLOFILES=\
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/systools/makefile.mk b/sal/qa/systools/makefile.mk
index af45f4f..9113358 100644
--- a/sal/qa/systools/makefile.mk
+++ b/sal/qa/systools/makefile.mk
@@ -66,5 +66,4 @@ SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
-
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/testHelperFunctions/makefile.mk b/sal/qa/testHelperFunctions/makefile.mk
index 4bdc0bd..f5777ba 100644
--- a/sal/qa/testHelperFunctions/makefile.mk
+++ b/sal/qa/testHelperFunctions/makefile.mk
@@ -60,4 +60,4 @@ SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
commit 4685d7e6a7e487de431b3eb41b22cfa1943f3266
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 22 13:00:35 2011 +0000
make these tests less noisy
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 9087978..9bcd99f 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -1283,24 +1283,11 @@ namespace osl_Thread
sal_Int32 nValueNormal = 0;
nValueNormal = aNormalThread.getValue();
- // sal_Int32 nValueBelowNormal = 0;
- //nValueBelowNormal = aBelowNormalThread->getValue();
- // sal_Int32 nValueLowest = 0;
- //nValueLowest = aLowestThread->getValue();
t_print("After 10 tenth seconds\n");
t_print("nValue in Highest Prio Thread is %d\n", (int) nValueHighest);
t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal);
t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
- // LLA: this is not a save test, so we only check if all values not zero
- // LLA: CPPUNIT_ASSERT_MESSAGE(
- // LLA: "SetPriority",
- // LLA: nValueHighest >= nValueAboveNormal &&
- // LLA: nValueAboveNormal >= nValueNormal &&
- // LLA: nValueNormal > 0
- // LLA: );
-
-// LLA: windows let starve threads with lower priority
#ifndef WNT
CPPUNIT_ASSERT_MESSAGE(
"SetPriority",
@@ -1384,17 +1371,6 @@ namespace osl_Thread
delete pBelowNormalThread;
delete pLowestThread;
- // LLA: this is not a save test, so we only check if all values not zero
- // LLA: CPPUNIT_ASSERT_MESSAGE(
- // LLA: "SetPriority",
- // LLA: nValueHighest > nValueAboveNormal &&
- // LLA: nValueAboveNormal > nValueNormal &&
- // LLA: nValueNormal > nValueBelowNormal &&
- // LLA: nValueBelowNormal > nValueLowest &&
- // LLA: nValueLowest > 0
- // LLA: );
-
-// LLA: windows let starve threads with lower priority
#ifndef WNT
CPPUNIT_ASSERT_MESSAGE(
"SetPriority",
@@ -1468,7 +1444,6 @@ namespace osl_Thread
nValueLowest = pLowestThread->getValue();
t_print("After 5 tenth seconds\n");
- // t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal);
t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal);
@@ -1480,17 +1455,6 @@ namespace osl_Thread
delete pBelowNormalThread;
delete pLowestThread;
- // LLA: this is not a save test, so we only check if all values not zero
- // LLA: CPPUNIT_ASSERT_MESSAGE(
- // LLA: "SetPriority",
- // LLA: nValueHighest > nValueAboveNormal &&
- // LLA: nValueAboveNormal > nValueNormal &&
- // LLA: nValueNormal > nValueBelowNormal &&
- // LLA: nValueBelowNormal > nValueLowest &&
- // LLA: nValueLowest > 0
- // LLA: );
-
-// LLA: windows let starve threads with lower priority
#ifndef WNT
CPPUNIT_ASSERT_MESSAGE(
"SetPriority",
@@ -1563,29 +1527,14 @@ namespace osl_Thread
nValueLowest = pLowestThread->getValue();
t_print("After 5 tenth seconds\n");
- // t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
- // t_print("nValue in AboveNormal Prio Thread is %d\n",nValueAboveNormal);
t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal);
t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest);
- // delete pHighestThread;
- // delete pAboveNormalThread;
delete pNormalThread;
delete pBelowNormalThread;
delete pLowestThread;
- // LLA: this is not a save test, so we only check if all values not zero
- // LLA: CPPUNIT_ASSERT_MESSAGE(
- // LLA: "SetPriority",
- // LLA: nValueHighest > nValueAboveNormal &&
- // LLA: nValueAboveNormal > nValueNormal &&
- // LLA: nValueNormal > nValueBelowNormal &&
- // LLA: nValueBelowNormal > nValueLowest &&
- // LLA: nValueLowest > 0
- // LLA: );
-
-// LLA: windows let starve threads with lower priority
#ifndef WNT
CPPUNIT_ASSERT_MESSAGE(
"SetPriority",
@@ -1719,17 +1668,12 @@ namespace osl_Thread
{
oslThreadIdentifier oId;
OCountThread* pCountThread = new OCountThread;
- //OCountThread* pCountThread2 = new OCountThread;
pCountThread->create();
- //pCountThread2->create();
pCountThread->setWait(3);
oId = Thread::getCurrentIdentifier();
oslThreadIdentifier oIdChild = pCountThread->getIdentifier();
- //t_print("CurrentId is %ld, Child1 id is %ld, Child2 id is %ld\n",oId, oIdChild,pCountThread2->m_id );
termAndJoinThread(pCountThread);
delete pCountThread;
- //termAndJoinThread(pCountThread2);
- //delete pCountThread2;
CPPUNIT_ASSERT_MESSAGE(
"Get the identifier for the current active thread.",
@@ -1808,48 +1752,9 @@ namespace osl_Thread
);
}
-// LLA: wait_001 does the same.
-// LLA: /** wait then terminate the thread
-// LLA:
-// LLA: ALGORITHM:
-// LLA: wait nWaitSec seconds, and terminate when the wait does not finish
-// LLA: Windows & UNX: thread terminates immediatlly
-// LLA: */
-// LLA: void wait_002()
-// LLA: {
-// LLA: OCountThread aThread;
-// LLA:
-// LLA: sal_Int32 nWaitSec = 3;
-// LLA: aThread.setWait(nWaitSec);
-// LLA:
-// LLA: sal_Bool bRes = aThread.create();
-// LLA: CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True );
-// LLA:
-// LLA: StopWatch aStopWatch;
-// LLA: // TimeValue aTimeVal_befor;
-// LLA: // osl_getSystemTime( &aTimeVal_befor );
-// LLA: aStopWatch.start();
-// LLA:
-// LLA: termAndJoinThread(&aThread);
-// LLA: sal_Int32 nValue = aThread.getValue();
-// LLA:
-// LLA: // TimeValue aTimeVal_after;
-// LLA: // osl_getSystemTime( &aTimeVal_after );
-// LLA: aStopWatch.stop();
-// LLA: // sal_Int32 nSec = aTimeVal_after.Seconds - aTimeVal_befor.Seconds;
-// LLA: double nSec = aStopWatch.getSeconds();
-// LLA: t_print("sec=%f\n", nSec);
-// LLA: t_print("nValue = %d\n", nValue);
-// LLA:
-// LLA: CPPUNIT_ASSERT_MESSAGE(
-// LLA: "Wait: Blocks the calling thread for the given number of time.",
-// LLA: nSec < 1 && nValue == 0
-// LLA: );
-// LLA: }
CPPUNIT_TEST_SUITE(wait);
CPPUNIT_TEST(wait_001);
- // LLA: CPPUNIT_TEST(wait_002);
CPPUNIT_TEST_SUITE_END();
}; // class wait
@@ -2023,7 +1928,6 @@ namespace osl_Thread
// destroy function when the binding thread terminate
void SAL_CALL destroyCallback(void * data)
{
- t_print("destroying local data %s\n", (char *) data);
delete[] (char *) data;
}
@@ -2197,7 +2101,6 @@ namespace osl_ThreadData
// at first, set the data a value
char* pc = new char[2];
char m_nData = 'm';
-// strcpy(pc, &m_nData);
memcpy(pc, &m_nData, 1);
pc[1] = '\0';
myThreadData.setData(pc);
@@ -2210,7 +2113,6 @@ namespace osl_ThreadData
// setData the second time
char* pc2 = new char[2];
m_nData = 'o';
-// strcpy(pc2, &m_nData);
memcpy(pc2, &m_nData, 1);
pc2[1] = '\0';
@@ -2259,7 +2161,6 @@ namespace osl_ThreadData
char* pc = new char[2];
char m_nData[] = "i";
strcpy(pc, m_nData);
- t_print("pc %s\n", pc);
myThreadData.setData(pc);
myKeyThread aThread1('c');
@@ -2289,12 +2190,9 @@ namespace osl_ThreadData
{
char* pc = new char[2];
char m_nData = 'i';
-// strcpy(pc, &m_nData);
memcpy(pc, &m_nData, 1);
pc[1] = '\0';
-// strncpy(pc, &m_nData, sizeof(char);
- t_print("pc %s\n", pc);
myThreadData.setData(pc);
myKeyThread aThread1('a');
@@ -2304,11 +2202,9 @@ namespace osl_ThreadData
// change the value which pc points
char m_nData2 = 'j';
- // strcpy(pc, &m_nData2);
memcpy(pc, &m_nData2, 1);
pc[1] = '\0';
- //t_print("pc %s\n", pc);
void* pChar = myThreadData.getData();
char aChar = *(char*)pChar;
diff --git a/sal/qa/osl/process/osl_process_child.cxx b/sal/qa/osl/process/osl_process_child.cxx
index 340af58..124fcd1 100644
--- a/sal/qa/osl/process/osl_process_child.cxx
+++ b/sal/qa/osl/process/osl_process_child.cxx
@@ -108,27 +108,15 @@ void w_to_a(LPCTSTR _strW, LPSTR strA, DWORD size)
//########################################
int main(int argc, char* argv[])
{
- rtl::OUString s;
-
- //t_print("Parameter: ");
- printf("child process Parameter: ");
- for (int i = 1; i < argc; i++)
- printf("%s ", argv[i]);
- printf("\n");
-
if (argc > 2)
{
if (0 == strcmp("-join", argv[1]))
- {
wait_for_seconds(argv[2]);
- }
else if (0 == strcmp("-env", argv[1]))
- {
dump_env(argv[2]);
- }
}
- return (0);
+ return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 4c86407..8508f60 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -607,40 +607,39 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
t_print("Computer Name: ");
if ( strComputerName == aNullURL )
- t_print(" Not retrived\n" );
+ t_print("Not retrived\n" );
else
printUString( strComputerName );
t_print("Current User Name: ");
if ( strUserName == aNullURL )
- t_print(" Not retrived\n" );
+ t_print("Not retrived\n" );
else
printUString( strUserName );
t_print("Current User Home Directory:");
if ( strHomeDirectory == aNullURL )
- t_print(" Not retrived\n" );
+ t_print("Not retrived\n" );
else
printUString( strHomeDirectory );
t_print("Current Config Directory: ");
if ( strConfigDirectory == aNullURL )
- t_print(" Not retrived\n" );
+ t_print("Not retrived\n" );
else
printUString( strConfigDirectory );
t_print("Current UserID: ");
if ( strUserID == aNullURL )
- t_print(" Not retrived\n" );
+ t_print("Not retrived\n" );
else
printUString( strUserID );
- t_print("Current User is");
+ t_print("Current User is: ");
if ( isAdmin == sal_False )
- t_print(" NOT Administrator.\n" );
+ t_print("NOT Administrator.\n" );
else
- t_print(" Administrator.\n" );
-
+ t_print("Administrator.\n" );
/// get and display forwarded text if available.
aStringForward = ::rtl::OUString::createFromAscii( parameters.getCommandLine().c_str() );
commit 50d6bae0ed6608573c9cb1b66a09ee3bbdbe3b1d
Author: Wilhelm Pflueger <Wilhelm.Pflueger at web.de>
Date: Sun Feb 20 01:57:37 2011 +0100
EasyHacks: Re-animate tests in sal/qa/osl
Some tests in osl_process are not running:
a) the batch file for the batch test is not copied to the
execution path
b) osl_execProc_exe_name_in_argument_list() throws an assertion.
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 1b38581..40e5e5c 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -1,4 +1,4 @@
-sa sal : xml2cmp external BOOST:boost CPPUNIT:cppunit NULL
+sa sal : xml2cmp external BOOST:boost CPPUNIT:cppunit NULL
sa sal usr1 - all sa_mkout NULL
sa sal\inc nmake - all sa_inc NULL
sa sal\typesconfig nmake - u sa_tc sa_inc NULL
@@ -21,5 +21,7 @@ sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NUL
sa sal\qa\osl\file nmake - u sa_qa_osl_file sa_cppunittester sa_util NULL
sa sal\qa\osl\module nmake - u sa_qa_osl_module sa_cppunittester sa_util NULL
sa sal\qa\osl\condition nmake - all sa_qa_osl_condition sa_cppunittester sa_util NULL
+sa sal\qa\osl\security nmake - all sa_qa_osl_security sa_cppunittester sa_util NULL
+sa sal\qa\osl\process nmake - all sa_qa_osl_process sa_cppunittester sa_util NULL
sa sal\qa\rtl\strings nmake - all sa_qa_rt_strings sa_cppunittester sa_util NULL
sa sal\qa\rtl\oustringbuffer nmake - all sa_qa_rt_oustringbuffer sa_cppunittester sa_util NULL
diff --git a/sal/qa/osl/process/batch.sh b/sal/qa/osl/process/batch.sh
new file mode 100755
index 0000000..fd3828c
--- /dev/null
+++ b/sal/qa/osl/process/batch.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "Hello world"
\ No newline at end of file
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index 2bcbe48..e04bebc 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -77,6 +77,9 @@ APP3TARGET=osl_process_child
APP3OBJS=$(OBJ3FILES)
APP3STDLIBS=$(SALLIB)
+#TODO: The Linux and WinDOS batch file must be copied to $(BIN) directory!
+# I dont't know how to do this....
+
#------------------------------- All object files -------------------------------
# do this here, so we get right dependencies
@@ -94,3 +97,4 @@ SLOFILES=$(SHL1OBJS) $(SHL2OBJS)
.INCLUDE : target.mk
.INCLUDE : _cppunit.mk
+
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index eb5ec5e..9087978 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,7 +42,13 @@
#include <osl/mutex.hxx>
#include <osl/time.h>
-#include <testshl/simpleheader.hxx>
+#include <string.h>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#define t_print printf
using namespace osl;
using namespace rtl;
@@ -89,7 +95,7 @@ void StopWatch::start()
m_bIsValid = false;
m_bIsRunning = true;
osl_getSystemTime( &t1 );
- t_print("# %d %d nsecs\n", t1.Seconds, t1.Nanosec);
+ t_print("# %u %u nsecs\n", (unsigned)t1.Seconds, (unsigned)t1.Nanosec);
// gettimeofday(&t1, 0);
}
@@ -100,7 +106,7 @@ void StopWatch::stop()
// gettimeofday(&t2, 0); // Timer ausfragen
osl_getSystemTime( &t2 );
- t_print("# %d %d nsecs\n", t2.Seconds, t2.Nanosec);
+ t_print("# %u %u nsecs\n", (unsigned) t2.Seconds, (unsigned) t2.Nanosec);
if (m_bIsRunning)
{ // check ob gestartet.
@@ -120,7 +126,7 @@ void StopWatch::stop()
m_nNanoSec = 1000000000 + static_cast<sal_Int32>(t2.Nanosec) - static_cast<sal_Int32>(t1.Nanosec);
m_nSeconds -= 1;
}
- t_print("# %d %d nsecs\n", m_nSeconds, m_nNanoSec );
+ t_print("# %u %u nsecs\n", (unsigned) m_nSeconds, (unsigned) m_nNanoSec );
//if (m_nNanoSec < 0)
//{
//m_nNanoSec += 1000000000;
@@ -290,7 +296,7 @@ public:
OCountThread()
{
m_nWaitSec = 0;
- t_print("new OCountThread thread %d!\n", getIdentifier());
+ t_print("new OCountThread thread %u!\n", (unsigned) getIdentifier());
}
sal_Int32 getValue() { return m_aFlag.getValue(); }
@@ -336,7 +342,7 @@ protected:
}
void SAL_CALL onTerminated()
{
- t_print("normally terminate this thread %d!\n", getIdentifier());
+ t_print("normally terminate this thread %u!\n", (unsigned) getIdentifier());
}
public:
@@ -431,12 +437,12 @@ protected:
}
void SAL_CALL onTerminated()
{
- t_print("normally terminate this thread %d!\n", getIdentifier());
+ t_print("normally terminate this thread %u!\n", (unsigned) getIdentifier());
}
public:
ONoScheduleThread()
{
- t_print("new thread id %d!\n", getIdentifier());
+ t_print("new thread id %u!\n", (unsigned) getIdentifier());
}
~ONoScheduleThread()
{
@@ -561,8 +567,8 @@ namespace osl_Thread
termAndJoinThread(newthread);
delete newthread;
- t_print(" nValue = %d\n", nValue);
- t_print("isRunning = %d\n", isRunning);
+ t_print(" nValue = %d\n", (int) nValue);
+ t_print("isRunning = %s\n", isRunning == sal_True ? "true" : "false");
CPPUNIT_ASSERT_MESSAGE(
"Creates a new thread",
@@ -738,7 +744,7 @@ namespace osl_Thread
//{
ThreadHelper::thread_sleep_tenth_sec(3);
nValue = aThread->getValue(); // (1)
- t_print(" getValue is %d !", nValue );
+ t_print(" getValue is %d !", (int) nValue );
if (nValue >= 2)
{
aThread->setSuspend();
@@ -814,9 +820,9 @@ namespace osl_Thread
termAndJoinThread(pCountThread);
delete pCountThread;
- t_print("SuspendValue: %d\n", nSuspendValue);
- t_print("ResumeValue: %d\n", nResumeValue);
- t_print("LaterValue: %d\n", nLaterValue);
+ t_print("SuspendValue: %d\n", (int) nSuspendValue);
+ t_print("ResumeValue: %d\n", (int) nResumeValue);
+ t_print("LaterValue: %d\n", (int) nLaterValue);
/* LLA: this assumption is no longer relevant: nResumeValue == nSuspendValue && */
CPPUNIT_ASSERT_MESSAGE(
@@ -843,7 +849,7 @@ namespace osl_Thread
termAndJoinThread(newthread);
delete newthread;
- t_print(" nValue = %d\n", nValue);
+ t_print(" nValue = %d\n", (int) nValue);
CPPUNIT_ASSERT_MESSAGE(
"Creates a suspended thread, then resume",
@@ -893,8 +899,8 @@ namespace osl_Thread
aCountThread->join();
delete aCountThread;
- t_print(" nValue = %d\n", nValue);
- t_print("nLaterValue = %d\n", nLaterValue);
+ t_print(" nValue = %d\n", (int) nValue);
+ t_print("nLaterValue = %d\n", (int) nLaterValue);
CPPUNIT_ASSERT_MESSAGE(
"Terminate the thread",
@@ -922,8 +928,8 @@ namespace osl_Thread
sal_Int32 nLaterValue = aCountThread->getValue();
delete aCountThread;
- t_print(" nValue = %d\n", nValue);
- t_print("nLaterValue = %d\n", nLaterValue);
+ t_print(" nValue = %d\n", (int) nValue);
+ t_print("nLaterValue = %d\n", (int) nLaterValue);
CPPUNIT_ASSERT_MESSAGE(
"Suspend then resume the thread",
@@ -1178,8 +1184,8 @@ namespace osl_Thread
rtl::OString sPrio = getPrioName(_aPriority);
t_print("After 10 tenth seconds\n");
- t_print("nValue in %s Prio Thread is %d\n",sPrio.getStr(), nValueNormal);
- t_print("nValue in %s Prio Thread is %d\n", sPrio.getStr(), nValueNormal2);
+ t_print("nValue in %s Prio Thread is %d\n",sPrio.getStr(), (int) nValueNormal);
+ t_print("nValue in %s Prio Thread is %d\n", sPrio.getStr(), (int) nValueNormal2);
// ThreadHelper::thread_sleep_tenth_sec(1);
pThread->join();
@@ -1196,7 +1202,7 @@ namespace osl_Thread
);
double nDeltaPercent = nDelta / nQuotient * 100;
- t_print("Delta value %d, percent %f\n",nDelta, nDeltaPercent);
+ t_print("Delta value %d, percent %f\n", (int) nDelta, nDeltaPercent);
// LLA: it's not a bug if the current OS is not able to handle thread scheduling right and good.
// like Windows XP
@@ -1282,9 +1288,9 @@ namespace osl_Thread
// sal_Int32 nValueLowest = 0;
//nValueLowest = aLowestThread->getValue();
t_print("After 10 tenth seconds\n");
- t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
- t_print("nValue in AboveNormal Prio Thread is %d\n",nValueAboveNormal);
- t_print("nValue in Normal Prio Thread is %d\n",nValueNormal);
+ t_print("nValue in Highest Prio Thread is %d\n", (int) nValueHighest);
+ t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal);
+ t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
// LLA: this is not a save test, so we only check if all values not zero
// LLA: CPPUNIT_ASSERT_MESSAGE(
@@ -1366,11 +1372,11 @@ namespace osl_Thread
nValueLowest = pLowestThread->getValue();
t_print("After 10 tenth seconds\n");
- t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
- t_print("nValue in AboveNormal Prio Thread is %d\n",nValueAboveNormal);
- t_print("nValue in Normal Prio Thread is %d\n",nValueNormal);
- t_print("nValue in BelowNormal Prio Thread is %d\n",nValueBelowNormal);
- t_print("nValue in Lowest Prio Thread is %d\n",nValueLowest);
+ t_print("nValue in Highest Prio Thread is %d\n", (int) nValueHighest);
+ t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal);
+ t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
+ t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal);
+ t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest);
delete pHighestThread;
delete pAboveNormalThread;
@@ -1463,10 +1469,10 @@ namespace osl_Thread
t_print("After 5 tenth seconds\n");
// t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
- t_print("nValue in AboveNormal Prio Thread is %d\n",nValueAboveNormal);
- t_print("nValue in Normal Prio Thread is %d\n",nValueNormal);
- t_print("nValue in BelowNormal Prio Thread is %d\n",nValueBelowNormal);
- t_print("nValue in Lowest Prio Thread is %d\n",nValueLowest);
+ t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal);
+ t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
+ t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal);
+ t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest);
// delete pHighestThread;
delete pAboveNormalThread;
@@ -1559,9 +1565,9 @@ namespace osl_Thread
t_print("After 5 tenth seconds\n");
// t_print("nValue in Highest Prio Thread is %d\n",nValueHighest);
// t_print("nValue in AboveNormal Prio Thread is %d\n",nValueAboveNormal);
- t_print("nValue in Normal Prio Thread is %d\n",nValueNormal);
- t_print("nValue in BelowNormal Prio Thread is %d\n",nValueBelowNormal);
- t_print("nValue in Lowest Prio Thread is %d\n",nValueLowest);
+ t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal);
+ t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal);
+ t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest);
// delete pHighestThread;
// delete pAboveNormalThread;
@@ -1794,7 +1800,7 @@ namespace osl_Thread
delete aCountThread;
t_print("nTenthSec = %f \n", nTenthSec);
t_print("nSec = %f \n", nSec);
- t_print("nValue = %d \n", nValue);
+ t_print("nValue = %d \n", (int) nValue);
CPPUNIT_ASSERT_MESSAGE(
"Wait: Blocks the calling thread for the given number of time.",
@@ -1906,8 +1912,8 @@ namespace osl_Thread
ThreadHelper::thread_sleep_tenth_sec(3);
sal_Int32 nLaterValue = aThread->getValue();
// resumeAndWaitThread(aThread);
- t_print(" value = %d\n", nValue);
- t_print("later value = %d\n", nLaterValue);
+ t_print(" value = %d\n", (int) nValue);
+ t_print("later value = %d\n", (int) nLaterValue);
// if value and latervalue not equal, than the thread would not suspended
CPPUNIT_ASSERT_MESSAGE(
@@ -1924,8 +1930,8 @@ namespace osl_Thread
aThread->join();
sal_Int32 nValue_join = aThread->getValue();
- t_print("value after term = %d\n", nValue_term);
- t_print("value after join = %d\n", nValue_join);
+ t_print("value after term = %d\n", (int) nValue_term);
+ t_print("value after join = %d\n", (int) nValue_join);
// nValue_term and nValue_join should be the same
// but should be differ from nValue
@@ -1957,8 +1963,8 @@ namespace osl_Thread
resumeAndWaitThread(&aThread);
- t_print(" value = %d\n", nValue);
- t_print("later value = %d\n", nLaterValue);
+ t_print(" value = %d\n", (int) nValue);
+ t_print("later value = %d\n", (int) nLaterValue);
//On windows, suspend works, so the values are same
#ifdef WNT
@@ -1981,7 +1987,7 @@ namespace osl_Thread
termAndJoinThread(&aThread);
sal_Int32 nValue_term = aThread.getValue();
- t_print(" value term = %d\n", nValue_term);
+ t_print(" value term = %d\n", (int) nValue_term);
CPPUNIT_ASSERT_MESSAGE(
"Schedule: don't schedule in thread run method, terminate failed.",
@@ -2326,13 +2332,13 @@ namespace osl_ThreadData
}; // class getData
// -----------------------------------------------------------------------------
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ThreadData::ctors, "osl_ThreadData");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ThreadData::setData, "osl_ThreadData");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ThreadData::getData, "osl_ThreadData");
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_ThreadData::ctors);
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_ThreadData::setData);
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_ThreadData::getData);
} // namespace osl_ThreadData
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index fd3eed3..5cfee5c 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,7 +29,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#define t_print printf
+
#include <osl/process.h>
#include <osl/file.hxx>
#include <osl/thread.h>
@@ -602,7 +607,11 @@ public:
void osl_execProc_test_batch()
{
oslProcess process;
+#if defined(WNT) || defined(OS2)
rtl::OUString suBatch = suCWD + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("batch.bat"));
+#else
+ rtl::OUString suBatch = suCWD + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("batch.sh"));
+#endif
oslProcessError osl_error = osl_executeProcess(
suBatch.pData,
NULL,
@@ -670,16 +679,18 @@ public:
CPPUNIT_TEST_SUITE(Test_osl_executeProcess);
CPPUNIT_TEST(osl_execProc_parent_equals_child_environment);
CPPUNIT_TEST(osl_execProc_merged_child_environment);
- CPPUNIT_TEST(osl_execProc_test_batch);
- CPPUNIT_TEST(osl_execProc_exe_name_in_argument_list);
+ ///TODO: Repair makefile to get the batch.sh, batch.bat copied to $(BIN) for test execution
+ // CPPUNIT_TEST(osl_execProc_test_batch);
+ ///TODO: Repair test (or tested function ;-) - test fails.
+ // CPPUNIT_TEST(osl_execProc_exe_name_in_argument_list);
CPPUNIT_TEST_SUITE_END();
};
//#####################################
// register test suites
//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test_osl_joinProcess, "Test_osl_joinProcess");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test_osl_executeProcess, "Test_osl_executeProcess");
+CPPUNIT_TEST_SUITE_REGISTRATION(Test_osl_executeProcess);
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/process/osl_process_child.cxx b/sal/qa/osl/process/osl_process_child.cxx
index 21be0f2..340af58 100644
--- a/sal/qa/osl/process/osl_process_child.cxx
+++ b/sal/qa/osl/process/osl_process_child.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,6 +48,7 @@
#include <stdlib.h>
#include <iostream>
#include <fstream>
+#include <string.h>
#include <rtl/ustring.hxx>
@@ -62,7 +63,7 @@
//########################################
void wait_for_seconds(char* time)
-{
+{
SLEEP(atoi(time));
}
@@ -77,36 +78,36 @@ void w_to_a(LPCTSTR _strW, LPSTR strA, DWORD size)
}
//########################################
void dump_env(char* file_path)
- {
+ {
LPTSTR env = reinterpret_cast<LPTSTR>(
GetEnvironmentStrings());
LPTSTR p = env;
std::ofstream file(file_path);
-
- char buffer[32767];
+
+ char buffer[32767];
while (size_t l = _tcslen(reinterpret_cast<wchar_t*>(p)))
- {
- w_to_a(p, buffer, sizeof(buffer));
- file << buffer << std::endl;
- p += l + 1;
- }
- FreeEnvironmentStrings(env);
- }
+ {
+ w_to_a(p, buffer, sizeof(buffer));
+ file << buffer << std::endl;
+ p += l + 1;
+ }
+ FreeEnvironmentStrings(env);
+ }
#else
extern char** environ;
-
+
void dump_env(char* file_path)
- {
- std::ofstream file(file_path);
- for (int i = 0; NULL != environ[i]; i++)
- file << environ[i] << std::endl;
- }
+ {
+ std::ofstream file(file_path);
+ for (int i = 0; NULL != environ[i]; i++)
+ file << environ[i] << std::endl;
+ }
#endif
//########################################
int main(int argc, char* argv[])
-{
+{
rtl::OUString s;
//t_print("Parameter: ");
@@ -114,7 +115,7 @@ int main(int argc, char* argv[])
for (int i = 1; i < argc; i++)
printf("%s ", argv[i]);
printf("\n");
-
+
if (argc > 2)
{
if (0 == strcmp("-join", argv[1]))
@@ -124,7 +125,7 @@ int main(int argc, char* argv[])
else if (0 == strcmp("-env", argv[1]))
{
dump_env(argv[2]);
- }
+ }
}
return (0);
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 28de6f1..4c86407 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,11 +28,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-
+
//------------------------------------------------------------------------
// header file
//------------------------------------------------------------------------
-#include <osl_Security_Const.h>
+#include <osl_Security_Const.h>
using namespace osl;
using namespace rtl;
@@ -47,14 +47,14 @@ using namespace rtl;
inline void printBool( sal_Bool bOk )
{
//t_print("#printBool# " );
- ( sal_True == bOk ) ? t_print("TRUE!\n" ): t_print("FALSE!\n" );
+ ( sal_True == bOk ) ? t_print("TRUE!\n" ): t_print("FALSE!\n" );
}
/** print a UNI_CODE String.
*/
inline void printUString( const ::rtl::OUString & str )
{
- rtl::OString aString;
+ rtl::OString aString;
//t_print("#printUString_u# " );
aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
@@ -76,21 +76,21 @@ namespace osl_Security
{
public:
sal_Bool bRes, bRes1;
-
+
void ctors_001( )
{
::osl::Security aSec;
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a security its handle should not be NULL.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a security its handle should not be NULL.",
aSec.getHandle( ) != NULL );
}
-
+
CPPUNIT_TEST_SUITE( ctors );
CPPUNIT_TEST( ctors_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class ctors
-
-
+
+
/** testing the methods:
inline sal_Bool SAL_CALL logonUser(const ::rtl::OUString& strName,
const ::rtl::OUString& strPasswd);
@@ -102,38 +102,38 @@ namespace osl_Security
{
public:
sal_Bool bRes;
-
+
void logonUser_user_pwd( )
{
- ::osl::Security aSec;
+ ::osl::Security aSec;
bRes = aSec.logonUser( aLogonUser, aLogonPasswd );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd, passed in (UNX), failed in (W32).",
- ( sal_True == bRes ) );
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd, passed in (UNX), failed in (W32).",
+ ( sal_True == bRes ) );
}
-
+
void logonUser_user_pwd_server( )
{
- ::osl::Security aSec;
+ ::osl::Security aSec;
bRes = aSec.logonUser( aLogonUser, aLogonPasswd, aFileServer );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd and server name, failed in (UNX)(W32).",
- ( sal_True == bRes ) );
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd and server name, failed in (UNX)(W32).",
+ ( sal_True == bRes ) );
}
CPPUNIT_TEST_SUITE( logonUser );
if ( !aStringForward.equals( aNullURL ) && aStringForward.indexOf( (sal_Unicode)' ' ) != -1 && ( aStringForward.indexOf( ( sal_Unicode ) ' ' ) == aStringForward.lastIndexOf( ( sal_Unicode ) ' ' ) ) )
- /// if user name and passwd are forwarded
+ /// if user name and passwd are forwarded
{
- CPPUNIT_TEST( logonUser_user_pwd );
+ CPPUNIT_TEST( logonUser_user_pwd );
}
if ( !aStringForward.equals( aNullURL ) && aStringForward.indexOf( (sal_Unicode)' ' ) != -1 && ( aStringForward.indexOf( ( sal_Unicode ) ' ' ) != aStringForward.lastIndexOf( ( sal_Unicode ) ' ' ) ) )
- /// if user name and passwd and file server are forwarded
+ /// if user name and passwd and file server are forwarded
{
- CPPUNIT_TEST( logonUser_user_pwd_server );
+ CPPUNIT_TEST( logonUser_user_pwd_server );
}
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class logonUser
@@ -144,23 +144,23 @@ namespace osl_Security
{
public:
sal_Bool bRes, bRes1;
-
+
void getUserIdent_001( )
{
::osl::Security aSec;
::rtl::OUString strID;
bRes = aSec.getUserIdent( strID );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: get UserID and compare it with names got at the beginning of the test.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: get UserID and compare it with names got at the beginning of the test.",
( sal_True == strUserID.equals( strID ) ) && ( sal_True == bRes ));
}
-
+
CPPUNIT_TEST_SUITE( getUserIdent );
CPPUNIT_TEST( getUserIdent_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class getUserIdent
-
+
/** testing the method:
inline sal_Bool SAL_CALL getUserName( ::rtl::OUString& strName) const;
*/
@@ -168,33 +168,33 @@ namespace osl_Security
{
public:
sal_Bool bRes, bRes1;
-
+
void getUserName_001( )
{
::osl::Security aSec;
#ifdef WNT
::rtl::OUString strName( strUserName ), strGetName;
-#else
+#else
::rtl::OUString strName( strUserName ), strGetName;
-#endif
+#endif
bRes = aSec.getUserName( strGetName );
-
+
sal_Int32 nPos = -1;
if (strName.getLength() > 0)
{
nPos = strGetName.indexOf(strName);
}
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: get UserName and compare it with names got at the beginning of the test.",
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: get UserName and compare it with names got at the beginning of the test.",
( nPos >= 0 ) && ( sal_True == bRes ) );
}
-
+
CPPUNIT_TEST_SUITE( getUserName );
CPPUNIT_TEST( getUserName_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class getUserName
-
-
+
+
/** testing the method:
inline sal_Bool SAL_CALL getHomeDir( ::rtl::OUString& strDirectory) const;
*/
@@ -202,20 +202,20 @@ namespace osl_Security
{
public:
sal_Bool bRes, bRes1;
-
+
void getHomeDir_001( )
{
::osl::Security aSec;
::rtl::OUString strHome;
bRes = aSec.getHomeDir( strHome );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: getHomeDir and compare it with the info we get at the beginning.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: getHomeDir and compare it with the info we get at the beginning.",
( sal_True == strHomeDirectory.equals( strHome ) ) && ( sal_True == bRes ) );
}
-
+
CPPUNIT_TEST_SUITE( getHomeDir );
CPPUNIT_TEST( getHomeDir_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class getHomeDir
/** testing the method:
@@ -225,20 +225,20 @@ namespace osl_Security
{
public:
sal_Bool bRes, bRes1;
-
+
void getConfigDir_001( )
{
::osl::Security aSec;
::rtl::OUString strConfig;
bRes = aSec.getConfigDir( strConfig );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: getHomeDir and compare it with the info we get at the beginning.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: getHomeDir and compare it with the info we get at the beginning.",
( sal_True == strConfigDirectory.equals( strConfig ) ) && ( sal_True == bRes ) );
}
-
+
CPPUNIT_TEST_SUITE( getConfigDir );
CPPUNIT_TEST( getConfigDir_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class getConfigDir
/** testing the method:
@@ -248,19 +248,19 @@ namespace osl_Security
{
public:
sal_Bool bRes;
-
+
void isAdministrator_001( )
{
::osl::Security aSec;
bRes = aSec.isAdministrator( );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: check if the user is administrator at beginning, compare here.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: check if the user is administrator at beginning, compare here.",
bRes == isAdmin );
}
-
+
CPPUNIT_TEST_SUITE( isAdministrator );
CPPUNIT_TEST( isAdministrator_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class isAdministrator
/** testing the method:
@@ -270,34 +270,34 @@ namespace osl_Security
{
public:
sal_Bool bRes;
-
+
void getHandle_001( )
{
::osl::Security aSec;
bRes = aSec.isAdministrator( ) == osl_isAdministrator( aSec.getHandle( ) );
-
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: use getHandle function to call C API.",
+
+ CPPUNIT_ASSERT_MESSAGE( "#test comment#: use getHandle function to call C API.",
bRes == sal_True );
}
-
+
CPPUNIT_TEST_SUITE( getHandle );
CPPUNIT_TEST( getHandle_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class getHandle
class UserProfile : public CppUnit::TestFixture
{
public:
-
+
void loadUserProfile( )
{
::osl::Security aSec;
sal_Bool bValue = osl_loadUserProfile(aSec.getHandle());
-
+
CPPUNIT_ASSERT_MESSAGE( "empty function.", bValue == sal_False );
}
-
+
void unloadUserProfile( )
{
::osl::Security aSec;
@@ -308,13 +308,13 @@ namespace osl_Security
CPPUNIT_TEST_SUITE( UserProfile );
CPPUNIT_TEST( loadUserProfile );
CPPUNIT_TEST( unloadUserProfile );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class UserProfile
class loginUserOnFileServer : public CppUnit::TestFixture
{
public:
-
+
void loginUserOnFileServer_001( )
{
rtl::OUString suUserName;
@@ -324,43 +324,48 @@ namespace osl_Security
oslSecurity pSec = aSec.getHandle();
oslSecurityError erg = osl_loginUserOnFileServer(suUserName.pData, suPassword.pData, suFileServer.pData, &pSec);
-
+
CPPUNIT_ASSERT_MESSAGE( "empty function.", erg == osl_Security_E_UserUnknown );
}
CPPUNIT_TEST_SUITE( loginUserOnFileServer );
CPPUNIT_TEST( loginUserOnFileServer_001 );
- CPPUNIT_TEST_SUITE_END( );
+ CPPUNIT_TEST_SUITE_END( );
}; // class loginUserOnFileServer
-
+
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::ctors, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::logonUser, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::getUserIdent, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::getUserName, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::getHomeDir, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::getConfigDir, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::isAdministrator, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::getHandle, "osl_Security");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::UserProfile, "osl_Security");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Security::loginUserOnFileServer, "osl_Security");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::logonUser);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::getUserIdent);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::getUserName);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::getHomeDir);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::getConfigDir);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::isAdministrator);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::getHandle);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::UserProfile);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::loginUserOnFileServer);
// -----------------------------------------------------------------------------
-
+
} // namespace osl_Security
-// -----------------------------------------------------------------------------
+/* This defines an own TestPlugIn implementation with an own initialize()
+ method that will be called after loading the PlugIn
+ */
+#include <cppunit/plugin/TestPlugInDefaultImpl.h>
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
+class MyTestPlugInImpl: public CPPUNIT_NS::TestPlugInDefaultImpl
+{
+ public:
+ MyTestPlugInImpl() {};
+ void initialize( CPPUNIT_NS::TestFactoryRegistry *registry,
+ const CPPUNIT_NS::PlugInParameters ¶meters );
+};
-/** to do some initialized work, we replace the NOADDITIONAL macro with the initialize work which
- get current user name, .
-*/
-void RegisterAdditionalFunctions(FktRegFuncPtr)
+void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
+ const CPPUNIT_NS::PlugInParameters & parameters)
{
/// start message
t_print("#Initializing ...\n" );
@@ -369,12 +374,12 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
t_print("#testshl2 -forward \"username password\" ../../../wntmsci9/bin/Security.dll\n" );
t_print("# where username and password are forwarded account info.\n" );
t_print("#if no text forwarded, this function will be skipped.\n" );
-
+
/// get system information
-#if ( defined UNX ) || ( defined OS2 )
+#if ( defined UNX ) || ( defined OS2 )
/// some initialization work for UNIX OS
-
-
+
+
struct passwd* pw;
CPPUNIT_ASSERT_MESSAGE( "getpwuid: no password entry\n",( pw = getpwuid( getuid() ) ) != NULL );
@@ -383,37 +388,37 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
/// get user Name;
strUserName = ::rtl::OUString::createFromAscii( pw->pw_name );
-
+
/// get home directory;
- CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
+ CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( pw->pw_dir ), strHomeDirectory ) );
-
+
/// get config directory;
strConfigDirectory = strHomeDirectory.copy(0);
-
+
/// is administrator;
if( !getuid( ) )
isAdmin = sal_True;
-
+
#endif
-#if defined ( WNT )
+#if defined ( WNT )
/// some initialization work for Windows OS
- /// Get the user name, computer name, user home directory.
- LPTSTR lpszSystemInfo; // pointer to system information string
- DWORD cchBuff = BUFSIZE; // size of computer or user name
+ /// Get the user name, computer name, user home directory.
+ LPTSTR lpszSystemInfo; // pointer to system information string
+ DWORD cchBuff = BUFSIZE; // size of computer or user name
TCHAR tchBuffer[BUFSIZE]; // buffer for string
-
- lpszSystemInfo = tchBuffer;
- cchBuff = BUFSIZE;
+
+ lpszSystemInfo = tchBuffer;
+ cchBuff = BUFSIZE;
if( GetUserNameA(lpszSystemInfo, &cchBuff) )
strUserName = ::rtl::OUString::createFromAscii( lpszSystemInfo );
-
+
if( GetComputerName(lpszSystemInfo, &cchBuff) )
strComputerName = ::rtl::OUString::createFromAscii( lpszSystemInfo );
- /// Get user home directory.
+ /// Get user home directory.
HKEY hRegKey;
sal_Char PathA[_MAX_PATH];
::rtl::OUString strHome;
@@ -421,27 +426,27 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
{
LONG lRet, lSize = sizeof(PathA);
DWORD Type;
-
+
lRet = RegQueryValueEx(hRegKey, "AppData", NULL, &Type, ( unsigned char * )PathA, ( unsigned long * )&lSize);
if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _access( PathA, 0 ) == 0 ) )
{
- CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
+ CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( PathA ), strConfigDirectory ) );
}
-
+
lRet = RegQueryValueEx(hRegKey, "Personal", NULL, &Type, ( unsigned char * )PathA, ( unsigned long * )&lSize);
if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _access( PathA, 0 ) == 0 ) )
{
- CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
+ CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( PathA ), strHomeDirectory ) );
}
-
+
RegCloseKey(hRegKey);
}
/// Get user Security ID:
-
+
// Create buffers that may be large enough. If a buffer is too small, the count parameter will be set to the size needed.
const DWORD INITIAL_SIZE = 32;
DWORD cbSid = 0;
@@ -451,18 +456,18 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
WCHAR * wszDomainName = NULL;
SID_NAME_USE eSidType;
DWORD dwErrorCode = 0;
-
+
LPCWSTR wszAccName = ( LPWSTR ) strUserName.getStr( );
-
+
// Create buffers for the SID and the domain name.
PSID pSid = (PSID) new WIN_BYTE[dwSidBufferSize];
CPPUNIT_ASSERT_MESSAGE("# creating SID buffer failed.\n", pSid!= NULL );
memset( pSid, 0, dwSidBufferSize);
-
+
wszDomainName = new WCHAR[dwDomainBufferSize];
CPPUNIT_ASSERT_MESSAGE("# creating Domain name buffer failed.\n", wszDomainName != NULL );
memset(wszDomainName, 0, dwDomainBufferSize*sizeof(WCHAR));
-
+
// Obtain the SID for the account name passed.
for ( ; ; )
{
@@ -566,92 +571,92 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
}
strUserID = ::rtl::OUString::createFromAscii( Ident );
-
+
free(Ident);
delete pSid;
delete [] wszDomainName;
/// check if logged in user is administrator:
-
+
WIN_BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
- PSID AdministratorsGroup;
+ PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
- &AdministratorsGroup);
- if(b)
+ &AdministratorsGroup);
+ if(b)
{
- if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
+ if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
- }
- FreeSid(AdministratorsGroup);
- }
+ }
+ FreeSid(AdministratorsGroup);
+ }
isAdmin = ( sal_Bool )b;
#endif
- /// print the information.
+ /// print the information.
t_print("#\n#Retrived system information is below:\n");
-
+
t_print("Computer Name: ");
- if ( strComputerName == aNullURL )
+ if ( strComputerName == aNullURL )
t_print(" Not retrived\n" );
else
printUString( strComputerName );
-
+
t_print("Current User Name: ");
- if ( strUserName == aNullURL )
+ if ( strUserName == aNullURL )
t_print(" Not retrived\n" );
else
printUString( strUserName );
-
+
t_print("Current User Home Directory:");
- if ( strHomeDirectory == aNullURL )
+ if ( strHomeDirectory == aNullURL )
t_print(" Not retrived\n" );
else
printUString( strHomeDirectory );
t_print("Current Config Directory: ");
- if ( strConfigDirectory == aNullURL )
+ if ( strConfigDirectory == aNullURL )
t_print(" Not retrived\n" );
else
printUString( strConfigDirectory );
- t_print("Current UserID: ");
- if ( strUserID == aNullURL )
+ t_print("Current UserID: ");
+ if ( strUserID == aNullURL )
t_print(" Not retrived\n" );
else
printUString( strUserID );
t_print("Current User is");
- if ( isAdmin == sal_False )
- t_print(" NOT Administrator.\n" );
+ if ( isAdmin == sal_False )
+ t_print(" NOT Administrator.\n" );
else
t_print(" Administrator.\n" );
-
- /// get and display forwarded text if available.
- aStringForward = ::rtl::OUString::createFromAscii( getForwardString() );
+
+ /// get and display forwarded text if available.
+ aStringForward = ::rtl::OUString::createFromAscii( parameters.getCommandLine().c_str() );
if ( !aStringForward.equals( aNullURL ) && aStringForward.indexOf( (sal_Unicode)' ' ) != -1 )
{
sal_Int32 nFirstSpacePoint = aStringForward.indexOf( (sal_Unicode)' ' );;
sal_Int32 nLastSpacePoint = aStringForward.lastIndexOf( (sal_Unicode)' ' );;
- if ( nFirstSpacePoint == nLastSpacePoint )
+ if ( nFirstSpacePoint == nLastSpacePoint )
/// only forwarded two parameters, username and password.
{
aLogonUser = aStringForward.copy( 0, nFirstSpacePoint );
- t_print("\n#Forwarded username: ");
+ t_print("\n#Forwarded username: ");
printUString( aLogonUser);
-
+
aLogonPasswd = aStringForward.copy( nFirstSpacePoint +1, aStringForward.getLength( ) - 1 );
- t_print("#Forwarded password: ");
+ t_print("#Forwarded password: ");
for ( int i = nFirstSpacePoint +1; i <= aStringForward.getLength( ) - 1; i++, t_print("*") );
t_print("\n" );
}
@@ -659,23 +664,32 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
/// forwarded three parameters, username, password and fileserver.
{
aLogonUser = aStringForward.copy( 0, nFirstSpacePoint );
- t_print("#Forwarded username: ");
+ t_print("#Forwarded username: ");
printUString( aLogonUser);
-
+
aLogonPasswd = aStringForward.copy( nFirstSpacePoint +1, nLastSpacePoint );
- t_print("#Forwarded password: ");
+ t_print("#Forwarded password: ");
for ( int i = nFirstSpacePoint +1; i <= nLastSpacePoint; i++, t_print("*") );
t_print("\n" );
-
+
aFileServer = aStringForward.copy( nLastSpacePoint +1, aStringForward.getLength( ) - 1 );
- t_print("#Forwarded FileServer: ");
+ t_print("#Forwarded FileServer: ");
printUString( aFileServer );
-
+
}
}
- t_print("#\n#Initialization Done.\n" );
+ t_print("#\n#Initialization Done.\n" );
}
+/* Instantiate and register the own TestPlugIn and instantiate the default
+ main() function.
+ (This is done by CPPUNIT_PLUGIN_IMPLEMENT() for TestPlugInDefaultImpl)
+ */
+
+CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( MyTestPlugInImpl );
+CPPUNIT_PLUGIN_IMPLEMENT_MAIN();
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/security/osl_Security_Const.h b/sal/qa/osl/security/osl_Security_Const.h
index 339a91b..f62bfe2 100644
--- a/sal/qa/osl/security/osl_Security_Const.h
+++ b/sal/qa/osl/security/osl_Security_Const.h
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,8 +48,12 @@
#include <pwd.h>
#endif
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/plugin/TestPlugInDefaultImpl.h>
+#define t_print printf
#define BUFSIZE 1024
const char pTestString[17] = "Sun Microsystems";
More information about the Libreoffice-commits
mailing list