Split :tests into :test and :tests.

Split the :tests target into a :test target which contains the test
framework and :tests which collects all of the test cases. This allows
for all targets which define tests to depend on :test in order to define
tests, with :tests then depending on all targets which define tests. A
similar split should be considered for gms, samples, and benches.

Change-Id: Ic9f373ec0c1a8ea842fa68327e854db23477caae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371696
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 862af28..b84ade9 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1899,6 +1899,23 @@
     }
   }
 
+  test_lib("test") {
+    sources = [
+      "tests/Test.cpp",
+      "tests/Test.h",
+      "tests/TestUtils.cpp",
+      "tests/TestUtils.h",
+    ]
+    deps = [
+      ":flags",
+      ":skia",
+      ":tool_utils",
+    ]
+    public_deps = [
+      ":gpu_tool_utils",  # Test.h #includes headers from this target.
+    ]
+  }
+
   import("gn/tests.gni")
   test_lib("tests") {
     sources = tests_sources + pathops_tests_sources
@@ -1920,6 +1937,7 @@
     deps = [
       ":flags",
       ":skia",
+      ":test",
       ":tool_utils",
       "experimental/skrive:tests",
       "modules/skottie:tests",
@@ -1931,9 +1949,6 @@
       "//third_party/libwebp",
       "//third_party/zlib",
     ]
-    public_deps = [
-      ":gpu_tool_utils",  # Test.h #includes headers from this target.
-    ]
   }
 
   import("gn/bench.gni")
diff --git a/experimental/skrive/BUILD.gn b/experimental/skrive/BUILD.gn
index 4f77a54..14b5219 100644
--- a/experimental/skrive/BUILD.gn
+++ b/experimental/skrive/BUILD.gn
@@ -38,8 +38,8 @@
 
         deps = [
           ":skrive",
-          "../..:gpu_tool_utils",
           "../..:skia",
+          "../..:test",
         ]
       }
     }
diff --git a/gn/tests.gni b/gn/tests.gni
index 9220b81..e9da129 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -301,11 +301,7 @@
   "$_tests/TDPQueueTest.cpp",
   "$_tests/TLazyTest.cpp",
   "$_tests/TemplatesTest.cpp",
-  "$_tests/Test.cpp",
-  "$_tests/Test.h",
   "$_tests/TestTest.cpp",
-  "$_tests/TestUtils.cpp",
-  "$_tests/TestUtils.h",
   "$_tests/TextBlobCacheTest.cpp",
   "$_tests/TextBlobTest.cpp",
   "$_tests/TextureOpTest.cpp",
diff --git a/modules/skottie/BUILD.gn b/modules/skottie/BUILD.gn
index f4df67b..b6e8f80 100644
--- a/modules/skottie/BUILD.gn
+++ b/modules/skottie/BUILD.gn
@@ -62,8 +62,8 @@
 
         deps = [
           ":skottie",
-          "../..:gpu_tool_utils",
           "../..:skia",
+          "../..:test",
           "../skshaper",
         ]
       }
diff --git a/modules/skparagraph/BUILD.gn b/modules/skparagraph/BUILD.gn
index e8a8b48..60318bb 100644
--- a/modules/skparagraph/BUILD.gn
+++ b/modules/skparagraph/BUILD.gn
@@ -67,8 +67,8 @@
         sources = [ "tests/SkParagraphTest.cpp" ]
         deps = [
           ":skparagraph",
-          "../..:gpu_tool_utils",
           "../..:skia",
+          "../..:test",
           "../skshaper",
         ]
       } else {
diff --git a/modules/sksg/BUILD.gn b/modules/sksg/BUILD.gn
index 3bf998b..4caeffe 100644
--- a/modules/sksg/BUILD.gn
+++ b/modules/sksg/BUILD.gn
@@ -22,15 +22,12 @@
   source_set("tests") {
     testonly = true
 
-    configs += [
-      "../..:skia_private",
-      "../..:tests_config",  # TODO: refactor to make this nicer
-    ]
+    configs += [ "../..:skia_private" ]
     sources = [ "tests/SGTest.cpp" ]
     deps = [
       ":sksg",
-      "../..:gpu_tool_utils",  # TODO: refactor to make this nicer
       "../..:skia",
+      "../..:test",
     ]
   }
 
diff --git a/modules/svg/BUILD.gn b/modules/svg/BUILD.gn
index e1a6056..6b71c54 100644
--- a/modules/svg/BUILD.gn
+++ b/modules/svg/BUILD.gn
@@ -46,16 +46,13 @@
     source_set("tests") {
       testonly = true
 
-      configs += [
-        "../..:skia_private",
-        "../..:tests_config",
-      ]
+      configs += [ "../..:skia_private" ]
       sources = [ "tests/Text.cpp" ]
 
       deps = [
         ":svg",
-        "../..:gpu_tool_utils",
         "../..:skia",
+        "../..:test",
       ]
     }
   }