/* * 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 #include #include #include #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, }; enum class Mode { /** This mode is set when used by Android CTS. All known tests are executed. */ kCompatibilityTestMode, /** This mode is set when used in the test lab. Some tests are skipped, if they are known to cause crashes in older devices. All GMs are evaluated with stricter requirements. */ kExperimentalMode, }; /** Initialize Skia */ void InitSkia(Mode, skqp::AssetManager*); std::vector GetSupportedBackends(); /** @return a list of all Skia GMs in lexicographic order. */ std::vector GetGMFactories(skqp::AssetManager*); /** @return a list of all Skia GPU unit tests in lexicographic order. */ std::vector 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 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 ExecuteTest(UnitTest); } // namespace gm_runner #endif // gm_runner_DEFINED