Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.
@ 2015-03-23  9:24 Lucian Musat
  2015-03-23 10:38 ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Lucian Musat @ 2015-03-23  9:24 UTC (permalink / raw)
  To: openembedded-core

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@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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.
  2015-03-23  9:24 [PATCH] oeqa/selftest: New auto bitbake test for poky tiny Lucian Musat
@ 2015-03-23 10:38 ` Burton, Ross
  2015-03-23 11:54   ` Musat, George L
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2015-03-23 10:38 UTC (permalink / raw)
  To: Lucian Musat; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On 23 March 2015 at 11:24, Lucian Musat <george.l.musat@intel.com> wrote:

> The test builds a poky-tiny image, boots it in background and
> tries to comunicate with it via serial.
>

Would this be better as a test hooked into the usual post-build testimage
support?

Ross

[-- Attachment #2: Type: text/html, Size: 695 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.
  2015-03-23 10:38 ` Burton, Ross
@ 2015-03-23 11:54   ` Musat, George L
  2015-03-24  9:34     ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Musat, George L @ 2015-03-23 11:54 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

Hi Ross,
I am viewing this as a build test for the poky-tiny image, that checks if the build was fine by booting it and checking that it booted fine and checking that it’s indeed a tiny, rather than a runtime test.

From: Burton, Ross [mailto:ross.burton@intel.com]
Sent: Monday, March 23, 2015 12:39 PM
To: Musat, George L
Cc: OE-core
Subject: Re: [OE-core] [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.


On 23 March 2015 at 11:24, Lucian Musat <george.l.musat@intel.com<mailto:george.l.musat@intel.com>> wrote:
The test builds a poky-tiny image, boots it in background and
tries to comunicate with it via serial.

Would this be better as a test hooked into the usual post-build testimage support?

Ross

[-- Attachment #2: Type: text/html, Size: 3577 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oeqa/selftest: New auto bitbake test for poky tiny.
  2015-03-23 11:54   ` Musat, George L
@ 2015-03-24  9:34     ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2015-03-24  9:34 UTC (permalink / raw)
  To: Musat, George L; +Cc: OE-core

On Mon, 2015-03-23 at 11:54 +0000, Musat, George L wrote:
> I am viewing this as a build test for the poky-tiny image, that checks
> if the build was fine by booting it and checking that it booted fine
> and checking that it’s indeed a tiny, rather than a runtime test.

Ross does have a point, our other images automatically run their
testimage tests after each rootfs is constructed as part of the normal
build. Why wouldn't we do this for the tiny images too?

Cheers,

Richard






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-24  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23  9:24 [PATCH] oeqa/selftest: New auto bitbake test for poky tiny Lucian Musat
2015-03-23 10:38 ` Burton, Ross
2015-03-23 11:54   ` Musat, George L
2015-03-24  9:34     ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox