comparison vamp-plugin-tester.cpp @ 39:07144cdcbedf

Introduce logic for running only a single test (not yet wired up to command line interface)
author Chris Cannam
date Mon, 28 Jul 2014 11:11:59 +0100
parents a835f9cf3a3d
children 649f32c7eb41
comparison
equal deleted inserted replaced
38:f930285dfe5a 39:07144cdcbedf
116 if (argument == "" && !all) usage(name); 116 if (argument == "" && !all) usage(name);
117 if (argument != "" && all) usage(name); 117 if (argument != "" && all) usage(name);
118 118
119 cerr << name << ": Running..." << endl; 119 cerr << name << ": Running..." << endl;
120 120
121 std::string single = "";
122
121 Test::Options opts = Test::NoOption; 123 Test::Options opts = Test::NoOption;
122 if (nondeterministic) opts |= Test::NonDeterministic; 124 if (nondeterministic) opts |= Test::NonDeterministic;
123 if (verbose) opts |= Test::Verbose; 125 if (verbose) opts |= Test::Verbose;
126 if (single != "") opts |= Test::SingleTest;
124 127
125 if (all) { 128 if (all) {
126 bool good = true; 129 bool good = true;
127 Vamp::HostExt::PluginLoader::PluginKeyList keys = 130 Vamp::HostExt::PluginLoader::PluginKeyList keys =
128 Vamp::HostExt::PluginLoader::getInstance()->listPlugins(); 131 Vamp::HostExt::PluginLoader::getInstance()->listPlugins();
132 return 2; 135 return 2;
133 } 136 }
134 int notes = 0, warnings = 0, errors = 0; 137 int notes = 0, warnings = 0, errors = 0;
135 for (int i = 0; i < (int)keys.size(); ++i) { 138 for (int i = 0; i < (int)keys.size(); ++i) {
136 cout << "Testing plugin: " << keys[i] << endl; 139 cout << "Testing plugin: " << keys[i] << endl;
137 Tester tester(keys[i], opts); 140 Tester tester(keys[i], opts, single);
138 if (tester.test(notes, warnings, errors)) { 141 if (tester.test(notes, warnings, errors)) {
139 cout << name << ": All tests succeeded for this plugin" << endl; 142 cout << name << ": All tests succeeded for this plugin" << endl;
140 } else { 143 } else {
141 cout << name << ": Some tests failed for this plugin" << endl; 144 cout << name << ": Some tests failed for this plugin" << endl;
142 good = false; 145 good = false;
159 cout << name << ": Some tests failed" << endl; 162 cout << name << ": Some tests failed" << endl;
160 return 1; 163 return 1;
161 } 164 }
162 } else { 165 } else {
163 string key = argument; 166 string key = argument;
164 Tester tester(key, opts); 167 Tester tester(key, opts, single);
165 int notes = 0, warnings = 0, errors = 0; 168 int notes = 0, warnings = 0, errors = 0;
166 if (tester.test(notes, warnings, errors)) { 169 if (tester.test(notes, warnings, errors)) {
167 cout << name << ": All tests succeeded"; 170 cout << name << ": All tests succeeded";
168 if (warnings > 0) { 171 if (warnings > 0) {
169 cout << ", with " << warnings << " warning(s)"; 172 cout << ", with " << warnings << " warning(s)";