summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-09-13 14:52:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-14 22:42:30 +0100
commitbdfc4fb0e91f3c8c8176bd60432a7b89d71e2407 (patch)
tree2a318bc4b03422f35b1ffc291302890e6c62adcf
parent8d04a52f483e5c8d8b56c59aedfcecffe2e2c943 (diff)
downloadpoky-bdfc4fb0e91f3c8c8176bd60432a7b89d71e2407.tar.gz
oeqa/weston: Fix tests to run with systemd
Currently, weston tests fail when using systemd, fix it by providing transient unit file and inject it via systemd-run, which generates a service file automatically and launches another weston instance to test if it can launch a nested instance. Use systemctl stop to end the service and cleanup, instead of brutal kill (From OE-Core rev: 7572158b861cb5d4ebf6360ced08ab41419d74d3) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/runtime/cases/weston.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/meta/lib/oeqa/runtime/cases/weston.py b/meta/lib/oeqa/runtime/cases/weston.py
index ac29eca6e4..36b4f9e375 100644
--- a/meta/lib/oeqa/runtime/cases/weston.py
+++ b/meta/lib/oeqa/runtime/cases/weston.py
@@ -34,7 +34,10 @@ class WestonTest(OERuntimeTestCase):
34 return 'export XDG_RUNTIME_DIR=/run/user/0; export WAYLAND_DISPLAY=wayland-0; %s' % cmd 34 return 'export XDG_RUNTIME_DIR=/run/user/0; export WAYLAND_DISPLAY=wayland-0; %s' % cmd
35 35
36 def run_weston_init(self): 36 def run_weston_init(self):
37 self.target.run(self.get_weston_command('weston --log=%s' % self.weston_log_file)) 37 if 'systemd' in self.tc.td['DISTRO_FEATURES']:
38 self.target.run('systemd-run --collect --unit=weston-ptest.service --uid=0 -p PAMName=login -p TTYPath=/dev/tty6 -E XDG_RUNTIME_DIR=/tmp -E WAYLAND_DISPLAY=wayland-0 /usr/bin/weston --socket=wayland-1 --log=%s' % self.weston_log_file)
39 else:
40 self.target.run(self.get_weston_command('openvt -- weston --socket=wayland-1 --log=%s' % self.weston_log_file))
38 41
39 def get_new_wayland_processes(self, existing_wl_processes): 42 def get_new_wayland_processes(self, existing_wl_processes):
40 try_cnt = 0 43 try_cnt = 0
@@ -63,7 +66,10 @@ class WestonTest(OERuntimeTestCase):
63 new_wl_processes, try_cnt = self.get_new_wayland_processes(existing_wl_processes) 66 new_wl_processes, try_cnt = self.get_new_wayland_processes(existing_wl_processes)
64 existing_and_new_weston_processes = self.get_processes_of('weston', 'existing and new') 67 existing_and_new_weston_processes = self.get_processes_of('weston', 'existing and new')
65 new_weston_processes = [x for x in existing_and_new_weston_processes if x not in existing_weston_processes] 68 new_weston_processes = [x for x in existing_and_new_weston_processes if x not in existing_weston_processes]
66 for w in new_weston_processes: 69 if 'systemd' in self.tc.td['DISTRO_FEATURES']:
67 self.target.run('kill -9 %s' % w) 70 self.target.run('systemctl stop weston-ptest.service')
71 else:
72 for w in new_weston_processes:
73 self.target.run('kill -9 %s' % w)
68 __, weston_log = self.target.run('cat %s' % self.weston_log_file) 74 __, weston_log = self.target.run('cat %s' % self.weston_log_file)
69 self.assertTrue(new_wl_processes, msg='Could not get new weston-desktop-shell processes (%s, try_cnt:%s) weston log: %s' % (new_wl_processes, try_cnt, weston_log)) 75 self.assertTrue(new_wl_processes, msg='Could not get new weston-desktop-shell processes (%s, try_cnt:%s) weston log: %s' % (new_wl_processes, try_cnt, weston_log))