[bazel] Move skiatest::TestType from //tests/Test.h to a new //test/TestType.h file.
The follow-up CL (https://skia-review.googlesource.com/c/skia/+/811033) adds Ganesh/Vulkan support to SurfaceManager. In doing so, I ran into a compilation issue do a missing header file in //tools/gpu:utils.
Upon inspection, I saw that //tools/gpu/vk/VkTestHelper.cpp includes //tests/Test.h because it needs the skiatest::TestType enum class.
Rather than importing all of //tests/Test.h, I figured it would be cleaner (and probably simpler from the perspective of Bazel deps) to break out skiatest::TestType into its own header file, and include that instead.
For context, the //tests/Test.h import was added to //tools/gpu/vk/VkTestHelper.cpp 3 months ago in this CL: https://skia-review.googlesource.com/c/skia/+/776896. I added the CL's author to CC for their information.
Bug: b/40045301
Change-Id: Idd085bc8cd946152580f72831bf842a21077f54d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/811242
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel
index da7a546..d87d8d1 100644
--- a/tests/BUILD.bazel
+++ b/tests/BUILD.bazel
@@ -8,6 +8,12 @@
)
skia_cc_library(
+ name = "test_type",
+ hdrs = ["TestType.h"],
+ visibility = ["//tools/gpu:__pkg__"],
+)
+
+skia_cc_library(
name = "test_harness",
testonly = True,
srcs = [
@@ -22,6 +28,7 @@
"CtsEnforcement.h",
"Test.h",
"TestHarness.h",
+ "TestType.h",
],
visibility = ["//tools/testrunners/unit:__pkg__"],
deps = [
diff --git a/tests/Test.h b/tests/Test.h
index d710bb1..2164b7e 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -13,6 +13,7 @@
#include "include/private/base/SkTArray.h"
#include "src/core/SkTraceEvent.h"
#include "tests/CtsEnforcement.h"
+#include "tests/TestType.h"
#include "tools/Registry.h"
#if defined(SK_GANESH) || defined(SK_GRAPHITE)
@@ -115,8 +116,6 @@
using GraphiteTestProc = void (*)(Reporter*, const graphite::TestOptions&);
using GraphiteContextOptionsProc = void (*)(skgpu::graphite::ContextOptions*);
-enum class TestType : uint8_t { kCPU, kGanesh, kGraphite };
-
struct Test {
static Test MakeCPU(const char* name, CPUTestProc proc) {
return Test{name, TestType::kCPU, CtsEnforcement::kNever,
diff --git a/tests/TestType.h b/tests/TestType.h
new file mode 100644
index 0000000..3e699fe
--- /dev/null
+++ b/tests/TestType.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef skiatest_TestType_DEFINED
+#define skiatest_TestType_DEFINED
+
+#include <cstdint>
+
+namespace skiatest {
+
+enum class TestType : uint8_t { kCPU, kGanesh, kGraphite };
+
+}
+
+#endif
diff --git a/tools/gpu/BUILD.bazel b/tools/gpu/BUILD.bazel
index 0793cf6..f578c15 100644
--- a/tools/gpu/BUILD.bazel
+++ b/tools/gpu/BUILD.bazel
@@ -65,6 +65,7 @@
],
deps = ["//:skia_internal"] + select_multi({
"//src/gpu:gl_ganesh": ["//tools/gpu/gl:deps"],
+ "//src/gpu:vulkan_ganesh": ["//tests:test_type"],
}) + select({
"@platforms//os:macos": ["//tools:autorelease_pool_objc"],
"//conditions:default": ["//tools:autorelease_pool"],
diff --git a/tools/gpu/vk/VkTestHelper.cpp b/tools/gpu/vk/VkTestHelper.cpp
index 7625633..64cbd70 100644
--- a/tools/gpu/vk/VkTestHelper.cpp
+++ b/tools/gpu/vk/VkTestHelper.cpp
@@ -12,7 +12,7 @@
#include "include/core/SkSurface.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/vk/GrVkBackendContext.h"
-#include "tests/Test.h"
+#include "tests/TestType.h"
#include "tools/gpu/ProtectedUtils.h"
#include "tools/gpu/vk/VkTestUtils.h"