Added option to list all tests
authorSami Kyöstilä <skyostil@skyostil-lt.nmp.nokia.com>
Wed, 9 Dec 2009 09:22:45 +0000 (11:22 +0200)
committerSami Kyöstilä <sami.kyostila@nokia.com>
Wed, 9 Dec 2009 09:38:19 +0000 (11:38 +0200)
Signed-off-by: Sami Kyöstilä <skyostil@skyostil-lt.nmp.nokia.com>

glmemperf.cpp

index 82a6ab4..0a0f1cc 100644 (file)
@@ -54,6 +54,7 @@ static struct
     int                    bitsPerPixel;
     bool                   verbose;
     int                    minTime;
+    bool                   listTests;
     std::list<std::string> includedTests;
     std::list<std::string> excludedTests;
 } options;
@@ -196,6 +197,12 @@ void runTest(Test& test)
     int64_t minTime = options.minTime * 1000 * 1000 * 1000LL;
     struct timespec res, start, end;
 
+    if (options.listTests)
+    {
+        printf("%s\n", test.name().c_str());
+        return;
+    }
+
     if (!shouldRunTest(test.name()))
     {
         return;
@@ -292,6 +299,7 @@ void showUsage()
         "Options:\n"
         "       -h             This text\n"
         "       -v             Verbose mode\n"
+        "       -l             List all tests without running them\n"
         "       -i TEST        Include a specific test (full name or substring)\n"
         "       -e TEST        Exclude a specific test (full name or substring)\n"
         "       -t SECS        Minimum time to run each test\n"
@@ -306,6 +314,7 @@ void parseArguments(const std::list<std::string>& args)
     options.verbose = false;
     options.minTime = 1;
     options.bitsPerPixel = 16;
+    options.listTests = false;
 
     for (i = args.begin(), i++; i != args.end(); ++i)
     {
@@ -334,6 +343,10 @@ void parseArguments(const std::list<std::string>& args)
         {
             options.verbose = true;
         }
+        else if (*i == "-l")
+        {
+            options.listTests = true;
+        }
         else
         {
             std::cerr << "Invalid option: " << *i << std::endl;