Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Callable, List, Tuple
import prettytable
from termcolor import colored
import time

import testcases_quic
from result import TestResult
Expand Down Expand Up @@ -442,23 +443,29 @@ def _run_test(
logging.debug("Command: %s", cmd)

status = TestResult.FAILED
output = ""
expired = False
lines = []
try:
r = subprocess.run(
start = time.time()
r = subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
timeout=test.timeout(),
)
output = r.stdout
while r.poll() is None:
if time.time() - start > test.timeout():
raise subprocess.TimeoutExpired(cmd, test.timeout())
line = r.stdout.readline()
if line:
logging.debug("| %s", line[:-1].decode("utf-8", errors="replace"))
lines.append(line)
except subprocess.TimeoutExpired as ex:
output = ex.stdout
if output is not None:
logging.debug("%s", output.decode("utf-8", errors="replace"))
expired = True

logging.debug("%s", output.decode("utf-8", errors="replace"))

if expired:
logging.debug("Test failed: took longer than %ds.", test.timeout())
r = subprocess.run(
Expand All @@ -476,7 +483,6 @@ def _run_test(
self._copy_logs("server", server_log_dir)

if not expired:
lines = output.splitlines()
exit_lines = [
str(line) for line in lines if "exited with code" in str(line)
]
Expand Down