Skip to content

Commit dddabd6

Browse files
Improve output buffering in the Linux tv CI test script
1 parent 928efd7 commit dddabd6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

scripts/tests/linux/log_line_processing.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ def _io_thread(self):
6363
err_wait = select.poll()
6464
err_wait.register(self.process.stderr, select.POLLIN | select.POLLHUP)
6565

66-
with open(self.output_path, "wt") as f:
66+
with open(self.output_path, "wt", buffering=1) as f:
6767
f.write("PROCESS START: %s\n" % time.ctime())
68+
f.flush()
6869
while not self.done:
6970
changes = out_wait.poll(0.1)
7071
if changes:
@@ -73,6 +74,7 @@ def _io_thread(self):
7374
# stdout closed (otherwise readline should have at least \n)
7475
continue
7576
f.write(out_line)
77+
f.flush()
7678
self.output_lines.put(out_line)
7779

7880
changes = err_wait.poll(0)
@@ -82,7 +84,9 @@ def _io_thread(self):
8284
# stderr closed (otherwise readline should have at least \n)
8385
continue
8486
f.write(f"!!STDERR!! : {err_line}")
87+
f.flush()
8588
f.write("PROCESS END: %s\n" % time.ctime())
89+
f.flush()
8690

8791
def __enter__(self):
8892
self.done = False
@@ -92,6 +96,7 @@ def __enter__(self):
9296
stdout=subprocess.PIPE,
9397
stderr=subprocess.PIPE,
9498
text=True,
99+
bufsize=1
95100
)
96101
self.io_thread = threading.Thread(target=self._io_thread)
97102
self.io_thread.start()

scripts/tests/run_tv_casting_test.py

+2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def send_input_cmd_to_subprocess(
205205
f"{test_sequence_name} - Sent `{input_cmd}` to the {app_name} subprocess."
206206
)
207207

208+
time.sleep(0.5)
209+
208210

209211
def handle_input_cmd(
210212
processes: RunningProcesses, test_sequence_name: str, test_sequence_step: Step

0 commit comments

Comments
 (0)