changeset 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 064ad81ea53c
children eff1772ba397
files README Tester.cpp vamp-plugin-tester.cpp
diffstat 3 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue Sep 22 10:53:21 2009 +0000
+++ b/README	Tue Sep 22 11:10:31 2009 +0000
@@ -81,7 +81,7 @@
 
    No valid <name> found in Vamp path
 
-    - No Vamp plugin library of that name was found in the path.
+    - No Vamp plugin library of that name was found in the Vamp path.
       This message will often be accompanied by one of the following
       errors; if it isn't, then that probably means the file did not
       exist at all.
--- a/Tester.cpp	Tue Sep 22 10:53:21 2009 +0000
+++ b/Tester.cpp	Tue Sep 22 11:10:31 2009 +0000
@@ -183,6 +183,11 @@
     } catch (Test::FailedToLoadPlugin) {
         std::cout << " ** ERROR: Failed to load plugin (key = \"" << m_key
                   << "\")" << std::endl;
+        std::cout << " ** NOTE: Vamp plugin path is: " << std::endl;
+        std::vector<std::string> pp = PluginHostAdapter::getPluginPath();
+        for (size_t i = 0; i < pp.size(); ++i) {
+            std::cout << "            " << pp[i] << std::endl;
+        }
     }
 
     return good;
--- a/vamp-plugin-tester.cpp	Tue Sep 22 10:53:21 2009 +0000
+++ b/vamp-plugin-tester.cpp	Tue Sep 22 11:10:31 2009 +0000
@@ -58,14 +58,15 @@
         "Copyright 2009 QMUL.\n"
         "Freely redistributable; published under a BSD-style license.\n\n"
         "Usage:\n"
-        "  " << name << " [-n] [-v] [<pluginbasename>:<plugin>]\n\n"
+        "  " << name << " [-nv] <pluginbasename>:<plugin>\n"
+        "  " << name << " [-nv] -a\n\n"
         "Example:\n"
         "  " << name << " vamp-example-plugins:amplitudefollower\n\n"
-        "With an argument, tests one plugin; without, tests all plugins in Vamp path.\n"
-        "\nOptions:\n"
-        "  --nondeterministic, -n    Plugins may be nondeterministic: print a note\n"
-        "                            instead of an error if results differ between runs\n"
-        "  --verbose, -v             Show returned features each time a note, warning,\n"
+        "Options:\n"
+        "  -a, --all                 Test all plugins found in Vamp path\n\n"
+        "  -n, --nondeterministic    Plugins may be nondeterministic: print a note\n"
+        "                            instead of an error if results differ between runs\n\n"
+        "  -v, --verbose             Show returned features each time a note, warning,\n"
         "                            or error arises from feature data\n"
         "\nIf you have access to a runtime memory checker, you may find it especially\n"
         "helpful to run this tester under it and watch for errors thus provoked.\n"
@@ -85,18 +86,24 @@
 
     bool nondeterministic = false;
     bool verbose = false;
+    bool all = false;
     string argument;
     for (int i = 1; i < argc; ++i) {
         if (!argv[i]) break;
         if (argv[i][0] == '-') {
             if (!strcmp(argv[i], "-v") ||
                 !strcmp(argv[i], "--verbose")) {
-                verbose = 1;
+                verbose = true;
                 continue;
             }
             if (!strcmp(argv[i], "-n") ||
                 !strcmp(argv[i], "--nondeterministic")) {
-                nondeterministic = 1;
+                nondeterministic = true;
+                continue;
+            }
+            if (!strcmp(argv[i], "-a") ||
+                !strcmp(argv[i], "--all")) {
+                all = true;
                 continue;
             }
             usage(name);
@@ -106,13 +113,16 @@
         }
     }
     
+    if (argument == "" && !all) usage(name);
+    if (argument != "" &&  all) usage(name);
+
     cerr << name << ": Running..." << endl;
 
     Test::Options opts = Test::NoOption;
     if (nondeterministic) opts |= Test::NonDeterministic;
     if (verbose) opts |= Test::Verbose;
 
-    if (argument == "") {
+    if (all) {
         bool good = true;
         Vamp::HostExt::PluginLoader::PluginKeyList keys =
             Vamp::HostExt::PluginLoader::getInstance()->listPlugins();