소스 검색

Merge pull request #7317 from pgerber/hanging-test

Fix test hanging reading FIFO when `borg create` failed
TW 2 년 전
부모
커밋
c96c5652b0
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/borg/testsuite/archiver/create_cmd.py

+ 6 - 0
src/borg/testsuite/archiver/create_cmd.py

@@ -766,6 +766,12 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         try:
             self.cmd(f"--repo={self.repository_location}", "create", "--read-special", "test", "input/link_fifo")
         finally:
+            # In case `borg create` failed to open FIFO, read all data to avoid join() hanging.
+            fd = os.open(fifo_fn, os.O_RDONLY | os.O_NONBLOCK)
+            try:
+                os.read(fd, len(data))
+            finally:
+                os.close(fd)
             t.join()
         with changedir("output"):
             self.cmd(f"--repo={self.repository_location}", "extract", "test")