autotest: add new suite for cros_test_platform entry point

This CL is a squash of the following 3 original CLs:

https://chromium-review.googlesource.com/1653735
https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1686544
https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1687983

This adds support for cros_test_platform to launch tests against this
branch's builds. Because cros_test_platform is not yet used anywhere,
this is safe to land on existing branches.

BUG=chromium:971377
TEST=None

Change-Id: I7e4476f6424453ea5d2624f4f968fc95bd563da3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1686680
Tested-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Cindy Bayless <cindyb@chromium.org>
Reviewed-by: Cindy Bayless <cindyb@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
diff --git a/test_suites/control.cros_test_platform b/test_suites/control.cros_test_platform
new file mode 100644
index 0000000..8938ca0
--- /dev/null
+++ b/test_suites/control.cros_test_platform
@@ -0,0 +1,36 @@
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "Chrome OS Test Platform Team"
+NAME = "cros_test_platform"
+PURPOSE = "Entry point for cros_test_platform execution of autotest tests."
+
+DOC = """
+This suite is used as an entry point for cros_test_platform, to allow it to
+inject arbitrary arguments into dynamic_suite.reimage_and_run, by
+supplying these arguments as a json-encoded args dictionary (with name
+args_dict_json).
+
+This suite should not be used for any other purpose.
+"""
+
+import json
+
+import common
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
+
+
+TIME = "SHORT"
+TEST_CATEGORY = "General"
+TEST_CLASS = "suite"
+TEST_TYPE = "Server"
+
+# Load and overwrite args_dict.
+args_dict_json = args_dict['args_dict_json']
+args_dict.update(dynamic_suite.byteify(json.loads(args_dict_json)))
+
+# Inject handle to current job instance.
+args_dict['job'] = job
+
+dynamic_suite.reimage_and_run(**args_dict)