[OE-core] [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.
Lucian Musat
george.l.musat at intel.com
Mon Mar 23 09:24:03 UTC 2015
The test builds a poky-tiny image, boots it in background and
tries to comunicate with it via serial.
Signed-off-by: Lucian Musat <george.l.musat at intel.com>
---
meta/lib/oeqa/selftest/bbtests.py | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index aeccbf5..6305550 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -3,6 +3,8 @@ import os
import logging
import re
import shutil
+import socket, select, signal, subprocess
+import time
import oeqa.utils.ftools as ftools
from oeqa.selftest.base import oeSelfTest
@@ -187,4 +189,31 @@ class BitbakeTests(oeSelfTest):
self.assertEqual(result.status, 0)
self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3')))
self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2')))
+ ftools.remove_from_file(conf ,data)
+
+ def test_boot_poky_tiny(self):
+ conf = os.path.join(self.builddir, 'conf/local.conf')
+ data = 'DISTRO = "poky-tiny"'
+ ftools.append_file(conf ,data)
+ bitbake('core-image-minimal')
+ result = runCmd('qemu-system-i386 -kernel tmp/deploy/images/qemux86/bzImage-qemux86.bin -initrd tmp/deploy/images/qemux86/core-image-minimal-qemux86.cpio.gz -append "root=/dev/ram0 console=ttyS0" -nographic -serial unix:console.sock,server,nowait', bg=True, shell=True)
+ qemupid = result.pid
+ time.sleep(30)
+ clientsocket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ clientsocket.connect('console.sock')
+ clientsocket.sendall('uname -r\n')
+ data = ''
+ stopread = False
+ endtime = time.time()+5
+ while time.time()<endtime and not stopread:
+ sread, _, _ = select.select([clientsocket],[],[],5)
+ for sock in sread:
+ answer = sock.recv(1024)
+ if answer:
+ data += answer
+ else:
+ sock.close()
+ stopread = True
+ self.assertTrue("yocto-tiny" in data, msg="Cannot detect poky tiny boot!")
+ subprocess.call(['pkill', '-9', '-P', str(qemupid)])
ftools.remove_from_file(conf ,data)
\ No newline at end of file
--
2.1.0
More information about the Openembedded-core
mailing list