[yarn]: Add yarn_unittests GN target to BUILD.gn

Change-Id: I8f9324f40343d84c57bca76a33d1ce98311b8bf4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/35931
Kokoro-Presubmit: David Turner <digit@google.com>
Tested-by: David Turner <digit@google.com>
Presubmit-Ready: David Turner <digit@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Yarn/BUILD.gn b/src/Yarn/BUILD.gn
index eafe04b..fa7388a 100644
--- a/src/Yarn/BUILD.gn
+++ b/src/Yarn/BUILD.gn
@@ -14,6 +14,14 @@
 
 import("../swiftshader.gni")
 
+import("//testing/test.gni")
+
+config("yarn_config") {
+  include_dirs = [
+    "..",
+  ]
+}
+
 swiftshader_source_set("Yarn_headers") {
   sources = [
     "ConditionVariable.hpp",
@@ -35,6 +43,10 @@
   if (is_win) {
     sources += [ "OSFiber_windows.hpp" ]
   }
+
+  public_configs = [
+    ":yarn_config",
+  ]
 }
 
 swiftshader_source_set("Yarn") {
@@ -63,9 +75,26 @@
     ]
   }
 
-  include_dirs = [ ".." ]
-
   public_deps = [
     ":Yarn_headers",
   ]
 }
+
+test("yarn_unittests") {
+  sources = [
+    "ConditionVariable_test.cpp",
+    "Containers_test.cpp",
+    "Defer_test.cpp",
+    "OSFiber_test.cpp",
+    "Pool_test.cpp",
+    "Scheduler_test.cpp",
+    "Ticket_test.cpp",
+    "WaitGroup_test.cpp",
+    "Yarn_test.cpp",
+  ]
+  deps = [
+    ":Yarn",
+    "//testing/gtest",
+    "//testing/gmock",
+  ]
+}