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

Unified 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: Fix sudo issues again. 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 side-by-side diff with in-line comments
Download patch
Index: lib/cros_build_lib.py
diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py
index 22f7de946eeb922d166127eb45c87f9ba72184f0..11fa40cac9cf94813f27c70fda281940124f1f96 100644
--- a/lib/cros_build_lib.py
+++ b/lib/cros_build_lib.py
@@ -6,6 +6,7 @@
import inspect
import os
+import re
import subprocess
import sys
@@ -245,3 +246,21 @@ def ReinterpretPathForChroot(path):
new_path = os.path.join('/home', os.getenv('USER'), 'trunk', relative_path)
return new_path
+
+
+def GetIPAddress(device='eth0'):
+ """Returns the IP Address for a given device using ifconfig.
+
+ socket.gethostname() is insufficient for machines where the host files are
+ not set up "correctly." Since some of our builders may have this issue,
+ this method gives you a generic way to get the address so you are reachable
+ either via a VM or remote machine on the same network.
+ """
+ ifconfig_output = RunCommand(['ifconfig', device], redirect_stdout=True,
+ print_cmd=False)
+ match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output)
+ if match:
+ return match.group(1)
+ else:
+ Warning('Failed to find ip address in %s' % ifconfig_output)
+ return None
« 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