Skip to content
Snippets Groups Projects
Commit 0fe14d9d authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Echo group_started, group_completed to test-program output file.

This isn't recent oversight; in viewer-development the output file never
contained those lines either. But it should.
Using scoped_ptr is more robust than using a dumb pointer with inline "Oh
yeah, don't forget to clean up that pointer" logic.
parent f1c7face
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#pragma warning (pop) #pragma warning (pop)
#endif #endif
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -115,11 +116,11 @@ class LLTestCallback : public tut::callback ...@@ -115,11 +116,11 @@ class LLTestCallback : public tut::callback
} }
virtual void group_started(const std::string& name) { virtual void group_started(const std::string& name) {
std::cout << "Unit test group_started name=" << name << std::endl; *mStream << "Unit test group_started name=" << name << std::endl;
} }
virtual void group_completed(const std::string& name) { virtual void group_completed(const std::string& name) {
std::cout << "Unit test group_completed name=" << name << std::endl; *mStream << "Unit test group_completed name=" << name << std::endl;
} }
virtual void test_completed(const tut::test_result& tr) virtual void test_completed(const tut::test_result& tr)
...@@ -408,7 +409,7 @@ int main(int argc, char **argv) ...@@ -408,7 +409,7 @@ int main(int argc, char **argv)
apr_getopt_t* os = NULL; apr_getopt_t* os = NULL;
if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv)) if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv))
{ {
std::cerr << "Unable to pool" << std::endl; std::cerr << "apr_getopt_init() failed" << std::endl;
return 1; return 1;
} }
...@@ -422,7 +423,7 @@ int main(int argc, char **argv) ...@@ -422,7 +423,7 @@ int main(int argc, char **argv)
apr_status_t apr_err; apr_status_t apr_err;
const char* opt_arg = NULL; const char* opt_arg = NULL;
int opt_id = 0; int opt_id = 0;
std::ofstream *output = NULL; boost::scoped_ptr<std::ofstream> output;
const char *touch = NULL; const char *touch = NULL;
while(true) while(true)
...@@ -452,7 +453,7 @@ int main(int argc, char **argv) ...@@ -452,7 +453,7 @@ int main(int argc, char **argv)
verbose_mode = true; verbose_mode = true;
break; break;
case 'o': case 'o':
output = new std::ofstream; output.reset(new std::ofstream);
output->open(opt_arg); output->open(opt_arg);
break; break;
case 's': // --sourcedir case 's': // --sourcedir
...@@ -486,11 +487,11 @@ int main(int argc, char **argv) ...@@ -486,11 +487,11 @@ int main(int argc, char **argv)
LLTestCallback* mycallback; LLTestCallback* mycallback;
if (getenv("TEAMCITY_PROJECT_NAME")) if (getenv("TEAMCITY_PROJECT_NAME"))
{ {
mycallback = new LLTCTestCallback(verbose_mode, output); mycallback = new LLTCTestCallback(verbose_mode, output.get());
} }
else else
{ {
mycallback = new LLTestCallback(verbose_mode, output); mycallback = new LLTestCallback(verbose_mode, output.get());
} }
tut::runner.get().set_callback(mycallback); tut::runner.get().set_callback(mycallback);
...@@ -512,12 +513,6 @@ int main(int argc, char **argv) ...@@ -512,12 +513,6 @@ int main(int argc, char **argv)
std::cin.get(); std::cin.get();
} }
if (output)
{
output->close();
delete output;
}
if (touch && success) if (touch && success)
{ {
std::ofstream s; std::ofstream s;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment