Skip to content

Commit 71b6392

Browse files
Fix and re-enable the commissioner-generated-passcode Linux tv CI test
1 parent 1e9ef37 commit 71b6392

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

.github/workflows/examples-linux-tv-casting-app.yaml

+7-10
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,13 @@ jobs:
7272
"python3 ./scripts/tests/run_tv_casting_test.py"
7373
timeout-minutes: 2 # Comment this out to debug if GitHub Action times out.
7474

75-
# TODO: this test is flaky and was disabled
76-
# https://github.com/project-chip/connectedhomeip/issues/34598
77-
#
78-
# - name:
79-
# Test casting from Linux tv-casting-app to Linux tv-app -
80-
# Commissioner Generated Passcode
81-
# run: |
82-
# ./scripts/run_in_build_env.sh \
83-
# "python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True"
84-
# timeout-minutes: 2 # Comment this out to debug if GitHub Action times out.
75+
- name:
76+
Test casting from Linux tv-casting-app to Linux tv-app -
77+
Commissioner Generated Passcode
78+
run: |
79+
./scripts/run_in_build_env.sh \
80+
"python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True"
81+
timeout-minutes: 2 # Comment this out to debug if GitHub Action times out.
8582

8683
- name: Uploading Size Reports
8784
uses: ./.github/actions/upload-size-reports

scripts/tests/linux/log_line_processing.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,27 @@ 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)
70-
if changes:
71-
out_line = self.process.stdout.readline()
72-
if not out_line:
73-
# stdout closed (otherwise readline should have at least \n)
74-
continue
75-
f.write(out_line)
76-
self.output_lines.put(out_line)
77-
78-
changes = err_wait.poll(0)
79-
if changes:
80-
err_line = self.process.stderr.readline()
81-
if not err_line:
82-
# stderr closed (otherwise readline should have at least \n)
83-
continue
84-
f.write(f"!!STDERR!! : {err_line}")
71+
for fd, _ in changes:
72+
if fd == self.process.stdout.fileno():
73+
while True:
74+
out_line = self.process.stdout.readline()
75+
if not out_line:
76+
break
77+
f.write(out_line)
78+
f.flush()
79+
self.output_lines.put(out_line)
80+
elif fd == self.process.stderr.fileno():
81+
err_line = self.process.stderr.readline()
82+
if err_line:
83+
f.write(f"!!STDERR!! : {err_line}")
84+
f.flush()
8585
f.write("PROCESS END: %s\n" % time.ctime())
86+
f.flush()
8687

8788
def __enter__(self):
8889
self.done = False
@@ -92,6 +93,7 @@ def __enter__(self):
9293
stdout=subprocess.PIPE,
9394
stderr=subprocess.PIPE,
9495
text=True,
96+
bufsize=1,
9597
)
9698
self.io_thread = threading.Thread(target=self._io_thread)
9799
self.io_thread.start()

0 commit comments

Comments
 (0)