[gnome-settings-daemon/benzea/tests-output-checker-testing] tests: try closing writer later




commit a8d9fd0974a1a92c75e3b659b1b3cf81fc2db95c
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Feb 15 15:15:40 2021 +0100

    tests: try closing writer later

 tests/output_checker.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/tests/output_checker.py b/tests/output_checker.py
index 54b3aa70..36be8225 100644
--- a/tests/output_checker.py
+++ b/tests/output_checker.py
@@ -139,13 +139,24 @@ class OutputChecker(object):
         return ret
 
     def assert_closed(self, timeout=1):
+        fd = self._pipe_fd_w
+        self._pipe_fd_w = -1
+        os.close(fd)
+
         self._thread.join(timeout)
+
         if self._thread.is_alive() != False:
             raise AssertionError("OutputCheck: Write side has not been closed yet!")
 
     def force_close(self):
         os.write(1, b"force closing pipe %d" % self._pipe_fd_r);
-        os.close(self._pipe_fd_r)
+
+        fd = self._pipe_fd_w
+        # Write EOF
+        os.write(fd, b"")
+        self._pipe_fd_w = -1
+        os.close(fd)
+
         os.write(1, b"pipe closed, waiting\n");
         self._thread.join()
         os.write(1, b"reader thread joined\n");
@@ -155,6 +166,5 @@ class OutputChecker(object):
         return self._pipe_fd_w
 
     def writer_attached(self):
-        os.close(self._pipe_fd_w)
-        self._pipe_fd_w = -1
+        pass
 


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