ardour
testrunner.cc
Go to the documentation of this file.
1 #include <getopt.h>
2 #include <glibmm/thread.h>
3 
4 #include <cppunit/CompilerOutputter.h>
5 #include <cppunit/extensions/TestFactoryRegistry.h>
6 #include <cppunit/extensions/HelperMacros.h>
7 #include <cppunit/TestResult.h>
8 #include <cppunit/TestResultCollector.h>
9 #include <cppunit/TestRunner.h>
10 #include <cppunit/BriefTestProgressListener.h>
11 
12 #include "pbd/debug.h"
13 #include "ardour/ardour.h"
14 #include "test_ui.h"
15 
16 static const char* localedir = LOCALEDIR;
17 
18 int
19 main(int argc, char* argv[])
20 {
21  if (!Glib::thread_supported()) {
22  Glib::thread_init();
23  }
24 
25  const struct option longopts[] = {
26  { "debug", 1, 0, 'D' },
27  { 0, 0, 0, 0 }
28  };
29  const char *optstring = "D:";
30  int option_index = 0;
31  int c = 0;
32 
33  while (1) {
34  c = getopt_long (argc, argv, optstring, longopts, &option_index);
35 
36  if (c == -1) {
37  break;
38  }
39 
40  switch (c) {
41  case 0:
42  break;
43 
44  case 'D':
46  exit (0);
47  }
48  break;
49  }
50  }
51 
52  CPPUNIT_ASSERT (ARDOUR::init (false, true, localedir));
53 
54  TestUI* test_ui = new TestUI();
55 
56  CppUnit::TestResult testresult;
57 
58  CppUnit::TestResultCollector collectedresults;
59  testresult.addListener (&collectedresults);
60 
61  CppUnit::BriefTestProgressListener progress;
62  testresult.addListener (&progress);
63 
64  CppUnit::TestRunner testrunner;
65  testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
66  testrunner.run (testresult);
67 
68  CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
69  compileroutputter.write ();
70 
71  delete test_ui;
72 
73  ARDOUR::cleanup ();
74 
75  return collectedresults.wasSuccessful () ? 0 : 1;
76 }
Definition: getopt.h:74
static const char * localedir
Definition: testrunner.cc:16
__BEGIN_DECLS GETOPT_API int getopt_long(int nargc, char *const *nargv, const char *options, const struct option *long_options, int *idx)
Definition: getopt_long.c:395
LIBARDOUR_API void cleanup()
Definition: globals.cc:502
int main(int argc, char *argv[])
Definition: testrunner.cc:19
GETOPT_API char * optarg
Definition: getopt.c:52
Definition: test_ui.h:32
LIBARDOUR_API bool init(bool with_vst, bool try_optimization, const char *localedir)
Definition: globals.cc:376
LIBPBD_API int parse_debug_options(const char *str)
Definition: debug.cc:80