aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-06-06 11:15:09 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-06 15:37:54 +0000
commitf454bd3930ec61d4a8aa20c877d386077152c1e0 (patch)
tree273235c9f69c97f302a9871ad66e084b67770eda
parente62999f6efcffb12eff9502ec3603a3ed50b6e32 (diff)
rm TestConfigParsing
No test tests, ok? Gotta draw the line somewhere. Change-Id: I52284272f74a72a858910a143ecd4ad68fe3f1de Reviewed-on: https://skia-review.googlesource.com/132410 Commit-Queue: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r--gn/tests.gni1
-rw-r--r--tests/TestConfigParsing.cpp379
2 files changed, 0 insertions, 380 deletions
diff --git a/gn/tests.gni b/gn/tests.gni
index a67b4f4e34..2b187c4ad5 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -254,7 +254,6 @@ tests_sources = [
"$_tests/TemplatesTest.cpp",
"$_tests/TessellatingPathRendererTests.cpp",
"$_tests/Test.cpp",
- "$_tests/TestConfigParsing.cpp",
"$_tests/TestTest.cpp",
"$_tests/TestUtils.h",
"$_tests/TestUtils.cpp",
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
deleted file mode 100644
index c5f620f748..0000000000
--- a/tests/TestConfigParsing.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorSpace.h"
-#include "SkCommonFlagsConfig.h"
-#include "Test.h"
-#include <initializer_list>
-
-using sk_gpu_test::GrContextFactory;
-
-namespace {
-// The code
-// SkCommandLineFlags::StringArray FLAGS_config1 = make_string_array({"a", "b"})
-// can be used to construct string array that one gets with command line flags.
-// For example, the call above is equivalent of
-// DEFINE_string(config1, "a b", "");
-// in cases where the default command line flag value ("a b") is used.
-// make_string_array can be used to construct StringArray strings that have spaces in
-// them.
-SkCommandLineFlags::StringArray make_string_array(std::initializer_list<const char*> strings) {
- SkTArray<SkString> array;
- for (auto& s : strings) {
- array.push_back(SkString(s));
- }
- return SkCommandLineFlags::StringArray(array);
-}
-}
-DEF_TEST(ParseConfigs_Gpu, reporter) {
- // Parses a normal config and returns correct "tag".
- // Simple GL config works
- SkCommandLineFlags::StringArray config1 = make_string_array({"gl"});
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
-
- REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
- REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == nullptr);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSurfType() ==
- SkCommandLineConfigGpu::SurfType::kDefault);
-}
-
-DEF_TEST(ParseConfigs_OutParam, reporter) {
- // Clears the out parameter.
- SkCommandLineFlags::StringArray config1 = make_string_array({"gles"});
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gles"));
-
- SkCommandLineFlags::StringArray config2 = make_string_array({"8888"});
- ParseConfigs(config2, &configs);
- REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888"));
-
- SkCommandLineFlags::StringArray config3 = make_string_array({"gl"});
- ParseConfigs(config3, &configs);
- REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
-}
-
-DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
- // Parses all default configs and returns correct "tag".
-
- SkCommandLineFlags::StringArray config1 = make_string_array({
- "565",
- "8888",
- "debuggl",
- "gl",
- "gldft",
- "nullgl",
- "glmsaa8",
- "glmsaa4",
- "nonrendering",
- "nullgl",
- "gles",
- "glnvpr8",
- "glnvpr4",
- "pdf",
- "skp",
- "svg",
- "xps",
- "angle_d3d11_es2",
- "angle_gl_es2",
- "commandbuffer",
- "mesa",
- "hwui",
- "glf16",
- "glessrgb",
- "gl",
- "glnvpr4",
- "glsrgb",
- "glmsaa4",
- "vk",
- "glnostencils",
- "mock",
- "mtl",
- "gl4444",
- "gl565",
- "gltestthreading",
- "gl1010102",
- "glesbert"
- });
-
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
-
- auto srgbColorSpace = SkColorSpace::MakeSRGB();
-
- REPORTER_ASSERT(reporter, configs.count() == config1.count());
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0);
- }
- REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[3]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[5]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 8);
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[9]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[10]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getSamples() == 8);
- REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[11]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[12]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, !configs[13]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[14]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[17]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[18]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[19]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
- REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()->getColorSpace());
- REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()->getColorSpace()->gammaIsLinear());
- const SkMatrix44* srgbXYZ = srgbColorSpace->toXYZD50();
- SkASSERT(srgbXYZ);
- const SkMatrix44* config25XYZ = configs[22]->asConfigGpu()->getColorSpace()->toXYZD50();
- SkASSERT(config25XYZ);
- REPORTER_ASSERT(reporter, *config25XYZ == *srgbXYZ);
- REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
- REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
- REPORTER_ASSERT(reporter, configs[24]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, configs[26]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
- REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
- REPORTER_ASSERT(reporter, configs[27]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getSamples() == 4);
-#ifdef SK_VULKAN
- REPORTER_ASSERT(reporter, configs[28]->asConfigGpu());
-#endif
- REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, SkToBool(configs[29]->asConfigGpu()->getContextOverrides() &
- SkCommandLineConfigGpu::ContextOverrides::kAvoidStencilBuffers));
- REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getContextType() ==
- GrContextFactory::kMock_ContextType);
-
- REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getColorType() == kARGB_4444_SkColorType);
- REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getAlphaType() == kPremul_SkAlphaType);
- REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getColorType() == kRGB_565_SkColorType);
- REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getAlphaType() == kOpaque_SkAlphaType);
- REPORTER_ASSERT(reporter, configs[34]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getTestThreading());
- REPORTER_ASSERT(reporter, configs[35]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getColorType() ==
- kRGBA_1010102_SkColorType);
- REPORTER_ASSERT(reporter, configs[36]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getSurfType() ==
- SkCommandLineConfigGpu::SurfType::kBackendRenderTarget);
-}
-
-DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
- SkCommandLineFlags::StringArray config1 = make_string_array({
- "gpu[api=gl,nvpr=true,dit=false]",
- "gpu[api=angle_d3d9_es2]",
- "gpu[api=angle_gl_es3]",
- "gpu[api=mesa,samples=77]",
- "gpu[dit=true,api=commandbuffer]",
- "gpu[api=gles]",
- "gpu[api=gl]",
- "gpu[api=vulkan]",
- "gpu[api=metal]",
- "gpu[api=mock,surf=betex]",
- });
-
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- REPORTER_ASSERT(reporter, configs.count() == config1.count());
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- }
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1);
- REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() ==
- GrContextFactory::kANGLE_D3D9_ES2_ContextType);
- REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() ==
- GrContextFactory::kANGLE_GL_ES3_ContextType);
- REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() ==
- GrContextFactory::kCommandBuffer_ContextType);
- REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGLES_ContextType);
- REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 1);
- REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 1);
-#ifdef SK_VULKAN
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() ==
- GrContextFactory::kVulkan_ContextType);
- REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 1);
-#endif
-#ifdef SK_METAL
- REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() ==
- GrContextFactory::kMetal_ContextType);
- REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getSamples() == 0);
-#endif
- REPORTER_ASSERT(reporter, configs[9]->asConfigGpu()->getContextType() ==
- GrContextFactory::kMock_ContextType);
- REPORTER_ASSERT(reporter, configs[9]->asConfigGpu()->getSurfType() ==
- SkCommandLineConfigGpu::SurfType::kBackendTexture);
-}
-
-DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
- SkCommandLineFlags::StringArray config1 = make_string_array({
- "gpu[api=gl,nvpr=1]", // Number as bool.
- "gpu[api=gl,]", // Trailing in comma.
- "gpu[api=angle_glu]", // Unknown api.
- "gpu[api=,samples=0]", // Empty api.
- "gpu[api=gl,samples=true]", // Value true as a number.
- "gpu[api=gl,samples=0,samples=0]", // Duplicate option key.
- "gpu[,api=gl,samples=0]", // Leading comma.
- "gpu[samples=54", // Missing closing parenthesis.
- ",,",
- "gpu[]", // Missing required api specifier
- "gpu[samples=4]", // Missing required api specifier
- "gpu[", // Missing bracket.
- "samples=54" // No backend.
- "gpu[nvpr=true ]", // Space.
- });
-
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- REPORTER_ASSERT(reporter, configs.count() == config1.count());
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i]));
- REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu());
- }
-}
-
-DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) {
- // These just list explicitly some properties of the system.
- SkCommandLineFlags::StringArray config1 = make_string_array({
- // Options are not canonized -> two same configs have a different tag.
- "gpu[api=gl,nvpr=true,dit=true]", "gpu[api=gl,dit=true,nvpr=true]",
- "gpu[api=debuggl]", "gpu[api=gl]", "gpu[api=gles]", ""
- "gpu[api=gl]", "gpu[api=gl,samples=0]", "gpu[api=gles,samples=0]"
- });
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- REPORTER_ASSERT(reporter, configs.count() == config1.count());
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu"));
- REPORTER_ASSERT(reporter, configs[i]->asConfigGpu());
- }
-}
-
-DEF_TEST(ParseConfigs_ViaParsing, reporter) {
- SkCommandLineFlags::StringArray config1 = make_string_array({
- "a-b-c-8888",
- "zz-qq-gpu",
- "a-angle_gl_es2"
- });
-
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- const struct {
- const char* backend;
- const char* vias[3];
- } expectedConfigs[] = {
- {"8888", {"a", "b", "c"}},
- {"gpu", {"zz", "qq", nullptr}},
- {"gpu", { "a", nullptr, nullptr }}
- };
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(expectedConfigs[i].backend));
- for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(expectedConfigs[i].vias)); ++j) {
- if (!expectedConfigs[i].vias[j]) {
- REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == j);
- break;
- }
- REPORTER_ASSERT(reporter,
- configs[i]->getViaParts()[j].equals(expectedConfigs[i].vias[j]));
- }
- }
-}
-
-DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
- SkCommandLineFlags::StringArray config1 = make_string_array({
- "zz-qq-gpu[api=gles]",
- "abc-nbc-cbs-gpu[api=angle_d3d9_es2,samples=1]",
- "a-gpu[api=gl",
- "abc-def-angle_gl_es2[api=gles]",
- });
-
- SkCommandLineConfigArray configs;
- ParseConfigs(config1, &configs);
- const struct {
- const char* backend;
- const char* vias[3];
- } expectedConfigs[] = {
- {"gpu", {"zz", "qq", nullptr}},
- {"gpu", {"abc", "nbc", "cbs"}},
- {"gpu[api=gl", {"a", nullptr, nullptr}}, // Missing bracket makes this is not extended
- // form but via still works as expected.
- {"angle_gl_es2[api=gles]", {"abc", "def", nullptr}} // This is not extended form.
- // angle_gl_es2 is an api type not a
- // backend.
- };
- for (int i = 0; i < config1.count(); ++i) {
- REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
- REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(expectedConfigs[i].backend));
- for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(expectedConfigs[i].vias)); ++j) {
- if (!expectedConfigs[i].vias[j]) {
- REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() ==
- static_cast<int>(j));
- break;
- }
- REPORTER_ASSERT(reporter,
- configs[i]->getViaParts()[j].equals(expectedConfigs[i].vias[j]));
- }
- }
- REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
-}