提交 8b3aacbd 编写于 作者: J jiyong_sd

modified drivers.py

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: Id6362b8fd20a5a3428f156e7402d0248b31d43c4
上级 a73c2138
......@@ -1641,12 +1641,18 @@ class JSUnitTestDriver(IDriver):
def read_device_log(self, device_log_file, timeout=60):
LOG.info("The timeout is {} seconds".format(timeout))
result_message = ""
while time.time() - self.start_time <= timeout:
result_message = ""
with open(device_log_file, "r", encoding='utf-8',
errors='ignore') as file_read_pipe:
lines = file_read_pipe.readlines()
for line in lines:
while True:
try:
line = file_read_pipe.readline()
except (UnicodeDecodeError, UnicodeError) as error:
LOG.warning("While read log file: %s" % error)
if not line :
break
if line.find("JSApp:") != -1:
result_message += line
if "[end] run suites end" in line:
......@@ -1659,7 +1665,6 @@ class JSUnitTestDriver(IDriver):
else:
LOG.error("Hjsunit run timeout {}s reached".format(timeout))
raise RuntimeError("Hjsunit run timeout!")
return result_message
def _run_jsunit(self, config_file, request):
try:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册