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

Side by Side Diff: lib/cros_build_lib.py

Issue 6277015: Passes cache location to tests and runs the tests in parallel. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Introduced a bug in refactoring Created 9 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Common python commands used by various build scripts.""" 5 """Common python commands used by various build scripts."""
6 6
7 import inspect 7 import inspect
8 import os 8 import os
9 import re
9 import subprocess 10 import subprocess
10 import sys 11 import sys
11 12
12 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() 13 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
13 14
14 # TODO(sosa): Move logging to logging module. 15 # TODO(sosa): Move logging to logging module.
15 16
16 class RunCommandException(Exception): 17 class RunCommandException(Exception):
17 """Raised when there is an error in RunCommand.""" 18 """Raised when there is an error in RunCommand."""
18 pass 19 pass
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 root_abs_path = os.path.abspath(root_path) 233 root_abs_path = os.path.abspath(root_path)
233 234
234 # Strip the repository root from the path and strip first /. 235 # Strip the repository root from the path and strip first /.
235 relative_path = path_abs_path.replace(root_abs_path, '')[1:] 236 relative_path = path_abs_path.replace(root_abs_path, '')[1:]
236 237
237 if relative_path == path_abs_path: 238 if relative_path == path_abs_path:
238 raise Exception('Error: path is outside your src tree, cannot reinterpret.') 239 raise Exception('Error: path is outside your src tree, cannot reinterpret.')
239 240
240 new_path = os.path.join('/home', os.getenv('USER'), 'trunk', relative_path) 241 new_path = os.path.join('/home', os.getenv('USER'), 'trunk', relative_path)
241 return new_path 242 return new_path
243
244
245 def GetIPAddress(device='eth0'):
246 """Returns the IP Address for a given device using ifconfig.
247
248 socket.gethostname() is insufficient for machines where the host files are
249 not set up "correctly." Since some of our builders may have this issue,
250 this method gives you a generic way to get the address so you are reachable
251 either via a VM or remote machine on the same network.
252 """
253 ifconfig_output = RunCommand(['ifconfig', device], redirect_stdout=True,
254 print_cmd=False)
255 match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output)
256 if match:
257 return match.group(1)
258 else:
259 Warning('Failed to find ip address in %s' % ifconfig_output)
260 return None
OLDNEW
« bin/cros_au_test_harness.py ('K') | « image_to_live.sh ('k') | lib/cros_vm_lib.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698