summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorMihai Lindner <mihaix.lindner@linux.intel.com>2013-08-19 13:46:16 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:42:14 +0100
commit1fcf10db10fa36430e37c95c9fee27197e73f7a5 (patch)
tree087dcebd13ba359ff607d26ab18697eff1c8a30f /meta/lib
parente38e18d6923cc3db50b56fa3fc64081fe4aa8669 (diff)
downloadopenembedded-core-1fcf10db10fa36430e37c95c9fee27197e73f7a5.tar.gz
openembedded-core-1fcf10db10fa36430e37c95c9fee27197e73f7a5.tar.bz2
openembedded-core-1fcf10db10fa36430e37c95c9fee27197e73f7a5.zip
lib/oeqa/utils: qemurunner: save host IP address
Save host IP address to host_ip. Read /proc/PID/cmdline on host to look for IPs of target and host; instead of running 'ps'. Also removed some extra empty lines from file. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 20bb1e5e8d..9ae618f4c9 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -54,7 +54,6 @@ class QemuRunner:
def launch(self, qemuparams = None):
-
if self.display:
os.environ["DISPLAY"] = self.display
else:
@@ -84,12 +83,11 @@ class QemuRunner:
if self.is_alive():
bb.note("qemu started - qemu procces pid is %s" % self.qemupid)
- pscmd = 'ps -p %s -fww | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" \'{print $1}\'' % self.qemupid
- self.ip = subprocess.Popen(pscmd,shell=True,stdout=subprocess.PIPE).communicate()[0].strip()
+ cmdline = open('/proc/%s/cmdline' % self.qemupid).read()
+ self.ip, _, self.host_ip = cmdline.split('ip=')[1].split(' ')[0].split(':')[0:3]
if not re.search("^((?:[0-9]{1,3}\.){3}[0-9]{1,3})$", self.ip):
bb.note("Couldn't get ip from qemu process arguments, I got '%s'" % self.ip)
- bb.note("Here is the ps output:\n%s" % \
- subprocess.Popen("ps -p %s -fww" % self.qemupid,shell=True,stdout=subprocess.PIPE).communicate()[0])
+ bb.note("Here is the ps output:\n%s" % cmdline)
self.kill()
return False
bb.note("IP found: %s" % self.ip)
@@ -122,7 +120,6 @@ class QemuRunner:
sock.close()
stopread = True
-
if not reachedlogin:
bb.note("Target didn't reached login boot in %d seconds" % self.boottime)
lines = "\n".join(self.bootlog.splitlines()[-5:])
@@ -139,7 +136,6 @@ class QemuRunner:
return self.is_alive()
-
def kill(self):
if self.server_socket:
self.server_socket.close()
@@ -207,4 +203,3 @@ class QemuRunner:
basecmd = os.path.basename(basecmd)
if "qemu-system" in basecmd and "-serial tcp" in commands[p]:
return [int(p),commands[p]]
-