[unification] Move //zircon/system/utest/thread-initial-state to the GN build

Generated with: //scripts/unification/move_zn_element.py

scripts/unification/verify_element_move.py --reference local/initial.json:

<none>

Bug: 36139
Change-Id: I7c25ecf17b94f55c57dbaffeb16088f6291a98c1
diff --git a/build/unification/images/BUILD.gn b/build/unification/images/BUILD.gn
index 7a9f85b..10008d9 100644
--- a/build/unification/images/BUILD.gn
+++ b/build/unification/images/BUILD.gn
@@ -679,7 +679,6 @@
     ":test.sys.test-exceptions-test",
     ":test.sys.tftp-test",
     ":test.sys.thermal-cli-test",
-    ":test.sys.thread-initial-state-test",
     ":test.sys.thread-safe-deleter-test",
     ":test.sys.timers-test",
     ":test.sys.trace-engine-hash-table-test",
@@ -1126,7 +1125,6 @@
     ":test.sys.test-exceptions-test",
     ":test.sys.tftp-test",
     ":test.sys.thermal-cli-test",
-    ":test.sys.thread-initial-state-test",
     ":test.sys.thread-safe-deleter-test",
     ":test.sys.timers-test",
     ":test.sys.trace-engine-hash-table-test",
@@ -2184,7 +2182,7 @@
     "//zircon/system/ulib/test-utils/test:test-utils-manifest",
     #":test.sys.tftp-test",
     #":test.sys.thermal-cli-test",
-    #":test.sys.thread-initial-state-test",
+    "//zircon/system/utest/thread-initial-state:thread-initial-state-manifest",
     #":test.sys.thread-safe-deleter-test",
     "//zircon/system/utest/thread-state:thread-state-manifest",
     #":test.sys.ti-lp8556-test",
@@ -2635,7 +2633,7 @@
     "//zircon/system/ulib/test-utils/test:test-utils-manifest",
     #":test.sys.tftp-test",
     #":test.sys.thermal-cli-test",
-    #":test.sys.thread-initial-state-test",
+    "//zircon/system/utest/thread-initial-state:thread-initial-state-manifest",
     #":test.sys.thread-safe-deleter-test",
     "//zircon/system/utest/thread-state:thread-state-manifest",
     "//zircon/system/dev/backlight/ti-lp8556:ti-lp8556-test-manifest",
diff --git a/zircon/system/utest/BUILD.gn b/zircon/system/utest/BUILD.gn
index 2d2d105..01d86eb 100644
--- a/zircon/system/utest/BUILD.gn
+++ b/zircon/system/utest/BUILD.gn
@@ -229,7 +229,6 @@
       "runtests-utils",
       "service:test",
       "stdio",
-      "thread-initial-state",
       "thread-safe-deleter",
       "timers",
       "trace",
diff --git a/zircon/system/utest/thread-initial-state/BUILD.gn b/zircon/system/utest/thread-initial-state/BUILD.gn
index dfc36d4..d16ec2d 100644
--- a/zircon/system/utest/thread-initial-state/BUILD.gn
+++ b/zircon/system/utest/thread-initial-state/BUILD.gn
@@ -2,16 +2,35 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-zx_test("thread-initial-state") {
-  sources = [ "init-state.c" ]
-  if (current_cpu == "x64") {
-    sources += [ "x86-64.S" ]
-  } else {
-    sources += [ "${zircon_cpu}.S" ]
-  }
-  deps = [
-    "$zx/system/ulib/fdio",
-    "$zx/system/ulib/unittest",
-    "$zx/system/ulib/zircon",
+##########################################
+# Though under //zircon, this build file #
+# is meant to be used in the Fuchsia GN  #
+# build.                                 #
+# See fxb/36139.                         #
+##########################################
+
+assert(!defined(zx) || zx != "/",
+       "This file can only be used in the Fuchsia GN build.")
+
+import("//build/test.gni")
+import("//build/unification/images/migrated_manifest.gni")
+
+test("thread-initial-state") {
+  # Dependent manifests unfortunately cannot be marked as `testonly`.
+  # Remove when converting this file to proper GN build idioms.
+  testonly = false
+  configs += [ "//build/unification/config:zircon-migrated" ]
+  sources = [
+    "${current_cpu}.S",
+    "init-state.c",
   ]
+  deps = [
+    "//zircon/public/lib/fdio",
+    "//zircon/public/lib/unittest",
+  ]
+  libs = [ "zircon" ]
+}
+
+migrated_manifest("thread-initial-state-manifest") {
+  deps = [ ":thread-initial-state" ]
 }
diff --git a/zircon/system/utest/thread-initial-state/x86-64.S b/zircon/system/utest/thread-initial-state/x64.S
similarity index 100%
rename from zircon/system/utest/thread-initial-state/x86-64.S
rename to zircon/system/utest/thread-initial-state/x64.S