[gn-sdk]Add sample project build test to SDK recipe

Change-Id: Ia3e2d8f949d613c3e380e3f3d48ee68461f62769
diff --git a/recipes/sdk.expected/global_ci.json b/recipes/sdk.expected/global_ci.json
index d3dd345..14be695 100644
--- a/recipes/sdk.expected/global_ci.json
+++ b/recipes/sdk.expected/global_ci.json
@@ -1746,7 +1746,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/local_ci.json b/recipes/sdk.expected/local_ci.json
index 4ae2946..7ad84da 100644
--- a/recipes/sdk.expected/local_ci.json
+++ b/recipes/sdk.expected/local_ci.json
@@ -1732,7 +1732,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/local_ci_mac.json b/recipes/sdk.expected/local_ci_mac.json
index 6e87670..802aebd 100644
--- a/recipes/sdk.expected/local_ci_mac.json
+++ b/recipes/sdk.expected/local_ci_mac.json
@@ -1815,7 +1815,7 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/mac_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -1833,6 +1833,34 @@
     ]
   },
   {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "name": "$result"
   }
 ]
\ No newline at end of file
diff --git a/recipes/sdk.expected/local_cq.json b/recipes/sdk.expected/local_cq.json
index b8b1bb8..89f0567 100644
--- a/recipes/sdk.expected/local_cq.json
+++ b/recipes/sdk.expected/local_cq.json
@@ -1849,7 +1849,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/release_ci.json b/recipes/sdk.expected/release_ci.json
index 3737781..67b4467 100644
--- a/recipes/sdk.expected/release_ci.json
+++ b/recipes/sdk.expected/release_ci.json
@@ -1870,7 +1870,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/release_ci_image_failure.json b/recipes/sdk.expected/release_ci_image_failure.json
index dd89f6d..121b70b 100644
--- a/recipes/sdk.expected/release_ci_image_failure.json
+++ b/recipes/sdk.expected/release_ci_image_failure.json
@@ -1870,7 +1870,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/release_ci_new_upload.json b/recipes/sdk.expected/release_ci_new_upload.json
index 786c645..820c79a 100644
--- a/recipes/sdk.expected/release_ci_new_upload.json
+++ b/recipes/sdk.expected/release_ci_new_upload.json
@@ -1870,7 +1870,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/snapshot_ci.json b/recipes/sdk.expected/snapshot_ci.json
index c498b98..a4ac009 100644
--- a/recipes/sdk.expected/snapshot_ci.json
+++ b/recipes/sdk.expected/snapshot_ci.json
@@ -1796,7 +1796,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/snapshot_cq.json b/recipes/sdk.expected/snapshot_cq.json
index 2d71723..ecd25aa 100644
--- a/recipes/sdk.expected/snapshot_cq.json
+++ b/recipes/sdk.expected/snapshot_cq.json
@@ -1922,7 +1922,35 @@
       "--bazel",
       "[START_DIR]/fuchsia/prebuilt/third_party/bazel/linux_x64/bazel"
     ],
-    "name": "test sdk.run tests",
+    "name": "test sdk.run bazel tests",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/fuchsia/scripts/sdk/gn/generate.py",
+      "--archive",
+      "[CLEANUP]/merged_sdk_archive.tar.gz",
+      "--output",
+      "[CLEANUP]/sdk-gn",
+      "--tests",
+      "[CLEANUP]/tests"
+    ],
+    "name": "test sdk.create gn sdk",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CLEANUP]/tests/run.py"
+    ],
+    "name": "test sdk.run gn tests",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.py b/recipes/sdk.py
index 2685d90..2615a43 100644
--- a/recipes/sdk.py
+++ b/recipes/sdk.py
@@ -296,7 +296,7 @@
         ])
 
   # Generate a Bazel workspace along with its tests.
-  # These tests are being run for every SDK type.
+  # These tests are being run for every SDK flavor.
   generate_bazel_path = checkout.root_dir.join('scripts', 'sdk', 'bazel',
                                                'generate.py')
   sdk_dir = api.path['cleanup'].join('sdk-bazel')
@@ -329,7 +329,7 @@
 
     with api.macos_sdk():
       api.python(
-          'run tests',
+          'run bazel tests',
           test_workspace_dir.join('run.py'),
           args=[
               '--output_user_root',
@@ -339,6 +339,27 @@
           ],
       )
 
+  # Generate a GN workspace along with its tests.
+  # These tests are being run for every SDK flavor.
+    generate_gn_path = checkout.root_dir.join('scripts', 'sdk', 'gn',
+                                              'generate.py')
+    sdk_dir = api.path['cleanup'].join('sdk-gn')
+    test_workspace_dir = api.path['cleanup'].join('tests')
+
+    api.python(
+        'create gn sdk',
+        generate_gn_path,
+        args=[
+            '--archive',
+            full_archive_path,
+            '--output',
+            sdk_dir,
+            '--tests',
+            test_workspace_dir,
+        ],
+    )
+    api.python('run gn tests', test_workspace_dir.join('run.py'))
+
   if image_builds:
     image_builds = api.buildbucket.collect_builds(
         build_ids=[image_build.id for image_build in image_builds],