comparison vamp-plugin-tester.cpp @ 25:612333efd521

* Make default behaviour (without args) to print usage instead of testing all plugins; add -a option for that * Show Vamp path on plugin load failure
author cannam
date Tue, 22 Sep 2009 11:10:31 +0000
parents 7cc55187f5db
children 054ccdae5ed7
comparison
equal deleted inserted replaced
24:064ad81ea53c 25:612333efd521
56 << name << ": A Vamp plugin host that tests plugins for common errors.\n" 56 << name << ": A Vamp plugin host that tests plugins for common errors.\n"
57 "Chris Cannam, Centre for Digital Music, Queen Mary, University of London.\n" 57 "Chris Cannam, Centre for Digital Music, Queen Mary, University of London.\n"
58 "Copyright 2009 QMUL.\n" 58 "Copyright 2009 QMUL.\n"
59 "Freely redistributable; published under a BSD-style license.\n\n" 59 "Freely redistributable; published under a BSD-style license.\n\n"
60 "Usage:\n" 60 "Usage:\n"
61 " " << name << " [-n] [-v] [<pluginbasename>:<plugin>]\n\n" 61 " " << name << " [-nv] <pluginbasename>:<plugin>\n"
62 " " << name << " [-nv] -a\n\n"
62 "Example:\n" 63 "Example:\n"
63 " " << name << " vamp-example-plugins:amplitudefollower\n\n" 64 " " << name << " vamp-example-plugins:amplitudefollower\n\n"
64 "With an argument, tests one plugin; without, tests all plugins in Vamp path.\n" 65 "Options:\n"
65 "\nOptions:\n" 66 " -a, --all Test all plugins found in Vamp path\n\n"
66 " --nondeterministic, -n Plugins may be nondeterministic: print a note\n" 67 " -n, --nondeterministic Plugins may be nondeterministic: print a note\n"
67 " instead of an error if results differ between runs\n" 68 " instead of an error if results differ between runs\n\n"
68 " --verbose, -v Show returned features each time a note, warning,\n" 69 " -v, --verbose Show returned features each time a note, warning,\n"
69 " or error arises from feature data\n" 70 " or error arises from feature data\n"
70 "\nIf you have access to a runtime memory checker, you may find it especially\n" 71 "\nIf you have access to a runtime memory checker, you may find it especially\n"
71 "helpful to run this tester under it and watch for errors thus provoked.\n" 72 "helpful to run this tester under it and watch for errors thus provoked.\n"
72 << endl; 73 << endl;
73 exit(2); 74 exit(2);
83 } 84 }
84 if (!name || !*name) name = argv[0]; 85 if (!name || !*name) name = argv[0];
85 86
86 bool nondeterministic = false; 87 bool nondeterministic = false;
87 bool verbose = false; 88 bool verbose = false;
89 bool all = false;
88 string argument; 90 string argument;
89 for (int i = 1; i < argc; ++i) { 91 for (int i = 1; i < argc; ++i) {
90 if (!argv[i]) break; 92 if (!argv[i]) break;
91 if (argv[i][0] == '-') { 93 if (argv[i][0] == '-') {
92 if (!strcmp(argv[i], "-v") || 94 if (!strcmp(argv[i], "-v") ||
93 !strcmp(argv[i], "--verbose")) { 95 !strcmp(argv[i], "--verbose")) {
94 verbose = 1; 96 verbose = true;
95 continue; 97 continue;
96 } 98 }
97 if (!strcmp(argv[i], "-n") || 99 if (!strcmp(argv[i], "-n") ||
98 !strcmp(argv[i], "--nondeterministic")) { 100 !strcmp(argv[i], "--nondeterministic")) {
99 nondeterministic = 1; 101 nondeterministic = true;
102 continue;
103 }
104 if (!strcmp(argv[i], "-a") ||
105 !strcmp(argv[i], "--all")) {
106 all = true;
100 continue; 107 continue;
101 } 108 }
102 usage(name); 109 usage(name);
103 } else { 110 } else {
104 if (argument != "") usage(name); 111 if (argument != "") usage(name);
105 else argument = argv[i]; 112 else argument = argv[i];
106 } 113 }
107 } 114 }
108 115
116 if (argument == "" && !all) usage(name);
117 if (argument != "" && all) usage(name);
118
109 cerr << name << ": Running..." << endl; 119 cerr << name << ": Running..." << endl;
110 120
111 Test::Options opts = Test::NoOption; 121 Test::Options opts = Test::NoOption;
112 if (nondeterministic) opts |= Test::NonDeterministic; 122 if (nondeterministic) opts |= Test::NonDeterministic;
113 if (verbose) opts |= Test::Verbose; 123 if (verbose) opts |= Test::Verbose;
114 124
115 if (argument == "") { 125 if (all) {
116 bool good = true; 126 bool good = true;
117 Vamp::HostExt::PluginLoader::PluginKeyList keys = 127 Vamp::HostExt::PluginLoader::PluginKeyList keys =
118 Vamp::HostExt::PluginLoader::getInstance()->listPlugins(); 128 Vamp::HostExt::PluginLoader::getInstance()->listPlugins();
119 int notes = 0, warnings = 0, errors = 0; 129 int notes = 0, warnings = 0, errors = 0;
120 for (int i = 0; i < (int)keys.size(); ++i) { 130 for (int i = 0; i < (int)keys.size(); ++i) {