diff options
Diffstat (limited to 'libs/ardour/test/testrunner.cc')
-rw-r--r-- | libs/ardour/test/testrunner.cc | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/libs/ardour/test/testrunner.cc b/libs/ardour/test/testrunner.cc index ebbd50543e..4024490da0 100644 --- a/libs/ardour/test/testrunner.cc +++ b/libs/ardour/test/testrunner.cc @@ -1,30 +1,65 @@ +#include <getopt.h> + #include <cppunit/CompilerOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/TestResult.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestRunner.h> #include <cppunit/BriefTestProgressListener.h> + +#include "pbd/debug.h" #include "ardour/ardour.h" int -main() +main(int argc, char* argv[]) { - ARDOUR::init (false, false); + if (!Glib::thread_supported()) { + Glib::thread_init(); + } - CppUnit::TestResult testresult; + const struct option longopts[] = { + { "debug", 1, 0, 'D' }, + { 0, 0, 0, 0 } + }; + const char *optstring = "D:"; + int option_index = 0; + int c = 0; - CppUnit::TestResultCollector collectedresults; - testresult.addListener (&collectedresults); + while (1) { + c = getopt_long (argc, argv, optstring, longopts, &option_index); - CppUnit::BriefTestProgressListener progress; - testresult.addListener (&progress); + if (c == -1) { + break; + } - CppUnit::TestRunner testrunner; - testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ()); - testrunner.run (testresult); + switch (c) { + case 0: + break; - CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr); - compileroutputter.write (); + case 'D': + if (PBD::parse_debug_options (optarg)) { + exit (0); + } + break; + } + } - return collectedresults.wasSuccessful () ? 0 : 1; + ARDOUR::init (false, false); + + CppUnit::TestResult testresult; + + CppUnit::TestResultCollector collectedresults; + testresult.addListener (&collectedresults); + + CppUnit::BriefTestProgressListener progress; + testresult.addListener (&progress); + + CppUnit::TestRunner testrunner; + testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ()); + testrunner.run (testresult); + + CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr); + compileroutputter.write (); + + return collectedresults.wasSuccessful () ? 0 : 1; } |