[rust] Convert fuchsia-async and fuchsia-syslog to component tests

Bug: CF-789 #comment

Change-Id: I3bb743a79fd83c4bcda70003a7cc8a1e7cc590ed
diff --git a/garnet/packages/tests/BUILD.gn b/garnet/packages/tests/BUILD.gn
index eed1c20..97a4efe 100644
--- a/garnet/packages/tests/BUILD.gn
+++ b/garnet/packages/tests/BUILD.gn
@@ -1155,7 +1155,9 @@
     "//garnet/lib/rust/fuchsia_uri_rewrite:fuchsia_uri_rewrite_tests",
     "//garnet/lib/rust/io_util:io_util_tests",
     "//garnet/public/rust:rust-crates-tests",
+    "//garnet/public/rust/fuchsia-async:fuchsia-async-tests",
     "//garnet/public/rust/fuchsia-hyper:fuchsia-hyper-tests",
+    "//garnet/public/rust/fuchsia-syslog:fuchsia-syslog-tests",
   ]
 }
 
diff --git a/garnet/public/rust/BUILD.gn b/garnet/public/rust/BUILD.gn
index 8abc59a..2bfca60 100644
--- a/garnet/public/rust/BUILD.gn
+++ b/garnet/public/rust/BUILD.gn
@@ -11,15 +11,12 @@
   deps = [
     "fdio",
     "fuchsia-archive",
-    "fuchsia-async",
     "fuchsia-component:fuchsia-component-blackbox-unit-tests",
     "fuchsia-cprng",
     "fuchsia-framebuffer",
     "fuchsia-hyper:fuchsia-hyper-tests",
     "fuchsia-inspect",
     "fuchsia-merkle",
-    "fuchsia-syslog",
-    "fuchsia-syslog",
     "fuchsia-trace",
     "fuchsia-vfs/pseudo-fs",
     "fuchsia-zircon",
@@ -40,10 +37,6 @@
       environments = basic_envs
     },
     {
-      name = "fuchsia_async_lib_test"
-      environments = basic_envs
-    },
-    {
       name = "fuchsia_component_blackbox_unit_tests_lib_test"
       environments = basic_envs
     },
@@ -60,10 +53,6 @@
       environments = basic_envs
     },
     {
-      name = "fuchsia_syslog_lib_test"
-      environments = basic_envs
-    },
-    {
       name = "fuchsia_trace_lib_test"
       environments = basic_envs
     },
diff --git a/garnet/public/rust/fuchsia-async/BUILD.gn b/garnet/public/rust/fuchsia-async/BUILD.gn
index 482c95b..9f0eb53 100644
--- a/garnet/public/rust/fuchsia-async/BUILD.gn
+++ b/garnet/public/rust/fuchsia-async/BUILD.gn
@@ -3,6 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/rust/rustc_library.gni")
+import("//build/test/test_package.gni")
+import("//build/testing/environments.gni")
 
 rustc_library("fuchsia-async") {
   name = "fuchsia_async"
@@ -23,3 +25,16 @@
     "//third_party/rust_crates:slab",
   ]
 }
+
+test_package("fuchsia-async-tests") {
+  deps = [
+    ":fuchsia-async",
+  ]
+
+  tests = [
+    {
+      name = "fuchsia_async_lib_test"
+      environments = basic_envs
+    },
+  ]
+}
diff --git a/garnet/public/rust/fuchsia-async/meta/fuchsia_async_lib_test.cmx b/garnet/public/rust/fuchsia-async/meta/fuchsia_async_lib_test.cmx
new file mode 100644
index 0000000..0c7a3e7
--- /dev/null
+++ b/garnet/public/rust/fuchsia-async/meta/fuchsia_async_lib_test.cmx
@@ -0,0 +1,20 @@
+{
+    "facets": {
+        "fuchsia.test": {
+            "system-services": [
+                "fuchsia.net.Connectivity",
+                "fuchsia.net.SocketProvider",
+                "fuchsia.net.stack.Stack",
+                "fuchsia.netstack.Netstack"
+            ]
+        }
+    },
+    "program": {
+        "binary": "test/fuchsia_async_lib_test"
+    },
+    "sandbox": {
+        "services": [
+            "fuchsia.net.SocketProvider"
+        ]
+    }
+}
diff --git a/garnet/public/rust/fuchsia-syslog/BUILD.gn b/garnet/public/rust/fuchsia-syslog/BUILD.gn
index b90e451..1d3d1fd 100644
--- a/garnet/public/rust/fuchsia-syslog/BUILD.gn
+++ b/garnet/public/rust/fuchsia-syslog/BUILD.gn
@@ -3,6 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/rust/rustc_library.gni")
+import("//build/test/test_package.gni")
+import("//build/testing/environments.gni")
 
 rustc_library("fuchsia-syslog") {
   name = "fuchsia_syslog"
@@ -17,3 +19,16 @@
   ]
   non_rust_deps = [ "//zircon/public/lib/syslog" ]
 }
+
+test_package("fuchsia-syslog-tests") {
+  deps = [
+    ":fuchsia-syslog",
+  ]
+
+  tests = [
+    {
+      name = "fuchsia_syslog_lib_test"
+      environments = basic_envs
+    },
+  ]
+}
diff --git a/garnet/public/rust/fuchsia-syslog/meta/fuchsia_syslog_lib_test.cmx b/garnet/public/rust/fuchsia-syslog/meta/fuchsia_syslog_lib_test.cmx
new file mode 100644
index 0000000..646e346
--- /dev/null
+++ b/garnet/public/rust/fuchsia-syslog/meta/fuchsia_syslog_lib_test.cmx
@@ -0,0 +1,10 @@
+{
+    "program": {
+        "binary": "test/fuchsia_syslog_lib_test"
+    },
+    "sandbox": {
+        "features": [
+            "system-temp"
+        ]
+    }
+}