[infra] Use new GN template to assemble Fuchsia test image

Generate a manifest of just Dart's files, no longer rolling in the
main Fuchsia manifest.  Use Fuchsia's new bootdata() template to
generate a BOOTFS image of just the Dart test files.  A new Fuchsia
GN build argument will control rolling this into the final image.

IN-70

Change-Id: Idd2db5aab483f49d6f6f3e4065798ded130d606a
Reviewed-on: https://dart-review.googlesource.com/15987
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This commit is contained in:
Roland McGrath 2017-10-24 15:27:58 +00:00 committed by commit-bot@chromium.org
parent 6b64aa8943
commit 014a34e64f
2 changed files with 8 additions and 60 deletions

View file

@ -120,15 +120,15 @@ group("samples") {
}
# The rules below build a Fuchsia OS image that includes the Dart tree
# under /system/test/dart.
# under /system/test/dart. To get this into the `user.bootfs` generated
# by the Fuchsia build, add the GN build argument:
# extra_bootdata = [ "//third_party/dart:dart_test_bootfs" ]
if (is_fuchsia) {
import("//build/bootdata.gni")
action("generate_dart_test_manifest") {
testonly = true
deps = [
"//packages/gn:mkbootfs",
]
output_prefix = "$target_gen_dir/dart_test_tree"
outputs = [
"$output_prefix.manifest",
@ -139,21 +139,16 @@ if (is_fuchsia) {
mode = "debug"
}
mkbootfs_gen = get_label_info("//packages/gn:mkbootfs", "target_gen_dir")
system_manifest = "$mkbootfs_gen/system.bootfs.manifest"
script = "tools/gen_fuchsia_test_manifest.py"
args = [
"-m",
mode,
"-u",
rebase_path(system_manifest),
"-o",
rebase_path(output_prefix),
]
}
action("generate_dart_test_image") {
bootdata("dart_test_bootfs") {
testonly = true
deps = [
":generate_dart_test_manifest",
@ -161,46 +156,8 @@ if (is_fuchsia) {
"runtime/bin:process_test",
"runtime/bin:run_vm_tests",
]
mkbootfs_gen = get_label_info("//packages/gn:mkbootfs", "target_gen_dir")
boot_manifest = "$mkbootfs_gen/boot.bootfs.manifest"
# Compute path to zircon bootdata.bin
if (current_cpu == "arm64") {
zircon_bootdata =
"//out/build-zircon/build-zircon-qemu-arm64/bootdata.bin"
} else if (current_cpu == "x64") {
zircon_bootdata = "//out/build-zircon/build-zircon-pc-x86-64/bootdata.bin"
} else {
assert(false, "unable to determine path to zircon's bootdata.bin")
}
packages_file = "$mkbootfs_gen/packages"
input = "$target_gen_dir/dart_test_tree.manifest"
inputs = [
zircon_bootdata,
input,
"$target_gen_dir/dart_test_tree.manifest",
]
output = "$root_out_dir/dart_test_tree.bin"
outputs = [
output,
]
script = "//packages/gn/make_bootfs.py"
args = [
"--boot-manifest",
rebase_path(boot_manifest),
"--system-manifest",
rebase_path(input),
"--output-file",
rebase_path(output),
"--build-id-map",
rebase_path("$target_gen_dir/build_id_map"),
"--pre-binaries",
rebase_path(zircon_bootdata),
]
args += read_file(packages_file, "list lines")
}
}

View file

@ -40,9 +40,6 @@ def parse_args(args):
parser.add_argument('--output', '-o',
type=str,
help='Path to output file prefix.')
parser.add_argument('--user-manifest', '-u',
type=str,
help='Path to base userspace manifest.')
parser.add_argument("-v", "--verbose",
help='Verbose output.',
default=False,
@ -62,13 +59,7 @@ def main(argv):
manifest_output = args.output + '.manifest'
with open(manifest_output, 'w') as manifest:
# First copy the main user manifest.
with open(args.user_manifest, 'r') as user_manifest:
for line in user_manifest:
if '=' in line:
manifest.write(line)
# Now, write the Dart tree.
# Write the Dart tree.
for root, dirs, files in os.walk(DART_ROOT):
dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
for file in files: