Create boot_module property
Only one boot module should be allowed. It's nice to automatically add
boot_test_runner to allow testing, but it can conflict with other
boot modules. The solution is to make it a separate property.
Change-Id: Iec25d803fae015c6a4f4f07aa63d82a4fcf86d03
diff --git a/recipes/fuchsia.expected/boot_module.json b/recipes/fuchsia.expected/boot_module.json
new file mode 100644
index 0000000..a4ea361
--- /dev/null
+++ b/recipes/fuchsia.expected/boot_module.json
@@ -0,0 +1,393 @@
+[
+ {
+ "cmd": [],
+ "name": "ensure_jiri"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "--root",
+ "[START_DIR]/cipd/jiri",
+ "--list",
+ "fuchsia/tools/jiri/linux-amd64 latest",
+ "--json-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure_jiri.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/tools/jiri/linux-amd64\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "ensure_gsutil"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "--root",
+ "[START_DIR]/cipd/gsutil",
+ "--list",
+ "infra/tools/gsutil latest",
+ "--json-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure_gsutil.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/gsutil\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "ensure_goma"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "--root",
+ "[START_DIR]/cipd/goma",
+ "--list",
+ "infra_internal/goma/client/linux-amd64 release",
+ "--json-output",
+ "/path/to/tmp/json",
+ "--service-account-json",
+ "/creds/service_accounts/service-account-goma-client.json"
+ ],
+ "infra_step": true,
+ "name": "ensure_goma.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-release---------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra_internal/goma/client/linux-amd64\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "ensure_qemu"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "--root",
+ "[START_DIR]/cipd/qemu",
+ "--list",
+ "fuchsia/tools/qemu/linux-amd64 latest",
+ "--json-output",
+ "/path/to/tmp/json",
+ "--service-account-json",
+ "/creds/service_accounts/service-account-goma-client.json"
+ ],
+ "infra_step": true,
+ "name": "ensure_qemu.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/tools/qemu/linux-amd64\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd/jiri/jiri",
+ "init",
+ "-cache",
+ "[CACHE]/git",
+ "-shared"
+ ],
+ "infra_step": true,
+ "name": "jiri init"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd/jiri/jiri",
+ "import",
+ "-overwrite=true",
+ "fuchsia",
+ "https://fuchsia.googlesource.com/manifest"
+ ],
+ "infra_step": true,
+ "name": "jiri import"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd/jiri/jiri",
+ "project",
+ "-clean-all"
+ ],
+ "infra_step": true,
+ "name": "jiri project clean"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd/jiri/jiri",
+ "update",
+ "-autoupdate=false",
+ "-gc=true"
+ ],
+ "infra_step": true,
+ "name": "jiri update"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd/jiri/jiri",
+ "snapshot",
+ "[TMP_BASE]/jiri.snapshot"
+ ],
+ "infra_step": true,
+ "name": "jiri snapshot"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/cipd/gsutil/gsutil",
+ "-o",
+ "GSUtil:software_update_check_period=0",
+ "cp",
+ "[TMP_BASE]/jiri.snapshot",
+ "gs://fuchsia/jiri/snapshots/8ac5404b688b34f2d34d1c8a648413aca30b7a97"
+ ],
+ "infra_step": true,
+ "name": "upload jiri.snapshot",
+ "~followup_annotations": [
+ "@@@STEP_LINK@jiri.snapshot@https://storage.googleapis.com/fuchsia/jiri/snapshots/8ac5404b688b34f2d34d1c8a648413aca30b7a97@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/scripts/build-magenta.sh",
+ "-c",
+ "-t",
+ "x86_64"
+ ],
+ "name": "build magenta"
+ },
+ {
+ "cmd": [],
+ "name": "build fuchsia"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/cipd/goma/goma_ctl.py",
+ "restart"
+ ],
+ "env": {
+ "GOMA_CACHE_DIR": "[CACHE]/goma",
+ "GOMA_DEPS_CACHE_FILE": "goma_deps_cache",
+ "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
+ },
+ "infra_step": true,
+ "name": "build fuchsia.start_goma",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/packages/gn/gen.py",
+ "--target_cpu=x86-64",
+ "--modules=default,boot_special",
+ "--with-dart-analysis",
+ "--goma=[START_DIR]/cipd/goma"
+ ],
+ "name": "build fuchsia.gen",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "\nimport multiprocessing\nimport sys\n\njob_limit = 200\nif sys.platform.startswith('linux'):\n # Use 80 for linux not to load goma backend.\n job_limit = 80\n\ntry:\n jobs = min(job_limit, multiprocessing.cpu_count() * 10)\nexcept NotImplementedError:\n jobs = 50\n\nprint jobs\n"
+ ],
+ "name": "build fuchsia.calculate the number of recommended jobs",
+ "stdout": "/path/to/tmp/",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@import multiprocessing@@@",
+ "@@@STEP_LOG_LINE@python.inline@import sys@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@job_limit = 200@@@",
+ "@@@STEP_LOG_LINE@python.inline@if sys.platform.startswith('linux'):@@@",
+ "@@@STEP_LOG_LINE@python.inline@ # Use 80 for linux not to load goma backend.@@@",
+ "@@@STEP_LOG_LINE@python.inline@ job_limit = 80@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@try:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ jobs = min(job_limit, multiprocessing.cpu_count() * 10)@@@",
+ "@@@STEP_LOG_LINE@python.inline@except NotImplementedError:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ jobs = 50@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@print jobs@@@",
+ "@@@STEP_LOG_END@python.inline@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/buildtools/ninja",
+ "-C",
+ "[START_DIR]/out/debug-x86-64",
+ "-j",
+ "50"
+ ],
+ "name": "build fuchsia.ninja",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/cipd/goma/goma_ctl.py",
+ "jsonstatus",
+ "[START_DIR]/cipd/goma/jsonstatus"
+ ],
+ "env": {
+ "GOMA_CACHE_DIR": "[CACHE]/goma",
+ "GOMA_DEPS_CACHE_FILE": "goma_deps_cache",
+ "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
+ },
+ "name": "build fuchsia.goma_jsonstatus",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/cipd/goma/goma_ctl.py",
+ "stat"
+ ],
+ "env": {
+ "GOMA_CACHE_DIR": "[CACHE]/goma",
+ "GOMA_DEPS_CACHE_FILE": "goma_deps_cache",
+ "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
+ },
+ "name": "build fuchsia.goma_stat",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/cipd/goma/goma_ctl.py",
+ "stop"
+ ],
+ "env": {
+ "GOMA_CACHE_DIR": "[CACHE]/goma",
+ "GOMA_DEPS_CACHE_FILE": "goma_deps_cache",
+ "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
+ },
+ "name": "build fuchsia.stop_goma",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "RECIPE_MODULE[infra::qemu]/resources/qemu.py",
+ "start",
+ "--executable",
+ "[START_DIR]/cipd/qemu/bin/qemu-system-x86_64",
+ "--memory",
+ "4096",
+ "--smp",
+ "4",
+ "--arch",
+ "x86_64",
+ "--initrd",
+ "[START_DIR]/out/debug-x86-64/user.bootfs",
+ "--netdev",
+ "user,id=net0,hostfwd=tcp::8342-:8342",
+ "--device",
+ "e1000,netdev=net0",
+ "[START_DIR]/out/build-magenta/build-magenta-pc-x86-64/magenta.bin"
+ ],
+ "name": "start qemu"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/apps/test_runner/src/run_test",
+ "--test_file",
+ "[START_DIR]/tests.json",
+ "--server",
+ "127.0.0.1",
+ "--port",
+ "8342",
+ "--no-loglistener"
+ ],
+ "env": {
+ "FUCHSIA_BUILD_DIR": "[START_DIR]/out/debug-x86-64",
+ "FUCHSIA_OUT_DIR": "[START_DIR]/out"
+ },
+ "name": "run tests"
+ },
+ {
+ "cmd": [
+ "sleep",
+ "3"
+ ],
+ "env": {
+ "FUCHSIA_BUILD_DIR": "[START_DIR]/out/debug-x86-64",
+ "FUCHSIA_OUT_DIR": "[START_DIR]/out"
+ },
+ "name": "sleep"
+ },
+ {
+ "cmd": [
+ "RECIPE_MODULE[infra::qemu]/resources/qemu.py",
+ "stop",
+ "--log"
+ ],
+ "name": "stop qemu and read log"
+ },
+ {
+ "name": "$result",
+ "recipe_result": null,
+ "status_code": 0
+ }
+]
\ No newline at end of file
diff --git a/recipes/fuchsia.py b/recipes/fuchsia.py
index 512f4ce..cc2710d 100644
--- a/recipes/fuchsia.py
+++ b/recipes/fuchsia.py
@@ -46,6 +46,9 @@
default='debug'),
'modules': Property(kind=List(basestring), help='Packages to build',
default=['default']),
+ 'boot_module': Property(kind=str,
+ help='Package to build that specifies boot behavior.',
+ default=None),
'tests': Property(kind=str, help='Path to config file listing tests to run',
default=None),
'use_goma': Property(kind=bool, help='Whether to use goma to compile',
@@ -93,9 +96,12 @@
yield
def BuildFuchsia(api, start_dir, release_build, target, gn_target,
- fuchsia_build_dir, modules, tests, use_goma):
- if tests:
- modules.append('boot_test_runner')
+ fuchsia_build_dir, modules, boot_module, tests, use_goma):
+ if tests and not boot_module:
+ boot_module = 'boot_test_runner'
+
+ if boot_module:
+ modules.append(boot_module)
with api.step.nest('build fuchsia'), GomaContext(api, use_goma):
gen_cmd = [
@@ -185,7 +191,7 @@
def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref,
patch_storage, patch_repository_url, manifest, remote, target,
- build_variant, build_type, modules, tests, use_goma):
+ build_variant, build_type, modules, boot_module, tests, use_goma):
# Tests are currently broken on arm64.
if target == 'arm64':
tests = None
@@ -211,7 +217,7 @@
remote)
BuildMagenta(api, start_dir, target)
BuildFuchsia(api, start_dir, release_build, target, gn_target,
- fuchsia_build_dir, modules, tests, use_goma)
+ fuchsia_build_dir, modules, boot_module, tests, use_goma)
if tests:
RunTests(api, start_dir, target, gn_target, fuchsia_out_dir,
@@ -229,6 +235,13 @@
target='x86-64',
tests='tests.json',
)
+ yield api.test('boot_module') + api.properties(
+ manifest='fuchsia',
+ remote='https://fuchsia.googlesource.com/manifest',
+ target='x86-64',
+ tests='tests.json',
+ boot_module='boot_special',
+ )
yield api.test('failed_tests') + api.properties(
manifest='fuchsia',
remote='https://fuchsia.googlesource.com/manifest',