Skip to content

Commit

Permalink
[Modify #5] output response of testcase to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchan1207 committed Sep 25, 2023
1 parent ed58cd5 commit 355c8db
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests_avr/testcase_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ def main() -> int:
client_socket, _ = server_socket.accept()

# タイムアウトするまで拾い続ける
response: bytes = b''
proc_output: bytes = b''
timed_out = False
while not timed_out:
rl, _, _ = select.select([client_socket], [], [], 2)
if len(rl) == 0:
timed_out = True
break
response += client_socket.recv(64)
response = client_socket.recv(64)
print(response.decode(), end="", flush=True)
proc_output += response

# レスポンスが途切れたらクライアントソケットを閉じる
client_socket.close()
Expand All @@ -55,7 +57,7 @@ def main() -> int:
return 1

# 得られたレスポンスをデコードし、最終行を取得
lastresponseline = response.decode().split("\r\n")[-2]
lastresponseline = proc_output.decode().split("\r\n")[-2]
if lastresponseline != "All testcases passed.":
return 1

Expand Down

0 comments on commit 355c8db

Please sign in to comment.