diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-02-21 17:50:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-02-22 21:16:33 +0000 |
commit | d7d7e6f8d491e5fc5365edba3d895d66fdc65443 (patch) | |
tree | 6971944c4fc9b8a08e71093cb43328c805bf146e /sal/cppunittester | |
parent | fccef9d68d48abe7bef0ed15b1d77d364675c195 (diff) |
add possibility of passing command line args down to tests
Diffstat (limited to 'sal/cppunittester')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index 47398b8350fb..87d250114eb9 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -36,7 +36,6 @@ #include <windows.h> #endif - #include "cppunit/CompilerOutputter.h" #include "cppunit/TestResult.h" #include "cppunit/TestResultCollector.h" @@ -50,22 +49,38 @@ #include "rtl/ustring.hxx" #include "sal/main.h" -SAL_IMPLEMENT_MAIN() { +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 - if (rtl_getAppCommandArgCount() < 1) { + 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; |