Kaydet (Commit) d117d974 authored tarafından Caolán McNamara's avatar Caolán McNamara

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

üst b0beccb4
...@@ -119,10 +119,12 @@ private: ...@@ -119,10 +119,12 @@ private:
const std::string &testlib; const std::string &testlib;
const std::string &args; const std::string &args;
CppUnit::TestResult &result; CppUnit::TestResult &result;
std::vector<CppUnit::Protector *> &protectors;
public: 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_) : testlib(testlib_)
, args(args_) , args(args_)
, protectors(protectors_)
, result(result_) , result(result_)
{ {
} }
...@@ -150,8 +152,14 @@ public: ...@@ -150,8 +152,14 @@ public:
result.addListener(&timer); result.addListener(&timer);
#endif #endif
for (size_t i = 0; i < protectors.size(); ++i)
result.pushProtector(protectors[i]);
runner.run(result); runner.run(result);
for (size_t i = 0; i < protectors.size(); ++i)
result.popProtector();
CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write();
return collector.wasSuccessful(); return collector.wasSuccessful();
} }
...@@ -180,7 +188,7 @@ SAL_IMPLEMENT_MAIN() { ...@@ -180,7 +188,7 @@ SAL_IMPLEMENT_MAIN() {
#endif #endif
boost::ptr_vector<osl::Module> modules; boost::ptr_vector<osl::Module> modules;
CppUnit::Protector *throw_protector = 0; std::vector<CppUnit::Protector *> protectors;
CppUnit::TestResult result; CppUnit::TestResult result;
std::string args; std::string args;
std::string testlib; std::string testlib;
...@@ -218,20 +226,20 @@ SAL_IMPLEMENT_MAIN() { ...@@ -218,20 +226,20 @@ SAL_IMPLEMENT_MAIN() {
rtl::OUString sym(RTL_CONSTASCII_USTRINGPARAM("unoexceptionprotector")); rtl::OUString sym(RTL_CONSTASCII_USTRINGPARAM("unoexceptionprotector"));
oslGenericFunction fn = (oslGenericFunction) unoexceptionprotector; oslGenericFunction fn = (oslGenericFunction) unoexceptionprotector;
#endif #endif
throw_protector = fn == 0 CppUnit::Protector *protector = fn == 0
? 0 ? 0
: (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
if (throw_protector == 0) { if (protector == 0) {
std::cerr std::cerr
<< "Failure instantiating protector \"" << convertLazy(lib) << "Failure instantiating protector \"" << convertLazy(lib)
<< "\", \"" << convertLazy(sym) << '"' << std::endl; << "\", \"" << convertLazy(sym) << '"' << std::endl;
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
result.pushProtector(throw_protector); protectors.push_back(protector);
index+=3; index+=3;
} }
ProtectedFixtureFunctor tests(testlib, args, result); ProtectedFixtureFunctor tests(testlib, args, protectors, result);
bool ok = tests.run(); bool ok = tests.run();
return ok ? EXIT_SUCCESS : EXIT_FAILURE; return ok ? EXIT_SUCCESS : EXIT_FAILURE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment