[Piglit] [PATCH 16/19] glean: Remove Options::mode.
Kenneth Graunke
kenneth at whitecape.org
Mon Dec 31 18:41:05 PST 2012
Now that result comparison is gone, there's no real need to store an
enum here...except for --listtests, it's always run. Simplify.
---
tests/glean/main.cpp | 24 ++++++++----------------
tests/glean/options.cpp | 1 -
tests/glean/options.h | 4 ----
3 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/tests/glean/main.cpp b/tests/glean/main.cpp
index 91d1419..8084d31 100644
--- a/tests/glean/main.cpp
+++ b/tests/glean/main.cpp
@@ -68,7 +68,8 @@ main(int argc, char* argv[]) {
allTestNames.push_back(t->name);
sort(allTestNames.begin(), allTestNames.end());
o.selectedTests = allTestNames;
- o.mode = Options::run;
+
+ bool listTestsMode = false;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--help")) {
@@ -90,7 +91,7 @@ main(int argc, char* argv[]) {
++i;
selectTests(o, allTestNames, argc, argv, i);
} else if (!strcmp(argv[i], "--listtests")) {
- o.mode = Options::listtests;
+ listTestsMode = true;
# if defined(__X11__)
} else if (!strcmp(argv[i], "-display")
|| !strcmp(argv[i], "--display")) {
@@ -102,7 +103,7 @@ main(int argc, char* argv[]) {
}
}
- if (o.mode == Options::listtests) {
+ if (listTestsMode) {
listTests(Test::testList, o.verbosity);
exit(0);
}
@@ -118,19 +119,10 @@ main(int argc, char* argv[]) {
// results.
try {
Environment e(o);
- switch (o.mode) {
- case Options::run:
- {
- for (Test* t = Test::testList; t; t = t->nextTest)
- if (binary_search(o.selectedTests.begin(),
- o.selectedTests.end(), t->name))
- t->run(e);
- break;
- }
- default:
- cerr << "Bad run mode in main()\n";
- break;
- }
+ for (Test* t = Test::testList; t; t = t->nextTest)
+ if (binary_search(o.selectedTests.begin(),
+ o.selectedTests.end(), t->name))
+ t->run(e);
}
#if defined(__X11__)
catch (WindowSystem::CantOpenDisplay) {
diff --git a/tests/glean/options.cpp b/tests/glean/options.cpp
index 9c39388..d77fbc5 100644
--- a/tests/glean/options.cpp
+++ b/tests/glean/options.cpp
@@ -41,7 +41,6 @@ namespace GLEAN {
Options::Options() {
- mode = notSet;
verbosity = 0;
visFilter = "1";
maxVisuals = ~0U;
diff --git a/tests/glean/options.h b/tests/glean/options.h
index 4332177..26fac81 100644
--- a/tests/glean/options.h
+++ b/tests/glean/options.h
@@ -57,10 +57,6 @@ namespace GLEAN {
class Options {
public:
- typedef enum {notSet, run, listtests} RunMode;
- RunMode mode; // Indicates whether we're generating
- // results, or comparing two previous runs.
-
int verbosity; // Verbosity level. 0 == concise; larger
// values imply more verbose output.
--
1.8.0.3
More information about the Piglit
mailing list