Added an option to print available implementation variants.
authorRoman Donchenko <roman.donchenko@itseez.com>
Wed, 19 Jun 2013 14:47:15 +0000 (18:47 +0400)
committerRoman Donchenko <roman.donchenko@itseez.com>
Wed, 19 Jun 2013 14:47:15 +0000 (18:47 +0400)
modules/ts/src/ts_perf.cpp

index e61878e..c2c1ee6 100644 (file)
@@ -646,6 +646,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
         "{   |perf_verify_sanity          |false    |fail tests having no regression data for sanity checks}"
         "{   |perf_impl                   |" + available_impls[0] +
                                                    "|the implementation variant of functions under test}"
+        "{   |perf_list_impls             |false    |list available implementation variants and exit}"
         "{   |perf_run_cpu                |false    |deprecated, equivalent to --perf_impl=plain}"
 #ifdef ANDROID
         "{   |perf_time_limit             |6.0      |default time limit for a single test (in seconds)}"
@@ -687,6 +688,19 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
     log_power_checkpoints = args.get<bool>("perf_log_power_checkpoints");
 #endif
 
+    bool param_list_impls = args.get<bool>("perf_list_impls");
+
+    if (param_list_impls)
+    {
+        fputs("Available implementation variants:", stdout);
+        for (size_t i = 0; i < available_impls.size(); ++i) {
+            putchar(' ');
+            fputs(available_impls[i].c_str(), stdout);
+        }
+        putchar('\n');
+        exit(0);
+    }
+
     if (std::find(available_impls.begin(), available_impls.end(), param_impl) == available_impls.end())
     {
         printf("No such implementation: %s\n", param_impl.c_str());