From 025eb1738e2946fe20ded9b00b5e1a1b980bd588 Mon Sep 17 00:00:00 2001
From: Sean Klein <smklein@google.com>
Date: Mon, 13 May 2019 00:44:11 +0000
Subject: [PATCH] [test][zx] Relocate unit tests to exist alongside source

Change-Id: I8eb0d866deadd3f0ff0631f334b309fbe52e14dd
---
 zircon/system/{utest/libzx => ulib/zx/test}/BUILD.gn   |  9 ++++++++-
 zircon/system/{utest/libzx => ulib/zx/test}/traits.cpp |  0
 .../system/{utest/libzx => ulib/zx/test}/zx-test.cpp   |  0
 zircon/system/utest/BUILD.gn                           | 10 ++++++++--
 4 files changed, 16 insertions(+), 3 deletions(-)
 rename zircon/system/{utest/libzx => ulib/zx/test}/BUILD.gn (84%)
 rename zircon/system/{utest/libzx => ulib/zx/test}/traits.cpp (100%)
 rename zircon/system/{utest/libzx => ulib/zx/test}/zx-test.cpp (100%)

diff --git a/zircon/system/utest/libzx/BUILD.gn b/zircon/system/ulib/zx/test/BUILD.gn
similarity index 84%
rename from zircon/system/utest/libzx/BUILD.gn
rename to zircon/system/ulib/zx/test/BUILD.gn
index 74259e5907b..2b944582fb1 100644
--- a/zircon/system/utest/libzx/BUILD.gn
+++ b/zircon/system/ulib/zx/test/BUILD.gn
@@ -2,7 +2,14 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-test("libzx") {
+group("test") {
+  testonly = true
+  deps = [
+    ":zx",
+  ]
+}
+
+test("zx") {
   sources = [
     "traits.cpp",
     "zx-test.cpp",
diff --git a/zircon/system/utest/libzx/traits.cpp b/zircon/system/ulib/zx/test/traits.cpp
similarity index 100%
rename from zircon/system/utest/libzx/traits.cpp
rename to zircon/system/ulib/zx/test/traits.cpp
diff --git a/zircon/system/utest/libzx/zx-test.cpp b/zircon/system/ulib/zx/test/zx-test.cpp
similarity index 100%
rename from zircon/system/utest/libzx/zx-test.cpp
rename to zircon/system/ulib/zx/test/zx-test.cpp
diff --git a/zircon/system/utest/BUILD.gn b/zircon/system/utest/BUILD.gn
index 8c4164d248b..c575196e31e 100644
--- a/zircon/system/utest/BUILD.gn
+++ b/zircon/system/utest/BUILD.gn
@@ -10,6 +10,12 @@ if (current_cpu != "") {
   group("utest") {
     testonly = true
 
+    # For unittests, the recommended naming scheme is:
+    #   path/to/code/test
+    # or
+    #   path/to/code:test
+    #
+    # Where "test" is a group containing all unittest labels.
     deps = [
       ":host",  # TODO(mcgrathr): reach this differently?
       "$zx/system/core/bootsvc:tests",
@@ -78,7 +84,8 @@ if (current_cpu != "") {
       "$zx/system/ulib/tftp:tftp-test",
       "$zx/system/ulib/trace-reader:tests",
       "$zx/system/ulib/trace-vthread:tests",
-      "$zx/system/ulib/zbi-bootfs/test:test",
+      "$zx/system/ulib/zbi-bootfs/test",
+      "$zx/system/ulib/zx/test",
       "$zx/system/ulib/zxtest/test",
       "abigen",
       "async-testutils",
@@ -140,7 +147,6 @@ if (current_cpu != "") {
       "kernel-unittests",
       "launchpad",
       "libhwreg",
-      "libzx",
       "log",
       "logger",
       "memfs",
-- 
GitLab