def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--target-cpu', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm']) parser.add_argument('--origin', help='Origin for mojo: URLs.', default='localhost') parser.add_argument('--target-device', help='Device to run on.') launcher_args, args = parser.parse_known_args() config = Config(target_os=Config.OS_ANDROID, target_cpu=launcher_args.target_cpu, is_debug=launcher_args.debug, apk_name="MojoRunner.apk") paths = Paths(config) shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, paths.adb_path, launcher_args.target_device) extra_shell_args = shell.PrepareShellRun(launcher_args.origin) args.extend(extra_shell_args) shell.CleanLogs() p = shell.ShowLogs() shell.StartShell(args, sys.stdout, p.terminate) return 0
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--build-dir', help='Build directory') parser.add_argument('--target-cpu', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm'], default='arm') parser.add_argument('--device', help='Serial number of the target device.') runner_args, args = parser.parse_known_args() config = Config(build_dir=runner_args.build_dir, target_os=Config.OS_ANDROID, target_cpu=runner_args.target_cpu, is_debug=runner_args.debug, apk_name='Mandoline.apk') shell = AndroidShell(config) shell.InitShell(runner_args.device) return 0
def testConfigToGNToConfig(self): """Tests that config to gn to config is the identity""" configs_to_test = { "target_os": [None, "android", "linux", "ios"], "target_cpu": [None, "x86", "x64", "arm", "arm64"], "is_simulator": [False, True], "is_debug": [False, True], "is_official_build": [False, True], "is_clang": [False, True], "sanitizer": [None, Config.SANITIZER_ASAN], "use_goma": [False], "use_nacl": [False, True], "mojo_use_go": [False], "dcheck_always_on": [False, True], "boringssl_path": [""], } if sys.platform == "darwin": configs_to_test["target_os"].remove("linux") for args in _iterate_over_config(configs_to_test): if args.get("target_os") != "ios" and args["is_simulator"]: continue config = Config(**args) gn_args = gn.GNArgsForConfig(config) new_config = gn.ConfigForGNArgs(gn_args) self.assertDictEqual(config.values, new_config.values)
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') debug_group.add_argument('--target-arch', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm']) launcher_args, args = parser.parse_known_args() config = Config(target_os=Config.OS_ANDROID, target_arch=launcher_args.target_arch, is_debug=launcher_args.debug) context = android.PrepareShellRun(config) android.CleanLogs(context) p = android.ShowLogs() android.StartShell(context, args, sys.stdout, p.terminate) return 0
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--target-cpu', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm'], default='arm') parser.add_argument('--device', help='Serial number of the target device.') parser.add_argument('--gdb', help='Run gdb', default=False, action='store_true') runner_args, args = parser.parse_known_args() config = Config(target_os=Config.OS_ANDROID, target_cpu=runner_args.target_cpu, is_debug=runner_args.debug, apk_name="Mandoline.apk") shell = AndroidShell(config) shell.InitShell(None, runner_args.device) p = shell.ShowLogs() shell.StartActivity('MandolineActivity', args, sys.stdout, p.terminate, runner_args.gdb) return 0
def main(): parser = argparse.ArgumentParser( description="Upload binaries for apps and " "the Mojo shell to google storage (by default on Linux, but this can be " "changed via options).") parser.add_argument("-n", "--dry_run", help="Dry run, do not actually " + "upload", action="store_true") parser.add_argument("-v", "--verbose", help="Verbose mode", action="store_true") parser.add_argument("--android", action="store_true", help="Upload the shell and apps for Android") args = parser.parse_args() target_os = Config.OS_LINUX if args.android: target_os = Config.OS_ANDROID config = Config(target_os=target_os, is_debug=False) upload_shell(config, args.dry_run, args.verbose) update_version(config, "shell", args.dry_run) apps_to_upload = find_apps_to_upload( gn.BuildDirectoryForConfig(config, Paths(config).src_root)) for app in apps_to_upload: upload_app(app, config, args.dry_run) update_version(config, "services", args.dry_run) return 0
def args_to_config(args): # Default to host OS. target_os = None if args.android: target_os = Config.OS_ANDROID elif args.chromeos: target_os = Config.OS_CHROMEOS return Config(target_os=target_os, is_debug=args.debug)
def main(): parser = argparse.ArgumentParser(description='Helper to launch mojo demos') parser.add_argument('-d', dest='build_dir', type=str) parser.add_argument('--browser', action='store_const', const='browser', dest='demo', help='Use the browser demo') parser.add_argument('--wm_flow', action='store_const', const='wm_flow', dest='demo', help='Use the wm_flow demo') args = parser.parse_args() config = Config(target_os=Config.OS_LINUX, is_debug=True) paths = mopy.paths.Paths(config, build_dir=args.build_dir) mojo_shell = paths.mojo_shell_path cmd = [mojo_shell] cmd.append('--v=1') HTTP_PORT = 9999 sky_paths = skypy.paths.Paths(paths.build_dir) configuration = 'Debug' if config.is_debug else 'Release' server = SkyServer(sky_paths, HTTP_PORT, configuration, paths.src_root) if args.demo == 'browser': base_url = server.path_as_url(paths.build_dir) wm_url = os.path.join(base_url, 'example_window_manager.mojo') browser_url = os.path.join(base_url, 'browser.mojo') cmd.append( '--url-mappings=mojo:window_manager=mojo:example_window_manager') cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) cmd.append('--args-for=mojo:browser %s' % (browser_url)) cmd.append('mojo:window_manager') elif args.demo == 'wm_flow': base_url = server.path_as_url(paths.build_dir) wm_url = os.path.join(base_url, 'wm_flow_wm.mojo') app_url = os.path.join(base_url, 'wm_flow_app.mojo') cmd.append('--url-mappings=mojo:window_manager=' + wm_url) # Mojo apps don't know their own URL yet: # https://docs.google.com/a/chromium.org/document/d/1AQ2y6ekzvbdaMF5WrUQmneyXJnke-MnYYL4Gz1AKDos cmd.append('--args-for=%s %s' % (app_url, app_url)) cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) cmd.append(app_url) else: parser.print_usage() print "--browser or --wm_flow is required" return 1 # http://stackoverflow.com/questions/4748344/whats-the-reverse-of-shlex-split # shlex.quote doesn't exist until 3.3 # This doesn't print exactly what we want, but it's better than nothing: print " ".join(map(pipes.quote, cmd)) with server: return subprocess.call(cmd)
def main(): parser = argparse.ArgumentParser(description="Upload binaries for apps and " "the Mojo shell to google storage (by default on Linux, but this can be " "changed via options).") parser.add_argument("-n", "--dry_run", help="Dry run, do not actually "+ "upload", action="store_true") parser.add_argument("-v", "--verbose", help="Verbose mode", action="store_true") parser.add_argument("--android", action="store_true", help="Upload the shell and apps for Android") parser.add_argument("--official", action="store_true", help="Upload the official build of the Android shell") parser.add_argument("-p", "--use-default-path-for-gsutil", action="store_true", help=("Use default $PATH location for finding gsutil." " Helpful when gcloud sdk has been installed and $PATH has been set.")) parser.add_argument("--symbols-upload-url", action="append", default=[], help="URL of the server to upload breakpad symbols to") parser.add_argument("-u", "--upload-location", default="gs://mojo/", help="root URL of the server to upload binaries to") args = parser.parse_args() is_official_build = args.official target_os = Config.OS_LINUX if args.android: target_os = Config.OS_ANDROID elif is_official_build: print "Uploading official builds is only supported for android." return 1 config = Config(target_os=target_os, is_debug=False, is_official_build=is_official_build, upload_location=args.upload_location, use_default_path_for_gsutil=args.use_default_path_for_gsutil, verbose=args.verbose) upload_shell(config, args.dry_run, args.verbose) if is_official_build: print "Skipping uploading apps (official apk build)." return 0 build_directory = gn.BuildDirectoryForConfig(config, Paths(config).src_root) apps_to_upload = find_apps_to_upload(build_directory) for app in apps_to_upload: upload_app(app, config, args.dry_run) upload_symbols(config, build_directory, args.symbols_upload_url, args.dry_run) upload_dart_snapshotter(config, args.dry_run, args.verbose) upload_system_thunks_lib(config, args.dry_run) return 0
def main(): parser = argparse.ArgumentParser( description="Upload binaries for apps and " "the Mojo shell to google storage (by default on Linux, but this can be " "changed via options).") parser.add_argument("-n", "--dry_run", help="Dry run, do not actually " + "upload", action="store_true") parser.add_argument("-v", "--verbose", help="Verbose mode", action="store_true") parser.add_argument("--android", action="store_true", help="Upload the shell and apps for Android") parser.add_argument("--official", action="store_true", help="Upload the official build of the Android shell") parser.add_argument("--symbols-upload-url", action="append", default=[], help="URL of the server to upload breakpad symbols to") args = parser.parse_args() is_official_build = args.official target_os = Config.OS_LINUX if args.android: target_os = Config.OS_ANDROID elif is_official_build: print "Uploading official builds is only supported for android." return 1 config = Config(target_os=target_os, is_debug=False, is_official_build=is_official_build) upload_shell(config, args.dry_run, args.verbose) if is_official_build: print "Skipping uploading apps (official apk build)." return 0 build_directory = gn.BuildDirectoryForConfig(config, Paths(config).src_root) apps_to_upload = find_apps_to_upload(build_directory) for app in apps_to_upload: upload_app(app, config, args.dry_run) files_to_upload = find_architecture_independent_files(build_directory) for file_to_upload in files_to_upload: upload_file(file_to_upload, config, args.dry_run) upload_symbols(config, build_directory, args.symbols_upload_url, args.dry_run) return 0
def _get_gsutil_exe(): """Get the path to gsutil executable.""" config = Config(target_os=Config.OS_ANDROID, is_debug=False, is_official_build=True) paths = Paths(config) sys.path.insert(0, os.path.join(paths.src_root, "tools")) # pylint: disable=F0401 import find_depot_tools depot_tools_path = find_depot_tools.add_depot_tools_to_path() gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil") return gsutil_exe
def _args_to_config(args): # Default to host OS. target_os = None if args.android: target_os = Config.OS_ANDROID elif args.chromeos: target_os = Config.OS_CHROMEOS target_arch = args.target_arch additional_args = {} if 'clang' in args: additional_args['is_clang'] = args.clang if 'asan' in args and args.asan: additional_args['sanitizer'] = Config.SANITIZER_ASAN # Additional non-standard config entries: if 'goma' in args: goma_dir = os.environ.get('GOMA_DIR') goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') if args.goma and goma_dir: additional_args['use_goma'] = True additional_args['goma_dir'] = goma_dir elif args.goma and os.path.exists(goma_home_dir): additional_args['use_goma'] = True additional_args['goma_dir'] = goma_home_dir else: additional_args['use_goma'] = False additional_args['goma_dir'] = None additional_args['use_nacl'] = args.nacl if 'dry_run' in args: additional_args['dry_run'] = args.dry_run if 'builder_name' in args: additional_args['builder_name'] = args.builder_name if 'build_number' in args: additional_args['build_number'] = args.build_number if 'master_name' in args: additional_args['master_name'] = args.master_name if 'test_results_server' in args: additional_args['test_results_server'] = args.test_results_server return Config(target_os=target_os, target_arch=target_arch, is_debug=args.debug, dcheck_always_on=args.dcheck_always_on, **additional_args)
def main(): parser = argparse.ArgumentParser(description="Gets tests to execute.") parser.add_argument("config_file", metavar="config.json", type=argparse.FileType("rb"), help="Input JSON file with test configuration.") parser.add_argument("test_list_file", metavar="test_list.json", nargs="?", type=argparse.FileType("wb"), default=sys.stdout, help="Output JSON file with test list.") args = parser.parse_args() config = Config(**json.load(args.config_file)) test_list = GetTestList(config) json.dump(test_list, args.test_list_file, indent=2) args.test_list_file.write("\n") return 0
def testConfigToGNToConfig(self): """Tests that config to gn to config is the identity""" configs_to_test = { "target_os": [None, "android", "chromeos", "linux"], "target_arch": [None, "x86", "x64", "arm"], "is_debug": [False, True], "is_clang": [False, True], "sanitizer": [None, Config.SANITIZER_ASAN], "use_goma": [False], "use_nacl": [False, True], } for args in _iterate_over_config(configs_to_test): config = Config(**args) gn_args = gn.GNArgsForConfig(config) new_config = gn.ConfigForGNArgs(gn_args) self.assertDictEqual(config.values, new_config.values)
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--build-dir', help='Build directory') parser.add_argument('--target-cpu', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm'], default='arm') parser.add_argument('--device', help='Serial number of the target device.') parser.add_argument('--gdb', help='Run gdb', default=False, action='store_true') runner_args, args = parser.parse_known_args() config = Config(build_dir=runner_args.build_dir, target_os=Config.OS_ANDROID, target_cpu=runner_args.target_cpu, is_debug=runner_args.debug, apk_name='Mandoline.apk') shell = AndroidShell(config) shell.InitShell(runner_args.device) p = shell.ShowLogs() temp_gdb_dir = None if runner_args.gdb: temp_gdb_dir = tempfile.mkdtemp() atexit.register(shutil.rmtree, temp_gdb_dir, True) _CreateSOLinks(temp_gdb_dir) shell.StartActivity('MandolineActivity', args, sys.stdout, p.terminate, temp_gdb_dir) return 0
def main(): parser = argparse.ArgumentParser( description="Change the version of the mojo " "services on the cdn.") parser.add_argument("-v", "--verbose", help="Verbose mode", action="store_true") parser.add_argument("version", help="New version of the mojo services.") args = parser.parse_args() gsutil_exe = get_gsutil() for target_os in [Config.OS_LINUX, Config.OS_ANDROID]: config = Config(target_os=target_os) roll_version(gsutil_exe, config, args.version) return 0
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--target-cpu', help='CPU architecture to run for.', choices=['x64', 'x86', 'arm'], default='arm') parser.add_argument('--device', help='Serial number of the target device.') parser.add_argument('--verbose', default=False, action='store_true') parser.add_argument('--apk', help='Name of the APK to run.', default='MojoRunner.apk') runner_args, args = parser.parse_known_args() logger = logging.getLogger() logging.basicConfig(stream=sys.stdout, format='%(levelname)s:%(message)s') logger.setLevel(logging.DEBUG if runner_args.verbose else logging.WARNING) logger.debug('Initialized logging: level=%s' % logger.level) config = Config(target_os=Config.OS_ANDROID, target_cpu=runner_args.target_cpu, is_debug=runner_args.debug, is_verbose=runner_args.verbose, apk_name=runner_args.apk) shell = AndroidShell(config) shell.InitShell(runner_args.device) p = shell.ShowLogs() shell.StartActivity('MojoShellActivity', args, sys.stdout, p.terminate) return 0
def main(): parser = argparse.ArgumentParser(description="An application test runner.") parser.add_argument("build_dir", type=str, help="The build output directory.") parser.add_argument("--verbose", default=False, action='store_true', help="Print additional logging information.") parser.add_argument('--repeat-count', default=1, metavar='INT', action='store', type=int, help="The number of times to repeat the set of tests.") parser.add_argument( '--write-full-results-to', metavar='FILENAME', help='The path to write the JSON list of full results.') parser.add_argument("--test-list-file", metavar='FILENAME', type=file, default=os.path.abspath( os.path.join(__file__, os.pardir, "data", "apptests")), help="The file listing apptests to run.") args = parser.parse_args() gtest.set_color() logger = logging.getLogger() logging.basicConfig(stream=sys.stdout, format="%(levelname)s:%(message)s") logger.setLevel(logging.DEBUG if args.verbose else logging.WARNING) logger.debug("Initialized logging: level=%s" % logger.level) logger.debug("Test list file: %s", args.test_list_file) config = Config(args.build_dir) execution_globals = {"config": config} exec args.test_list_file in execution_globals test_list = execution_globals["tests"] logger.debug("Test list: %s" % test_list) shell = None if config.target_os == Config.OS_ANDROID: from mopy.android import AndroidShell shell = AndroidShell(config) result = shell.InitShell() if result != 0: return result tests = [] failed = [] failed_suites = 0 for _ in range(args.repeat_count): for test_dict in test_list: test = test_dict["test"] test_name = test_dict.get("name", test) test_type = test_dict.get("type", "gtest") test_args = test_dict.get("args", []) print "Running %s...%s" % (test_name, ("\n" if args.verbose else "")), sys.stdout.flush() assert test_type in ("gtest", "gtest_isolated") isolate = test_type == "gtest_isolated" (test, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) tests.extend(test) failed.extend(fail) result = test and not fail print "[ PASSED ]" if result else "[ FAILED ]", print test_name if args.verbose or not result else "" # Abort when 3 apptest suites, or a tenth of all, have failed. # base::TestLauncher does this for timeouts and unknown results. failed_suites += 0 if result else 1 if failed_suites >= max(3, len(test_list) / 10): print "Too many failing suites (%d), exiting now." % failed_suites failed.append("Test runner aborted for excessive failures.") break if failed: break print "[==========] %d tests ran." % len(tests) print "[ PASSED ] %d tests." % (len(tests) - len(failed)) if failed: print "[ FAILED ] %d tests, listed below:" % len(failed) for failure in failed: print "[ FAILED ] %s" % failure if args.write_full_results_to: _WriteJSONResults(tests, failed, args.write_full_results_to) return 1 if failed else 0
def main(): logging.basicConfig() parser = argparse.ArgumentParser(usage=USAGE) debug_group = parser.add_mutually_exclusive_group() debug_group.add_argument('--debug', help='Debug build (default)', default=True, action='store_true') debug_group.add_argument('--release', help='Release build', default=False, dest='debug', action='store_false') parser.add_argument('--no-url', help='Allows not to provide a application URL', action='store_true') launcher_args, args = parser.parse_known_args() paths = Paths( Config(target_os=Config.OS_ANDROID, is_debug=launcher_args.debug)) constants.SetOutputDirectort(paths.build_dir) httpd = SocketServer.TCPServer(('127.0.0.1', 0), GetHandlerForPath(paths.build_dir)) atexit.register(httpd.shutdown) port = httpd.server_address[1] http_thread = threading.Thread(target=httpd.serve_forever) http_thread.daemon = True http_thread.start() device = android_commands.AndroidCommands( android_commands.GetAttachedDevices()[0]) device.EnableAdbRoot() atexit.register(forwarder.Forwarder.UnmapAllDevicePorts, device) forwarder.Forwarder.Map([(0, port)], device) device_port = forwarder.Forwarder.DevicePortForHostPort(port) cmd = ('am start' ' -W' ' -S' ' -a android.intent.action.VIEW' ' -n org.chromium.mojo_shell_apk/.MojoShellActivity') parameters = ['--origin=http://127.0.0.1:%d/' % device_port] url = None if launcher_args.no_url: parameters += args else: url = args[-1] parameters += args[:-1] cmd += ' --esa parameters \"%s\"' % ','.join(parameters) if url: cmd += ' -d %s' % url device.RunShellCommand('logcat -c') device.RunShellCommand(cmd) os.system("%s logcat -s %s" % (constants.GetAdbPath(), ' '.join(TAGS))) device.RunShellCommand("am force-stop org.chromium.mojo_shell_apk") return 0
def main(): parser = argparse.ArgumentParser(description='An application test runner.') parser.add_argument('build_dir', type=str, help='The build output directory.') parser.add_argument('--verbose', default=False, action='store_true', help='Print additional logging information.') parser.add_argument('--repeat-count', default=1, metavar='INT', action='store', type=int, help='The number of times to repeat the set of tests.') parser.add_argument( '--write-full-results-to', metavar='FILENAME', help='The path to write the JSON list of full results.') parser.add_argument('--test-list-file', metavar='FILENAME', type=file, default=APPTESTS, help='The file listing tests to run.') parser.add_argument('--apptest-filter', default='', help='A comma-separated list of mojo:apptests to run.') args, commandline_args = parser.parse_known_args() logger = logging.getLogger() logging.basicConfig(stream=sys.stdout, format='%(levelname)s:%(message)s') logger.setLevel(logging.DEBUG if args.verbose else logging.WARNING) logger.debug('Initialized logging: level=%s' % logger.level) logger.debug('Test list file: %s', args.test_list_file) config = Config(args.build_dir, is_verbose=args.verbose, apk_name='MojoRunnerApptests.apk') execution_globals = {'config': config} exec args.test_list_file in execution_globals test_list = execution_globals['tests'] logger.debug('Test list: %s' % test_list) shell = None if config.target_os == Config.OS_ANDROID: from mopy.android import AndroidShell shell = AndroidShell(config) result = shell.InitShell() if result != 0: return result tests = [] failed = [] failed_suites = 0 apptest_filter = [a for a in string.split(args.apptest_filter, ',') if a] gtest_filter = [ a for a in commandline_args if a.startswith('--gtest_filter') ] for _ in range(args.repeat_count): for test_dict in test_list: test = test_dict['test'] test_name = test_dict.get('name', test) test_type = test_dict.get('type', 'gtest') test_args = test_dict.get('args', []) + commandline_args if apptest_filter and not set(apptest_filter) & set( [test, test_name]): continue print 'Running %s...%s' % (test_name, ('\n' if args.verbose else '')), sys.stdout.flush() assert test_type in ('gtest', 'gtest_isolated') if test_type == 'gtest': print( 'WARNING: tests are forced to gtest_isolated until ' 'http://crbug.com/529487 is fixed') test_type = 'gtest_isolated' isolate = test_type == 'gtest_isolated' (ran, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) # Ignore empty fixture lists when the commandline has a gtest filter flag. if gtest_filter and not ran and not fail: print '[ NO TESTS ] ' + (test_name if args.verbose else '') continue result = (not ran) or (ran and not fail) # Use the apptest name if the whole suite failed. fail = [test_name] if (not result and fail == [test]) else fail tests.extend(ran) failed.extend(fail) print '[ PASSED ]' if result else '[ FAILED ]', print test_name if args.verbose or not result else '' # Abort when 3 apptest suites, or a tenth of all, have failed. # base::TestLauncher does this for timeouts and unknown results. failed_suites += 0 if result else 1 if failed_suites >= max(3, len(test_list) / 10): print 'Too many failing suites (%d), exiting now.' % failed_suites failed.append('Test runner aborted for excessive failures.') break if failed: break print '[==========] %d tests ran.' % len(tests) print '[ PASSED ] %d tests.' % (len(tests) - len(failed)) if failed: print '[ FAILED ] %d tests, listed below:' % len(failed) for failure in failed: print '[ FAILED ] %s' % failure if args.write_full_results_to: _WriteJSONResults(tests, failed, args.write_full_results_to) return 1 if failed else 0
def _args_to_config(args): # Default to host OS. target_os = None if args.android: target_os = Config.OS_ANDROID elif args.ios: target_os = Config.OS_IOS elif args.fnl: target_os = Config.OS_FNL target_cpu = args.target_cpu additional_args = {} if 'clang' in args: additional_args['is_clang'] = args.clang if 'asan' in args and args.asan: additional_args['sanitizer'] = Config.SANITIZER_ASAN # Additional non-standard config entries: if 'goma' in args: goma_dir = os.environ.get('GOMA_DIR') goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') if args.goma and goma_dir: additional_args['use_goma'] = True additional_args['goma_dir'] = goma_dir elif args.goma and os.path.exists(goma_home_dir): additional_args['use_goma'] = True additional_args['goma_dir'] = goma_home_dir else: additional_args['use_goma'] = False additional_args['goma_dir'] = None if 'nacl' in args: additional_args['use_nacl'] = args.nacl if not ('asan' in args and args.asan): go_dir = os.path.join(Paths().src_root, 'third_party', 'go', 'tool') if args.android: additional_args['mojo_use_go'] = True additional_args['go_build_tool'] = os.path.join( go_dir, 'android_arm', 'bin', 'go') elif target_os is None and Config.GetHostOS() == Config.OS_LINUX: additional_args['mojo_use_go'] = True additional_args['go_build_tool'] = os.path.join( go_dir, 'linux_amd64', 'bin', 'go') if 'dry_run' in args: additional_args['dry_run'] = args.dry_run if 'builder_name' in args: additional_args['builder_name'] = args.builder_name if 'build_number' in args: additional_args['build_number'] = args.build_number if 'master_name' in args: additional_args['master_name'] = args.master_name if 'test_results_server' in args: additional_args['test_results_server'] = args.test_results_server if 'gn_args' in args: additional_args['gn_args'] = args.gn_args is_debug = args.debug and not args.official if 'target_sysroot' in args and args.target_sysroot: additional_args['target_sysroot'] = os.path.abspath( args.target_sysroot) if 'toolchain_prefix' in args and args.toolchain_prefix: additional_args['toolchain_prefix'] = args.toolchain_prefix if 'package_name' in args: additional_args['package_name'] = args.package_name return Config(target_os=target_os, target_cpu=target_cpu, is_debug=is_debug, is_official_build=args.official, dcheck_always_on=args.dcheck_always_on, is_simulator=args.simulator, **additional_args)
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import os import subprocess import sys import tempfile import time import zipfile from mopy.config import Config from mopy.paths import Paths from mopy.version import Version paths = Paths(Config(target_os=Config.OS_LINUX, is_debug=False)) sys.path.insert(0, os.path.join(paths.src_root, "tools")) # pylint: disable=F0401 import find_depot_tools depot_tools_path = find_depot_tools.add_depot_tools_to_path() gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil") def upload(dry_run, verbose): dest = "gs://mojo/shell/" + Version().version + "/linux-x64.zip" with tempfile.NamedTemporaryFile() as zip_file: with zipfile.ZipFile(zip_file, 'w') as z: with open(paths.mojo_shell_path) as shell_binary: