Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Yeoh Ee Peng" <ee.peng.yeoh@intel.com>
To: openembedded-core@lists.openembedded.org
Cc: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Subject: [PATCH] oeqa/runtime/weston: Enhance weston tests
Date: Mon, 13 Apr 2020 16:49:13 +0800	[thread overview]
Message-ID: <1586767753-29252-1-git-send-email-ee.peng.yeoh@intel.com> (raw)

Existing weston test available make sure that a process
for weston-desktop-shell exist when image boot up.

Enhance weston tests by:
 - execute weston-info to make sure weston interface(s)
   are initialized
 - execute weston and make sure it can initialize a
   new wayland compositor

[YOCTO# 10690]

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
 meta/lib/oeqa/runtime/cases/weston.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/meta/lib/oeqa/runtime/cases/weston.py b/meta/lib/oeqa/runtime/cases/weston.py
index f32599a..f79ed64 100644
--- a/meta/lib/oeqa/runtime/cases/weston.py
+++ b/meta/lib/oeqa/runtime/cases/weston.py
@@ -6,6 +6,8 @@ from oeqa.runtime.case import OERuntimeTestCase
 from oeqa.core.decorator.depends import OETestDepends
 from oeqa.core.decorator.data import skipIfNotFeature
 from oeqa.runtime.decorator.package import OEHasPackage
+import threading
+import time
 
 class WestonTest(OERuntimeTestCase):
 
@@ -17,3 +19,31 @@ class WestonTest(OERuntimeTestCase):
         msg = ('Weston does not appear to be running %s' %
               self.target.run(self.tc.target_cmds['ps'])[1])
         self.assertEqual(status, 0, msg=msg)
+
+    def get_weston_command(self, cmd):
+        return 'export XDG_RUNTIME_DIR=/run/user/0; export DISPLAY=:0; %s' % cmd
+
+    def run_weston_init(self):
+        self.target.run(self.get_weston_command('weston'))
+
+    @OEHasPackage(['weston'])
+    def test_weston_info(self):
+        status, output = self.target.run(self.get_weston_command('weston-info'))
+        self.assertEqual(status, 0, msg='weston-info error: %s' % output)
+
+    @OEHasPackage(['weston'])
+    def test_weston_can_initialize_new_wayland_compositor(self):
+        status, output = self.target.run('pidof weston-desktop-shell')
+        self.assertEqual(status, 0, msg='Retrieve existing weston-desktop-shell processes error: %s' % output)
+        existing_wl_processes = output.split(" ")
+
+        weston_thread = threading.Thread(target=self.run_weston_init)
+        weston_thread.start()
+        time.sleep(5)
+        status, output = self.target.run('pidof weston-desktop-shell')
+        self.assertEqual(status, 0, msg='Retrieve existing and new weston-desktop-shell processes error: %s' % output)
+        wl_processes = output.split(" ")
+        new_wl_processes = [x for x in wl_processes if x not in existing_wl_processes]
+        self.assertTrue(new_wl_processes, msg='Check new weston-desktop-shell processes error: %s' % new_wl_processes)
+        for wl in new_wl_processes:
+            self.target.run('kill -9 %s' % wl)
-- 
2.7.4


             reply	other threads:[~2020-04-13  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  8:49 Yeoh Ee Peng [this message]
2020-04-13  8:58 ` [OE-core] [PATCH] oeqa/runtime/weston: Enhance weston tests Alexander Kanavin
2020-04-16 22:35 ` Richard Purdie
2020-04-17  1:53   ` Yeoh Ee Peng
2020-04-17 14:23     ` Richard Purdie
2020-04-21  0:56       ` Yeoh Ee Peng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1586767753-29252-1-git-send-email-ee.peng.yeoh@intel.com \
    --to=ee.peng.yeoh@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox