sal/cppunittester/cppunittester.cxx |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit d117d974184e47ba2a5f2c8181207556f19ee5ef
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Apr 13 16:46:53 2012 +0100

    push and pop protectors around runner run, hopefully fixes windows build

diff --git a/sal/cppunittester/cppunittester.cxx 
b/sal/cppunittester/cppunittester.cxx
index 22ac029..7886c80 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -119,10 +119,12 @@ private:
     const std::string &testlib;
     const std::string &args;
     CppUnit::TestResult &result;
+    std::vector<CppUnit::Protector *> &protectors;
 public:
-    ProtectedFixtureFunctor(const std::string& testlib_, const std::string 
&args_, CppUnit::TestResult &result_)
+    ProtectedFixtureFunctor(const std::string& testlib_, const std::string 
&args_, std::vector<CppUnit::Protector*> &protectors_, CppUnit::TestResult 
&result_)
         : testlib(testlib_)
         , args(args_)
+        , protectors(protectors_)
         , result(result_)
     {
     }
@@ -150,8 +152,14 @@ public:
         result.addListener(&timer);
 #endif
 
+        for (size_t i = 0; i < protectors.size(); ++i)
+            result.pushProtector(protectors[i]);
+
         runner.run(result);
 
+        for (size_t i = 0; i < protectors.size(); ++i)
+            result.popProtector();
+
         CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write();
         return collector.wasSuccessful();
     }
@@ -180,7 +188,7 @@ SAL_IMPLEMENT_MAIN() {
 #endif
 
     boost::ptr_vector<osl::Module> modules;
-    CppUnit::Protector *throw_protector = 0;
+    std::vector<CppUnit::Protector *> protectors;
     CppUnit::TestResult result;
     std::string args;
     std::string testlib;
@@ -218,20 +226,20 @@ SAL_IMPLEMENT_MAIN() {
         rtl::OUString 
sym(RTL_CONSTASCII_USTRINGPARAM("unoexceptionprotector"));
         oslGenericFunction fn = (oslGenericFunction) unoexceptionprotector;
 #endif
-        throw_protector = fn == 0
+        CppUnit::Protector *protector = fn == 0
             ? 0
             : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
-        if (throw_protector == 0) {
+        if (protector == 0) {
             std::cerr
                 << "Failure instantiating protector \"" << convertLazy(lib)
                 << "\", \"" << convertLazy(sym) << '"' << std::endl;
             std::exit(EXIT_FAILURE);
         }
-        result.pushProtector(throw_protector);
+        protectors.push_back(protector);
         index+=3;
     }
 
-    ProtectedFixtureFunctor tests(testlib, args, result);
+    ProtectedFixtureFunctor tests(testlib, args, protectors, result);
     bool ok = tests.run();
 
     return ok ? EXIT_SUCCESS : EXIT_FAILURE;
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to