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

Side by Side Diff: build/config/ios/ios_sim.py

Issue 1250913002: patch from chinmaygarde@ to make progress on mac, ios. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks needed to get base_unittests to compile Created 5 years, 5 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
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2015 The Chromium 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 import argparse
7 import os
sdefresne 2015/07/25 19:15:30 nit: sort
Dirk Pranke 2015/07/31 21:27:40 Done.
8 import errno
9 import subprocess
10 import sys
11 import re
12
13 SIMCTL_PATH = [
14 '/usr/bin/env',
15 'xcrun',
16 'simctl',
17 ]
18
19 PLIST_BUDDY_PATH = [
20 '/usr/bin/env',
21 'xcrun',
22 'PlistBuddy',
23 ]
24
25
26 def ApplicationIdentifier(path):
27 identifier = subprocess.check_output( PLIST_BUDDY_PATH + [
sdefresne 2015/07/25 19:15:30 nit: no space after "(" nor before ")"
Dirk Pranke 2015/07/31 21:27:40 Done.
28 '-c',
29 'Print CFBundleIdentifier',
30 '%s/Info.plist' % path,
31 ])
32
33 return identifier.strip()
34
35
36 def Install(args):
37 return subprocess.check_call( SIMCTL_PATH + [
38 'install',
39 'booted',
40 args.path,
41 ])
42
43
44 def InstallLaunchAndWait(args, wait):
45 res = Install(args)
46
47 if res != 0:
48 return res
49
50 identifier = ApplicationIdentifier(args.path)
51
52 launch_args = [ 'launch' ]
53
54 if wait:
55 launch_args += [ '-w' ]
56
57 launch_args += [
58 'booted',
59 identifier,
60 ]
61
62 return subprocess.check_output( SIMCTL_PATH + launch_args ).strip()
63
64
65 def Launch(args):
66 InstallLaunchAndWait(args, False)
67
68
69 def Debug(args):
70 launch_res = InstallLaunchAndWait(args, True)
71 launch_pid = re.search('.*: (\d+)', launch_res).group(1)
72 return os.system(' '.join([
73 '/usr/bin/env',
74 'xcrun',
75 'lldb',
76 '-s',
77 os.path.join(os.path.dirname(__file__), 'lldb_start_commands.txt'),
78 '-p',
79 launch_pid,
80 ]))
81
82
83 def Main():
84 parser = argparse.ArgumentParser(description='A script that launches an'
85 ' application in the simulator and attaches'
86 ' the debugger to the same')
87
88 parser.add_argument('-p', dest='path', required=True,
89 help='Path the the simulator application')
90
91 subparsers = parser.add_subparsers()
92
93 launch_parser = subparsers.add_parser('launch', help='Launch')
94 launch_parser.set_defaults(func=Launch)
95
96 install_parser = subparsers.add_parser('install', help='Install')
97 install_parser.set_defaults(func=Install)
98
99 debug_parser = subparsers.add_parser('debug', help='Debug')
100 debug_parser.set_defaults(func=Debug)
101
102 args = parser.parse_args()
103
104 return args.func(args)
105
106
107 if __name__ == '__main__':
108 sys.exit(Main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698