=== modified file 'src/composite-canvas.cc'
@@ -595,29 +595,32 @@
{
Benchmark *benchmark = *benchIt;
current_test_ = &benchmark->setup_test();
- load_current_test_options();
- reshape(width_, height_);
- Log::info("Running test: '%s'\n", current_test_->name().c_str());
-
- while (true) {
- if (handle_xevent()) {
- if (Options::force_tex_update)
- update_all_textures();
-
- if (Options::draw) {
- profiler_draw_pair_.sample_start();
- current_test_->draw(this->window_list_);
- profiler_draw_pair_.sample_end();
- profiler_screen_update_pair_.sample_start();
- update_screen();
- profiler_screen_update_pair_.sample_end();
- }
-
- benchmark_update(next_iteration);
- if (next_iteration) {
- break;
- }
-
+
+ if (!current_test_->name().empty()) {
+ load_current_test_options();
+ reshape(width_, height_);
+ Log::info("Running test: '%s'\n", current_test_->name().c_str());
+
+ while (true) {
+ if (handle_xevent()) {
+ if (Options::force_tex_update)
+ update_all_textures();
+
+ if (Options::draw) {
+ profiler_draw_pair_.sample_start();
+ current_test_->draw(this->window_list_);
+ profiler_draw_pair_.sample_end();
+ profiler_screen_update_pair_.sample_start();
+ update_screen();
+ profiler_screen_update_pair_.sample_end();
+ }
+
+ benchmark_update(next_iteration);
+ if (next_iteration) {
+ break;
+ }
+
+ }
}
}
=== added file 'src/composite-test-default-options.cc'
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2011 Linaro Limited
+ *
+ * This file is part of glcompbench.
+ *
+ * glcompbench is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * glcompbench is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with glcompbench. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis <alexandros.frantzis@linaro.org>
+ * Jesse Barker <jesse.barker@linaro.org>
+ */
+
+#include "composite-test.h"
+#include "options.h"
+#include "benchmark.h"
+
+/**
+ * Prepares the test for a test run.
+ */
+void
+CompositeTestDefaultOptions::prepare_for_run()
+{
+ const std::map<std::string, CompositeTest *> &tests = Benchmark::tests();
+
+ for (std::list<std::pair<std::string, std::string> >::const_iterator iter = default_options_.begin();
+ iter != default_options_.end();
+ iter++)
+ {
+ for (std::map<std::string, CompositeTest *>::const_iterator test_iter = tests.begin();
+ test_iter != tests.end();
+ test_iter++)
+ {
+ test_iter->second->set_option_default(iter->first, iter->second);
+ }
+ }
+}
+
+bool
+CompositeTestDefaultOptions::set_option(const std::string &opt,
+ const std::string &val)
+{
+ default_options_.push_back(std::pair<std::string, std::string>(opt, val));
+ return true;
+}
=== modified file 'src/composite-test.cc'
@@ -83,3 +83,15 @@
}
}
+bool
+CompositeTest::set_option_default(const string &opt, const string &val)
+{
+ map<string, Option>::iterator iter = options_.find(opt);
+
+ if (iter == options_.end())
+ return false;
+
+ iter->second.default_value = val;
+
+ return true;
+}
=== modified file 'src/composite-test.h'
@@ -63,8 +63,9 @@
std::string description;
};
- bool set_option(const std::string &opt, const std::string &val);
+ virtual bool set_option(const std::string &opt, const std::string &val);
void reset_options();
+ bool set_option_default(const std::string &opt, const std::string &val);
const std::map<std::string, Option> &options() { return options_; }
static CompositeTest &dummy()
@@ -87,6 +88,18 @@
std::map<std::string, Option> options_;
};
+class CompositeTestDefaultOptions : public CompositeTest
+{
+public:
+ CompositeTestDefaultOptions() : CompositeTest("") {}
+
+ virtual void prepare_for_run();
+ virtual bool set_option(const std::string &opt, const std::string &val);
+
+protected:
+ std::list<std::pair<std::string, std::string> > default_options_;
+};
+
class CompositeTestSimpleBase : public CompositeTest
{
public:
=== modified file 'src/glcompbench.cc'
@@ -50,6 +50,9 @@
test_iter++)
{
CompositeTest *test = test_iter->second;
+ if (test->name().empty())
+ continue;
+
Log::info("[Test] %s\n", test->name().c_str());
const map<string, CompositeTest::Option> &options = test->options();
@@ -107,6 +110,7 @@
return 0;
}
+ Benchmark::register_test(*new CompositeTestDefaultOptions());
Benchmark::register_test(*new CompositeTestSimpleDefault());
Benchmark::register_test(*new CompositeTestSimpleBrick());