[gnome-settings-daemon/benzea/ci-fixes: 7/11] tests: Do not use PIPE when not required




commit 88873dcdc5756f3546ff907dffe0137da5855b7a
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Jul 20 17:46:36 2021 +0200

    tests: Do not use PIPE when not required
    
    Theoretically this could cause deadlocks when the kernel buffers are not
    large enough to read the command output.

 plugins/power/test.py | 6 ++----
 tests/gsdtestcase.py  | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 2cd6b333..52edd15d 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -71,14 +71,12 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
 
         # start mock upowerd
         (self.upowerd, self.obj_upower) = self.spawn_server_template(
-            'upower', {'DaemonVersion': '0.99', 'OnBattery': True, 'LidIsClosed': False}, 
stdout=subprocess.PIPE)
-        gsdtestcase.set_nonblock(self.upowerd.stdout)
+            'upower', {'DaemonVersion': '0.99', 'OnBattery': True, 'LidIsClosed': False})
         self.addCleanup(self.stop_process, self.upowerd)
 
         # start mock gnome-shell screensaver
         (self.screensaver, self.obj_screensaver) = self.spawn_server_template(
-            'gnome_screensaver', stdout=subprocess.PIPE)
-        gsdtestcase.set_nonblock(self.screensaver.stdout)
+            'gnome_screensaver')
         self.addCleanup(self.stop_process, self.screensaver)
 
         self.session_log = OutputChecker()
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py
index a45e5125..3a6ff9ca 100644
--- a/tests/gsdtestcase.py
+++ b/tests/gsdtestcase.py
@@ -33,7 +33,7 @@ except ImportError:
     sys.stderr.write('You need pygobject and the Gio GIR for this test suite.\n')
     sys.exit(77)
 
-if subprocess.call(['which', 'gnome-session'], stdout=subprocess.PIPE) != 0:
+if subprocess.call(['which', 'gnome-session'], stdout=subprocess.DEVNULL) != 0:
     sys.stderr.write('You need gnome-session for this test suite.\n')
     sys.exit(77)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]