Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


So sorry - it was too late Saturday night. I didn't realize that my IDE
was set to strip off trailing blanks. So it happened again that I send a
patch that contains a lot of whitespace changes.

Now I attach a corrected patch (without the whitespace changes). I hope
that this doesn't confuse additionaly....

Wilhelm
From 4ca17d617602df40f44d2d04863f28e1533e003c Mon Sep 17 00:00:00 2001
Message-Id: <4ca17d617602df40f44d2d04863f28e1533e003c.1298323174.git.Wilhelm.Pflueger@web.de>
From: Wilhelm Pflueger <Wilhelm.Pflueger@web.de>
Date: Sun, 20 Feb 2011 01:57:37 +0100
Subject: [PATCH] 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.

Signed-off-by: Wilhelm Pflueger <Wilhelm.Pflueger@web.de>
---
 sal/prj/build.lst                        |    4 +-
 sal/qa/osl/process/batch.sh              |    2 +
 sal/qa/osl/process/makefile.mk           |    6 ++-
 sal/qa/osl/process/osl_Thread.cxx        |  106 ++++++++++++++++--------------
 sal/qa/osl/process/osl_process.cxx       |   23 +++++--
 sal/qa/osl/process/osl_process_child.cxx |   43 ++++++------
 sal/qa/osl/security/osl_Security.cxx     |   49 +++++++++-----
 sal/qa/osl/security/osl_Security_Const.h |    8 ++-
 8 files changed, 144 insertions(+), 97 deletions(-)

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..3befbcc 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -334,33 +334,41 @@ namespace osl_Security
     }; // 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 &parameters );
+};
 
 /** 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" );
@@ -638,7 +646,7 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
     
 
     /// get and display forwarded text if available. 
-    aStringForward = ::rtl::OUString::createFromAscii( getForwardString() );
+    aStringForward = ::rtl::OUString::createFromAscii( parameters.getCommandLine().c_str() );
     if ( !aStringForward.equals( aNullURL ) && aStringForward.indexOf( (sal_Unicode)' ' ) != -1 )
     {
         sal_Int32 nFirstSpacePoint = aStringForward.indexOf( (sal_Unicode)' ' );;
@@ -678,4 +686,13 @@ void RegisterAdditionalFunctions(FktRegFuncPtr)
 
 }
 
+/* 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";
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.