aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skqp/gm_runner.h
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-12-11 17:46:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-15 17:23:48 +0000
commitd7b3845f3d3f3498c2adc542b4b20003ac7d3ab0 (patch)
tree11ed4db86efb28f344255a6cc44f0c19d926c8ef /tools/skqp/gm_runner.h
parent0215e39d7e415d0530231df6ad20d5f215c72152 (diff)
SkQP: make_gmkb, gm_knowledge (GM Knowledgebase)
Add a real implementation for gm_knowledge.h This depends on the presence of files in the form $GMK_DIR/foo/{max,min}.png The implementation also writes out failures in a report directory. Add a utility: experimental/make_gmkb which is a stand-alone go executable that generates the foo/{max,min}.png data. tools/skqp/README.md has instructions on running SkQP. Also: add SkFontMgrPriv.h Change-Id: Ibe1e9a7e7de143d14eee3877f5f2d2d8713f7f49 Reviewed-on: https://skia-review.googlesource.com/65380 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools/skqp/gm_runner.h')
-rw-r--r--tools/skqp/gm_runner.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/tools/skqp/gm_runner.h b/tools/skqp/gm_runner.h
new file mode 100644
index 0000000000..690b3714e6
--- /dev/null
+++ b/tools/skqp/gm_runner.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef gm_runner_DEFINED
+#define gm_runner_DEFINED
+
+#include <memory>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include "skqp_asset_manager.h"
+
+/**
+A Skia GM is a single rendering test that can be executed on any Skia backend Canvas.
+*/
+namespace skiagm {
+class GM;
+}
+
+namespace skiatest {
+struct Test;
+}
+
+namespace gm_runner {
+
+using GMFactory = skiagm::GM* (*)(void*);
+
+using UnitTest = const skiatest::Test*;
+
+enum class SkiaBackend {
+ kGL,
+ kGLES,
+ kVulkan,
+};
+
+/**
+Initialize Skia
+*/
+void InitSkia();
+
+std::vector<SkiaBackend> GetSupportedBackends();
+
+/**
+@return a list of all Skia GMs in lexicographic order.
+*/
+std::vector<GMFactory> GetGMFactories(skqp::AssetManager*);
+
+/**
+@return a list of all Skia GPU unit tests in lexicographic order.
+*/
+std::vector<UnitTest> GetUnitTests();
+
+/**
+@return a descriptive name for the GM.
+*/
+std::string GetGMName(GMFactory);
+
+/**
+@return a descriptive name for the unit test.
+*/
+const char* GetUnitTestName(UnitTest);
+
+/**
+@return a descriptive name for the backend.
+*/
+const char* GetBackendName(SkiaBackend);
+
+enum class Error {
+ None = 0,
+ BadSkiaOutput = 1,
+ BadGMKBData = 2,
+ SkiaFailure = 3,
+};
+
+const char* GetErrorString(Error);
+
+/**
+@return A non-negative float representing how badly the GM failed (or zero for
+ success). Any error running or evaluating the GM will result in a non-zero
+ error code.
+*/
+std::tuple<float, Error> EvaluateGM(SkiaBackend backend,
+ GMFactory gmFact,
+ skqp::AssetManager* assetManager,
+ const char* reportDirectoryPath);
+
+/**
+@return a (hopefully empty) list of errors produced by this unit test.
+*/
+std::vector<std::string> ExecuteTest(UnitTest);
+
+} // namespace gm_runner
+
+#endif // gm_runner_DEFINED