[zbi_test][qemu][testing] Move qemu version.
Move qemu version from testing module to qemu module. This also
removes the dependency on testing from zbi_test.py. Now changes to the
testing module won't launch unnecessary on-hardware led jobs from the
recipes CQ builder. (The zbi_test.py recipe does net yet but will soon
trigger tests on hardware.)
Related to fxb/10198, but this does not directly address that bug.
Change-Id: Id411cd187548b1f85e7276eec171bd6bbcbbc8d9
Bug: 10198
diff --git a/recipe_modules/qemu/__init__.py b/recipe_modules/qemu/__init__.py
new file mode 100644
index 0000000..9fbb174
--- /dev/null
+++ b/recipe_modules/qemu/__init__.py
@@ -0,0 +1,5 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+DEPS = []
diff --git a/recipe_modules/qemu/api.py b/recipe_modules/qemu/api.py
new file mode 100644
index 0000000..e504abb
--- /dev/null
+++ b/recipe_modules/qemu/api.py
@@ -0,0 +1,14 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from recipe_engine import recipe_api
+
+QEMU_CIPD_VERSION = 'git_revision:533bf2563d0213a7e002d9fcde75519d30ffa70f'
+
+
+class QemuApi(recipe_api.RecipeApi):
+
+ @property
+ def version(self):
+ return QEMU_CIPD_VERSION
diff --git a/recipe_modules/qemu/examples/full.expected/test.json b/recipe_modules/qemu/examples/full.expected/test.json
new file mode 100644
index 0000000..b6042b6
--- /dev/null
+++ b/recipe_modules/qemu/examples/full.expected/test.json
@@ -0,0 +1,5 @@
+[
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipe_modules/qemu/examples/full.py b/recipe_modules/qemu/examples/full.py
new file mode 100644
index 0000000..2e27b6c
--- /dev/null
+++ b/recipe_modules/qemu/examples/full.py
@@ -0,0 +1,15 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+DEPS = [
+ 'infra/qemu',
+]
+
+
+def RunSteps(api):
+ api.qemu.version
+
+
+def GenTests(api):
+ yield api.qemu.test('test')
diff --git a/recipe_modules/testing/__init__.py b/recipe_modules/testing/__init__.py
index cab56f3..4caffd3 100644
--- a/recipe_modules/testing/__init__.py
+++ b/recipe_modules/testing/__init__.py
@@ -5,6 +5,7 @@
'infra/experimental',
'infra/gsutil',
'infra/minfs',
+ 'infra/qemu',
'infra/status_check',
'infra/swarming_retry',
'infra/symbolize',
diff --git a/recipe_modules/testing/api.py b/recipe_modules/testing/api.py
index 3d042ac..f0c2791 100644
--- a/recipe_modules/testing/api.py
+++ b/recipe_modules/testing/api.py
@@ -17,7 +17,6 @@
RUNCMDS_BOOTFS_PATH = 'infra/runcmds'
SECRETSHIM_CIPD_VERSION = 'git_revision:63ab3ac613fceb52ac49b63b43fce841a2585645'
-QEMU_CIPD_VERSION = 'git_revision:533bf2563d0213a7e002d9fcde75519d30ffa70f'
# Name of BigQuery project and table for uploading artifacts.
BIGQUERY_PROJECT = 'fuchsia-infra'
@@ -757,7 +756,7 @@
indent=2)
ensure_file.add_package(
'fuchsia/third_party/qemu/${platform}',
- self._api.testing.qemu_version,
+ self._api.qemu.version,
subdir='qemu')
elif shard.netboot:
botanist_cmd.append('-netboot')
@@ -1032,11 +1031,6 @@
return isolated.archive('isolate build artifacts')
@property
- def qemu_version(self):
- """The version of the QEMU CIPD package to use."""
- return QEMU_CIPD_VERSION
-
- @property
def results_dir_on_target(self):
"""The directory on target to which target test results will be written."""
return '/tmp/infra-test-output'
@@ -1167,7 +1161,7 @@
ensure_file.add_package(
'fuchsia/third_party/qemu/${platform}',
- self.qemu_version,
+ self.m.qemu.version,
subdir='qemu')
request = self.m.swarming.task_request().with_name(task_name)
diff --git a/recipes/zbi_test.py b/recipes/zbi_test.py
index b3dae7a..049d58f 100644
--- a/recipes/zbi_test.py
+++ b/recipes/zbi_test.py
@@ -13,10 +13,10 @@
DEPS = [
'infra/build',
'infra/checkout',
+ 'infra/qemu',
'infra/status_check',
'infra/swarming_retry',
'infra/symbolize',
- 'infra/testing',
'recipe_engine/buildbucket',
'recipe_engine/cipd',
'recipe_engine/context',
@@ -140,7 +140,7 @@
ensure_file = self._api.cipd.EnsureFile()
ensure_file.add_package(
'fuchsia/third_party/qemu/${platform}',
- self._api.testing.qemu_version,
+ self._api.qemu.version,
subdir='qemu')
dimensions = {