| Index: mojo/tools/mojob.py
|
| diff --git a/mojo/tools/mojob.py b/mojo/tools/mojob.py
|
| index 5170b853882086ed57e6010c64bf5ad66bdfd2b0..b7a282b92f69869d1b7b4975451b78c8ffae7012 100755
|
| --- a/mojo/tools/mojob.py
|
| +++ b/mojo/tools/mojob.py
|
| @@ -15,6 +15,15 @@ import sys
|
| import mopy.paths
|
|
|
|
|
| +def call(args, command, shell=False):
|
| + if args.dry_run:
|
| + if isinstance(command, list):
|
| + command = ' '.join(command)
|
| + print command
|
| + else:
|
| + return subprocess.call(command, shell=shell)
|
| +
|
| +
|
| def get_out_dir(args):
|
| out_dir = "out"
|
| prefix = ''
|
| @@ -28,7 +37,7 @@ def get_out_dir(args):
|
|
|
| def sync(args):
|
| # pylint: disable=W0613
|
| - return subprocess.call(['gclient', 'sync'])
|
| + return call(args, ['gclient', 'sync'])
|
|
|
|
|
| def gn(args):
|
| @@ -68,7 +77,7 @@ def gn(args):
|
| command.append('--args="%s"' % ' '.join(gn_args))
|
|
|
| print 'Running %s ...' % ' '.join(command)
|
| - return subprocess.call(' '.join(command), shell=True)
|
| + return call(args, ' '.join(command), shell=True)
|
|
|
|
|
| def get_gn_arg_value(out_dir, arg):
|
| @@ -93,34 +102,38 @@ def build(args):
|
| command = ['python',
|
| os.path.join(local_goma_dir, 'goma_ctl.py'),
|
| 'ensure_start']
|
| - exit_code = subprocess.call(command)
|
| + exit_code = call(args, command)
|
| if exit_code:
|
| return exit_code
|
|
|
| - return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir,
|
| + return call(args, ['ninja', '-j', '1000', '-l', '100', '-C', out_dir,
|
| 'root'])
|
| else:
|
| - return subprocess.call(['ninja', '-C', out_dir, 'root'])
|
| + return call(args, ['ninja', '-C', out_dir, 'root'])
|
|
|
|
|
| def run_unittests(args):
|
| out_dir = get_out_dir(args)
|
| print 'Running unit tests in %s ...' % out_dir
|
| command = ['python']
|
| - if platform.system() == 'Linux':
|
| + if platform.system() == 'Linux' and not args.android:
|
| command.append('./testing/xvfb.py')
|
| command.append(out_dir)
|
|
|
| command.append(os.path.join('mojo', 'tools', 'test_runner.py'))
|
| - command.append(os.path.join('mojo', 'tools', 'data', 'unittests'))
|
| + if args.android:
|
| + command.append('--android')
|
| + command.append(os.path.join('mojo', 'tools', 'data', 'android_unittests'))
|
| + else:
|
| + command.append(os.path.join('mojo', 'tools', 'data', 'unittests'))
|
| command.append(out_dir)
|
| command.append('mojob_test_successes')
|
| - return subprocess.call(command)
|
| + return call(args, command)
|
|
|
|
|
| def run_skytests(args):
|
| out_dir = get_out_dir(args)
|
| - if platform.system() != 'Linux':
|
| + if platform.system() != 'Linux' or args.android:
|
| return 0
|
|
|
| command = []
|
| @@ -132,7 +145,7 @@ def run_skytests(args):
|
| command.append('--no-new-test-results')
|
| command.append('--no-show-results')
|
| command.append('--verbose')
|
| - return subprocess.call(command)
|
| + return call(args, command)
|
|
|
|
|
| def run_pytests(args):
|
| @@ -140,11 +153,11 @@ def run_pytests(args):
|
| print 'Running python tests in %s ...' % out_dir
|
| command = ['python']
|
| command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py'))
|
| - exit_code = subprocess.call(command)
|
| + exit_code = call(args, command)
|
| if exit_code:
|
| return exit_code
|
|
|
| - if platform.system() != 'Linux':
|
| + if platform.system() != 'Linux' or args.android:
|
| print ('Python bindings tests are only supported on Linux.')
|
| return
|
|
|
| @@ -152,7 +165,7 @@ def run_pytests(args):
|
| command.append(os.path.join('mojo', 'tools',
|
| 'run_mojo_python_bindings_tests.py'))
|
| command.append('--build-dir=' + out_dir)
|
| - return subprocess.call(command)
|
| + return call(args, command)
|
|
|
|
|
| def test(args):
|
| @@ -170,7 +183,7 @@ def perftest(args):
|
| print 'Running perf tests in %s ...' % out_dir
|
| command = []
|
| command.append(os.path.join(out_dir, 'mojo_public_system_perftests'))
|
| - return subprocess.call(command)
|
| + return call(args, command)
|
|
|
|
|
| def pytest(args):
|
| @@ -184,7 +197,7 @@ def darttest(args):
|
| command.append('dart')
|
| command.append(os.path.join('mojo', 'tools', 'dart_test_runner.dart'))
|
| command.append(os.path.join(out_dir, 'gen'))
|
| - return subprocess.call(command)
|
| + return call(args, command)
|
|
|
|
|
| def main():
|
| @@ -206,6 +219,9 @@ def main():
|
| os_group.add_argument('--chromeos', help='Build for ChromeOS',
|
| action='store_true')
|
|
|
| + parent_parser.add_argument('--dry-run', help='Print commands',
|
| + action='store_true')
|
| +
|
| subparsers = parser.add_subparsers()
|
|
|
| sync_parser = subparsers.add_parser('sync', parents=[parent_parser],
|
|
|