Skip to contentSkip to conversation

Small tweaks for testimage

PATCH Superseded Stefan Stanacar 1 participant 6 messages Jul 30, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Small tweaks for testimage

The following changes since commit bd1c441a210cae03fb6006c996227211cc29056b:

bitbake: bitbake: runqueue: add warning if invalidating invalid task (2013-07-29 15:25:09 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib stefans/testimage-fix1

for you to fetch changes up to edec10deb2863c79750af25b31d39f7d0904c8a8:

oeqa/runtime/xorg: use the right ps command for xorg test (2013-07-30 11:02:09 +0300)

----------------------------------------------------------------
Stefan Stanacar (4):
oeqa/utils/sshcontrol: increase and log timeout in output oeqa/utils/qemurunner: add comment and header oeqa/utils/qemurunner: tweak console bootparam and ip command oeqa/runtime/xorg: use the right ps command for xorg test

 meta/lib/oeqa/runtime/xorg.py     |  4 ++--
 meta/lib/oeqa/utils/qemurunner.py | 11 +++++++++--
 meta/lib/oeqa/utils/sshcontrol.py | 10 ++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)

Stefan Stanacar (4):
oeqa/utils/sshcontrol: increase and log timeout in output oeqa/utils/qemurunner: add comment and header oeqa/utils/qemurunner: tweak console bootparam and ip command oeqa/runtime/xorg: use the right ps command for xorg test

 meta/lib/oeqa/runtime/xorg.py     |  4 ++--
 meta/lib/oeqa/utils/qemurunner.py | 11 +++++++++--
 meta/lib/oeqa/utils/sshcontrol.py | 10 ++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 oeqa/utils/sshcontrol: increase and log timeout in output

Increase a bit the timeout for ssh commands and also write in the output that the command timed out (it's easier to see that in a test fail than checking the ssh log)

---
 meta/lib/oeqa/utils/sshcontrol.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
meta/lib/oeqa/utils/sshcontrol.py +6 -4
index 8f98c45..7de7c3e 100644
@@ -13,7 +13,7 @@ import os
 
 class SSHControl(object):
 
-    def __init__(self, host=None, timeout=200, logfile=None):
+    def __init__(self, host=None, timeout=300, logfile=None):
         self.host = host
         self.timeout = timeout
         self._out = ''
@@ -52,9 +52,10 @@ class SSHControl(object):
             self._ret = sshconn.poll()
         else:
             if timeout is None:
-                endtime = time.time() + self.timeout
+                tdelta = self.timeout
             else:
-                endtime = time.time() + timeout
+                tdelta = timeout
+            endtime = time.time() + tdelta
             while sshconn.poll() is None and time.time() < endtime:
                 time.sleep(1)
             # process hasn't returned yet
@@ -64,7 +65,8 @@ class SSHControl(object):
                 sshconn.kill()
                 self._out = sshconn.stdout.read()
                 sshconn.stdout.close()
-                self.log("[!!! process killed]")
+                self._out += "\n[!!! SSH command timed out after %d seconds and it was killed]" % tdelta
+                self.log("[!!! SSH command timed out after %d seconds and it was killed]" % tdelta)
             else:
                 self._out = sshconn.stdout.read()
                 self._ret = sshconn.poll()
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/4 oeqa/utils/qemurunner: add comment and header

In reply to Stefan Stanacar

One of the files was missing comment/header, unlike the others.

---
 meta/lib/oeqa/utils/qemurunner.py | 7 +++++++
 1 file changed, 7 insertions(+)
meta/lib/oeqa/utils/qemurunner.py +7 -0
index 1051b2b..02e0a4a 100644
@@ -1,3 +1,10 @@
+# Copyright (C) 2013 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# This module provides a class for starting qemu images using runqemu.
+# It's used by testimage.bbclass.
+
 import subprocess
 import optparse
 import sys
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/4 oeqa/utils/qemurunner: tweak console bootparam and ip command

In reply to Stefan Stanacar

Sync serial baud rate with default inittab which should help with apparent boot fails. Also keep a console on tty1.

Also we shouldn't assume eth0 it the right interface. (systemd images can rename interfaces to something else).

---
 meta/lib/oeqa/utils/qemurunner.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/utils/qemurunner.py +2 -2
index 02e0a4a..45b3ccb 100644
@@ -25,7 +25,7 @@ class QemuRunner:
         self.rootfs = rootfs
 
         self.streampath = '/tmp/qemuconnection.%s' % os.getpid()
-        self.qemuparams = 'bootparams="console=ttyS0" qemuparams="-serial unix:%s,server,nowait"' % self.streampath
+        self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial unix:%s,server,nowait"' % self.streampath
         self.qemupid = None
         self.ip = None
 
@@ -76,7 +76,7 @@ class QemuRunner:
                 if not match:
                     bb.note("Couldn't get prompt, all I got was:\n%s" % match.group(0))
                     return False
-                console.write("ip addr show eth0 | sed -n '3p' | awk '{ print $2 }' | cut -f 1 -d \"/\"\n")
+                console.write("ip addr show `ip route list | sed -n '1p' | awk '{print $5}'` | sed -n '3p' | awk '{ print $2 }' | cut -f 1 -d \"/\"\n")
                 (index, match, text) = console.expect([r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})"],10)
                 console.close()
                 if match:
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/4 oeqa/runtime/xorg: use the right ps command for xorg test

In reply to Stefan Stanacar

Use our determined ps command, otherwise test fails for images with procps.

---
 meta/lib/oeqa/runtime/xorg.py     | 4 ++--
 meta/lib/oeqa/utils/qemurunner.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
meta/lib/oeqa/runtime/xorg.py +2 -2
index 96cc20a..12dccd8 100644
@@ -11,8 +11,8 @@ class XorgTest(oeRuntimeTest):
 
     @skipUnlessPassed('test_ssh')
     def test_xorg_running(self):
-        (status, output) = self.target.run('ps | grep -v xinit | grep [X]org')
-        self.assertEqual(status, 0, msg="Xorg does not appear to be running %s" % self.target.run('ps')[1])
+        (status, output) = self.target.run(oeRuntimeTest.pscmd + ' |  grep -v xinit | grep [X]org')
+        self.assertEqual(status, 0, msg="Xorg does not appear to be running %s" % self.target.run(oeRuntimeTest.pscmd)[1])
 
     @skipUnlessPassed('test_ssh')
     def test_xorg_error(self):
meta/lib/oeqa/utils/qemurunner.py +1 -1
index 45b3ccb..426af01 100644
@@ -25,7 +25,7 @@ class QemuRunner:
         self.rootfs = rootfs
 
         self.streampath = '/tmp/qemuconnection.%s' % os.getpid()
-        self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial unix:%s,server,nowait"' % self.streampath
+        self.qemuparams = 'nographic bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial unix:%s,server,nowait"' % self.streampath
         self.qemupid = None
         self.ip = None
 
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [PATCH 4/4] oeqa/runtime/xorg: use the right ps command for xorg test

meta/lib/oeqa/utils/qemurunner.py class QemuRunner: · line 28

Quoted 7 lines · Stefan Stanacar

Use our determined ps command, otherwise test fails for images with procps.

self.streampath = '/tmp/qemuconnection.%s' % os.getpid()

meta/lib/oeqa/utils/qemurunner.py +1 -1
-        self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial unix:%s,server,nowait"' % self.streampath
+        self.qemuparams = 'nographic bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial unix:%s,server,nowait"' % self.streampath

This was unintentional, I'll resend.

Regards,
Stefan

Quoted 3 lines

self.qemupid = None
self.ip = None