From a8fbaad9b860b41e8ad2ea927f2a59bb26c44865 Mon Sep 17 00:00:00 2001 From: Jez Higgins Date: Tue, 12 Jan 2010 12:07:32 +0000 Subject: [PATCH] test to see if Hudson will parse test logs --- tests/CppUnit/TestRunner.cpp | 27 +++++++++++++-------------- tests/CppUnit/TestRunner.hpp | 2 +- tests/SAX/test_and_log.sh | 6 ++++++ 3 files changed, 20 insertions(+), 15 deletions(-) create mode 100755 tests/SAX/test_and_log.sh diff --git a/tests/CppUnit/TestRunner.cpp b/tests/CppUnit/TestRunner.cpp index 5fc55fa5..11e39071 100644 --- a/tests/CppUnit/TestRunner.cpp +++ b/tests/CppUnit/TestRunner.cpp @@ -27,16 +27,16 @@ typedef pair mapping; typedef vector > mappings; template -bool run(const string& name, Test *test, bool verbose, const string& logpath) +bool run(const string& name, Test *test, bool verbose, const string& logprefix) { if(verbose) cout << "Running " << name << endl; result_type result(name, verbose); test->run (&result); cout << result; - if(!logpath.empty()) + if(!logprefix.empty()) { - std::string filename = logpath + "/" + name + ".log"; + std::string filename = logprefix + name + ".log"; std::ofstream of(filename.c_str()); of << result; of.close(); @@ -44,19 +44,19 @@ bool run(const string& name, Test *test, bool verbose, const string& logpath) return result.wasSuccessful(); } // run -bool textrun(const string& name, Test *test, bool verbose, const string& logpath) +bool textrun(const string& name, Test *test, bool verbose, const string& logprefix) { - return run(name, test, verbose, logpath); + return run(name, test, verbose, logprefix); } // textrun -bool tablerun(const string& name, Test *test, bool verbose, const string& logpath) +bool tablerun(const string& name, Test *test, bool verbose, const string& logprefix) { - return run(name, test, verbose, logpath); + return run(name, test, verbose, logprefix); } // tablerun -bool xmlrun(const string& name, Test *test, bool verbose, const string& logpath) +bool xmlrun(const string& name, Test *test, bool verbose, const string& logprefix) { - return run(name, test, verbose, logpath); + return run(name, test, verbose, logprefix); } // xmlrun @@ -66,7 +66,7 @@ void printBanner () cout << "Usage: driver [-v] [-table] [ -wait ] testName, where name is the name of a test case class" << endl; } // printBanner -typedef bool (*runFn)(const string& name, Test *test, bool verbose, const string& logpath); +typedef bool (*runFn)(const string& name, Test *test, bool verbose, const string& logprefix); bool TestRunner::run(int ac, const char **av) { @@ -108,8 +108,7 @@ bool TestRunner::run(int ac, const char **av) if(string(av[i]) == "-log") { - logpath_ = av[++i]; - cout << "logpath=" < > m_mappings; - std::string logpath_; + std::string logprefix_; public: TestRunner() : m_wait(false), verbose_(false) {} diff --git a/tests/SAX/test_and_log.sh b/tests/SAX/test_and_log.sh new file mode 100755 index 00000000..9b1faa4b --- /dev/null +++ b/tests/SAX/test_and_log.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for x in filter_test filter_test_silly filter_test_wide +do + ./$x -xml -log ../$x +done