middle of porting; unstable, don't checkout, added xml check output; refs #1

master
Marc Wäckerlin 13 years ago
parent 2624b602af
commit 569e566b5e
  1. 11
      src/stacktrace.cxx
  2. 9
      test/auto_test.cxx
  3. 9
      test/configfile_test.cxx
  4. 9
      test/dynamiclibrary_test.cxx
  5. 9
      test/exec_test.cxx
  6. 9
      test/functiontrace_test.cxx
  7. 9
      test/mrwautofunctiontracelog4cxx_test.cxx
  8. 10
      test/mrwexclog4cxx_test.cxx
  9. 9
      test/mrwexcstderr_test.cxx
  10. 9
      test/regexp_test.cxx
  11. 9
      test/smartpointer_test.cxx
  12. 9
      test/stacktrace_test.cxx
  13. 9
      test/stdext_test.cxx
  14. 9
      test/string_test.cxx
  15. 9
      test/tokenizer_test.cxx

@ -88,9 +88,9 @@ namespace mrw {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
mrw::StackTrace::StackTrace() throw(std::bad_exception) { mrw::StackTrace::StackTrace() throw(std::bad_exception) {
// maximum trace level is limited here to 50, see below why // maximum trace level is limited here to 50, see below why
# if defined(__GNUG__) # if defined(__GNUG__)
{ {
# define PUSH(i) \ # define PUSH(i) \
(__builtin_frame_address(i)!=0 ? \ (__builtin_frame_address(i)!=0 ? \
(_trace.push_back(__builtin_return_address(i)), true) : false) (_trace.push_back(__builtin_return_address(i)), true) : false)
PUSH(0) && PUSH(1) && PUSH(2) && PUSH(3) && PUSH(4) && PUSH(5) && PUSH(0) && PUSH(1) && PUSH(2) && PUSH(3) && PUSH(4) && PUSH(5) &&
@ -102,7 +102,7 @@ mrw::StackTrace::StackTrace() throw(std::bad_exception) {
PUSH(34) && PUSH(35) && PUSH(36) && PUSH(37) && PUSH(38) && PUSH(39) PUSH(34) && PUSH(35) && PUSH(36) && PUSH(37) && PUSH(38) && PUSH(39)
&& PUSH(40) && PUSH(41) && PUSH(42) && PUSH(43) && PUSH(44) && && PUSH(40) && PUSH(41) && PUSH(42) && PUSH(43) && PUSH(44) &&
PUSH(45) && PUSH(46) && PUSH(47) && PUSH(48) && PUSH(49); PUSH(45) && PUSH(46) && PUSH(47) && PUSH(48) && PUSH(49);
# undef PUSH # undef PUSH
} }
# elif defined(__GLIBC__) # elif defined(__GLIBC__)
{ {
@ -332,7 +332,9 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename()
std::string range, perm, x1, x2, size, lib; std::string range, perm, x1, x2, size, lib;
while (getline(is, s)) try { while (getline(is, s)) try {
range = perm = x1 = x2 = size = lib = "????"; range = perm = x1 = x2 = size = lib = "????";
s>>range>>perm>>x1>>x2>>size>>lib; s>>range>>perm>>x1>>x2>>size;
if (mrw::to<int>(size)>0) {
s>>lib;
range.resize(range.find_first_not_of("0123456789abcdefABCDEF")); range.resize(range.find_first_not_of("0123456789abcdefABCDEF"));
void* addr(0); void* addr(0);
range>>addr; range>>addr;
@ -341,6 +343,7 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename()
// question: should only files with ending '.so' be loaded? // question: should only files with ending '.so' be loaded?
if (lib.size() && lib[0]!='[' && lib[lib.size()-1]!=']' && addr>0) if (lib.size() && lib[0]!='[' && lib[lib.size()-1]!=']' && addr>0)
res<<BinFiles::value_type(lib, addr); res<<BinFiles::value_type(lib, addr);
}
} catch (...) {} // ignore non matching lines } catch (...) {} // ignore non matching lines
return res; return res;
} }

@ -85,8 +85,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(AutoTest); CPPUNIT_TEST_SUITE_REGISTRATION(AutoTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -65,8 +65,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(ConfigFileTest); CPPUNIT_TEST_SUITE_REGISTRATION(ConfigFileTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -40,8 +40,13 @@ class DynamicLibraryTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(DynamicLibraryTest); CPPUNIT_TEST_SUITE_REGISTRATION(DynamicLibraryTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -127,8 +127,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(ExecTest); CPPUNIT_TEST_SUITE_REGISTRATION(ExecTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -126,8 +126,13 @@ class FunctionTraceTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(FunctionTraceTest); CPPUNIT_TEST_SUITE_REGISTRATION(FunctionTraceTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -237,8 +237,13 @@ namespace mrw {
CPPUNIT_TEST_SUITE_REGISTRATION(AutoFunctionTraceLog4CxxTest); CPPUNIT_TEST_SUITE_REGISTRATION(AutoFunctionTraceLog4CxxTest);
} }
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -85,9 +85,13 @@ namespace mrw {
CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcLog4CxxTest); CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcLog4CxxTest);
} }
int main() { int main(int argc, char** argv) try {
log4cxx::BasicConfigurator::configure(); std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -84,8 +84,13 @@ namespace mrw {
CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcStderrTest); CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcStderrTest);
} }
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -56,8 +56,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(RegExpTest); CPPUNIT_TEST_SUITE_REGISTRATION(RegExpTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -155,8 +155,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(SmartPointerTest); CPPUNIT_TEST_SUITE_REGISTRATION(SmartPointerTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -76,8 +76,13 @@ namespace mrw {
CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest); CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest);
} }
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -259,8 +259,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(StdExtTest); CPPUNIT_TEST_SUITE_REGISTRATION(StdExtTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -42,8 +42,13 @@ class StringTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(StringTest); CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

@ -67,8 +67,13 @@ public:
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(TokenizerTest); CPPUNIT_TEST_SUITE_REGISTRATION(TokenizerTest);
int main() { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} } catch (std::exception& e) {
std::cerr<<"***Exception: "<<e.what()<<std::endl;
return 1;
}

Loading…
Cancel
Save