From: Sami Kyöstilä Date: Wed, 9 Dec 2009 09:22:45 +0000 (+0200) Subject: Added option to list all tests X-Git-Url: http://vcs.maemo.org/git/?p=glmemperf;a=commitdiff_plain;h=79ca4f19f9b13c29921a0416f08c3d97cb6e04b4 Added option to list all tests Signed-off-by: Sami Kyöstilä --- diff --git a/glmemperf.cpp b/glmemperf.cpp index 82a6ab4..0a0f1cc 100644 --- a/glmemperf.cpp +++ b/glmemperf.cpp @@ -54,6 +54,7 @@ static struct int bitsPerPixel; bool verbose; int minTime; + bool listTests; std::list includedTests; std::list 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& 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& args) { options.verbose = true; } + else if (*i == "-l") + { + options.listTests = true; + } else { std::cerr << "Invalid option: " << *i << std::endl;