Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Side by Side Diff: tools/gen_fuchsia_test_manifest.py

Issue 2547013003: Fuchsia: Build an OS image that includes Dart's test suite. (Closed)
Patch Set: Fix copyright year. Fix comment. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/directory_fuchsia.cc ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2017 The Dart project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # This script creates a qemu image manifest for Fuchsia that contains the
7 # Dart tree. In particular in contains Dart's test suite, and test harness.
8
9 import argparse
10 import json
11 import os
12 import sys
13 import utils
14
15 SCRIPT_DIR = os.path.dirname(sys.argv[0])
16 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
17 FUCHSIA_ROOT= os.path.realpath(os.path.join(DART_ROOT, '..'))
18
19 FUCHSIA_TEST_MANIFEST_PREFIX = os.path.join('test', 'dart')
20
21 EXCLUDE_DIRS = [ '.git', 'out', '.jiri' ]
22
23 BINARY_FILES = [ 'dart', 'run_vm_tests', 'process_test' ]
24
25 def parse_args(args):
26 args = args[1:]
27 parser = argparse.ArgumentParser(
28 description='A script that generates Dart/Fuchsia test commands.')
29
30 parser.add_argument('--arch', '-a',
31 type=str,
32 help='Target architectures (comma-separated).',
33 metavar='[x64]',
34 default='x64')
35 parser.add_argument('--mode', '-m',
36 type=str,
37 help='Build variant',
38 metavar='[debug,release]',
39 default='debug')
40 parser.add_argument('--output', '-o',
41 type=str,
42 help='Path to output file prefix.')
43 parser.add_argument('--user-manifest', '-u',
44 type=str,
45 help='Path to base userspace manifest.')
46 parser.add_argument("-v", "--verbose",
47 help='Verbose output.',
48 default=False,
49 action="store_true")
50
51 return parser.parse_args(args)
52
53
54 def fuchsia_arch(arch):
55 if arch is 'x64':
56 return 'x86-64'
57 return None
58
59
60 def main(argv):
61 args = parse_args(argv)
62
63 manifest_output = args.output + '.manifest'
64 with open(manifest_output, 'w') as manifest:
65 # First copy the main user manifest.
66 with open(args.user_manifest, 'r') as user_manifest:
67 for line in user_manifest:
68 if '=' in line:
69 manifest.write(line)
70
71 # Now, write the Dart tree.
72 for root, dirs, files in os.walk(DART_ROOT):
73 dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
74 for file in files:
75 filepath = os.path.join(root, file)
76 relpath = filepath[len(DART_ROOT) + 1:]
77 fuchsiapath = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, relpath)
78 manifest.write('%s=%s\n' % (fuchsiapath, os.path.join(root, file)))
79
80 dart_conf = utils.GetBuildConf(args.mode, args.arch)
81 dart_out = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, 'out', dart_conf)
82 fuchsia_conf = '%s-%s' % (args.mode, fuchsia_arch(args.arch))
83 fuchsia_out = os.path.join(FUCHSIA_ROOT, 'out', fuchsia_conf)
84 for file in BINARY_FILES:
85 manifest.write('%s=%s\n' % (os.path.join(dart_out, file),
86 os.path.join(fuchsia_out, file)))
87
88 return 0
89
90
91 if __name__ == '__main__':
92 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « runtime/bin/directory_fuchsia.cc ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698