diff options
Diffstat (limited to 'sal/cppunittester/cppunittester.cxx')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index ac99601f5ce5..87d250114eb9 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,10 @@ #include <cstdlib> #include <iostream> -#include "preextstl.h" +#ifdef WNT +#include <windows.h> +#endif + #include "cppunit/CompilerOutputter.h" #include "cppunit/TestResult.h" #include "cppunit/TestResultCollector.h" @@ -39,23 +43,44 @@ #include "cppunit/extensions/TestFactoryRegistry.h" #include "cppunit/plugin/PlugInManager.h" #include "cppunit/portability/Stream.h" -#include "postextstl.h" #include "osl/thread.h" #include "rtl/process.h" #include "rtl/string.hxx" #include "rtl/ustring.hxx" #include "sal/main.h" -SAL_IMPLEMENT_MAIN() { - if (rtl_getAppCommandArgCount() != 1) { +SAL_IMPLEMENT_MAIN() +{ + +#ifdef WNT + //Disable Dr-Watson in order to crash simply without popup dialogs under + //windows + DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); + SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode); +#endif + + sal_uInt32 nCommandArgs = rtl_getAppCommandArgCount(); + if (nCommandArgs < 1) + { std::cerr << "Usage: cppunittester <shared-library-path>" << std::endl; return EXIT_FAILURE; } - rtl::OUString path; - rtl_getAppCommandArg(0, &path.pData); + std::string testlib; + { + rtl::OUString path; + rtl_getAppCommandArg(0, &path.pData); + testlib = rtl::OUStringToOString(path, osl_getThreadTextEncoding()).getStr(); + } + std::string args = testlib; + for (sal_uInt32 i = 1; i < nCommandArgs; ++i) + { + rtl::OUString arg; + rtl_getAppCommandArg(i, &arg.pData); + args += ' '; + args += rtl::OUStringToOString(arg, osl_getThreadTextEncoding()).getStr(); + } CppUnit::PlugInManager manager; - manager.load( - rtl::OUStringToOString(path, osl_getThreadTextEncoding()).getStr()); + manager.load(testlib, args); CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); CppUnit::TestResult result; @@ -65,3 +90,5 @@ SAL_IMPLEMENT_MAIN() { CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); return collector.wasSuccessful() ? EXIT_SUCCESS : EXIT_FAILURE; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |