Merge ~sylvain-pineau/plainbox-provider-checkbox:fix-1967032 into plainbox-provider-checkbox:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: ece5bed9c23afae9741242803823bf8fe98bbb66
Merged at revision: 513b7993ac8efcb356821da85fec295b0da70eab
Proposed branch: ~sylvain-pineau/plainbox-provider-checkbox:fix-1967032
Merge into: plainbox-provider-checkbox:master
Diff against target: 32 lines (+15/-6)
1 file modified
bin/pm_test.py (+15/-6)
Reviewer Review Type Date Requested Status
Devices Certification Bot Needs Fixing
Sylvain Pineau (community) Approve
Review via email: mp+418085@code.launchpad.net

Description of the change

Fixes the linked bug.

pm_test (and x-terminal-emulator) does not work in wayland sessions.

This patch catches the subprocess exception and executes the respawn commands
using plain subprocess run() commands.

Tested using the dev ppa base install, this patch and the latest 22.04 daily (03-29)

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

self-approved

review: Approve
Revision history for this message
Devices Certification Bot (ce-certification-qa) wrote :

The merge was fine but running tests failed.

"10.38.105.54"
"10.38.105.108"
"10.38.105.197"
[xenial] [16:18:10] starting container
Device project added to xenial-testing
"10.38.105.54"
[xenial] [16:18:36] provisioning container
[focal] [16:18:37] starting container
[bionic] [16:18:50] starting container
Device project added to focal-testing
"10.38.105.181"
[focal] [16:19:07] provisioning container
Device project added to bionic-testing
"10.38.105.52"
[bionic] [16:19:20] provisioning container
[xenial] [16:19:53] Starting tests...
[xenial] Found a test script: ./requirements/container-tests-provider-checkbox
[bionic] [16:20:25] Starting tests...
[bionic] Found a test script: ./requirements/container-tests-provider-checkbox
[focal] [16:21:10] Starting tests...
[focal] Found a test script: ./requirements/container-tests-provider-checkbox
[xenial] [16:21:12] container-tests-provider-checkbox: FAIL
[xenial] output: https://paste.ubuntu.com/p/hGVhbSbGWT/
[xenial] [16:21:15] Fixing file permissions in source directory
[xenial] [16:21:15] Destroying container
[bionic] [16:21:56] container-tests-provider-checkbox: FAIL
[bionic] output: https://paste.ubuntu.com/p/QdNwzGJcQx/
[bionic] [16:21:58] Fixing file permissions in source directory
[bionic] [16:21:58] Destroying container
[focal] [16:23:04] container-tests-provider-checkbox: FAIL
[focal] output: https://paste.ubuntu.com/p/xBfkJ7rjg4/
[focal] [16:23:06] Fixing file permissions in source directory
[focal] [16:23:06] Destroying container

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/pm_test.py b/bin/pm_test.py
2index 45f52ec..92a5863 100755
3--- a/bin/pm_test.py
4+++ b/bin/pm_test.py
5@@ -286,12 +286,21 @@ class PowerManagementOperation():
6 title = '{0} test'.format(self.args.pm_operation.capitalize())
7 MessageDialog(title, message).run()
8 if self.args.checkbox_respawn_cmd:
9- subprocess.run(
10- r'unset LD_LIBRARY_PATH;'
11- r'unset PYTHONPATH; unset PYTHONHOME;'
12- r'DISPLAY=:0 x-terminal-emulator -e "sudo -u '
13- r'{} bash -c \"source {}; exec bash\""'.format(
14- self.user, self.args.checkbox_respawn_cmd), shell=True)
15+ try:
16+ subprocess.run(
17+ r'unset LD_LIBRARY_PATH;'
18+ r'unset PYTHONPATH; unset PYTHONHOME;'
19+ r'DISPLAY=:0 x-terminal-emulator -e "sudo -u '
20+ r'{} bash -c \"source {}; exec bash\""'.format(
21+ self.user, self.args.checkbox_respawn_cmd),
22+ shell=True,
23+ check=True)
24+ # x-terminal-emulator command does not work on Wayland
25+ # Run the checkbox_respawn_cmd via subprocess.run instead
26+ except subprocess.CalledProcessError:
27+ with open(self.args.checkbox_respawn_cmd, 'rt') as f:
28+ for l in f:
29+ subprocess.run(l, shell=True)
30
31 def teardown(self):
32 """

Subscribers

People subscribed via source and target branches