Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Update.
Signed-off-by: Wang, Yang <[email protected]>
  • Loading branch information
yangwang201911 committed Sep 13, 2022
commit 19f9ff1052723573f676fa6dfbf6eea2ec9d4ceb
5 changes: 1 addition & 4 deletions demos/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,11 @@ def option_to_args(key, value):
demo.parse_output(output, test_case, device)
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e:
output = e.output
if not isinstance(output, str):
output = e.output.decode('utf-8')
if isinstance(e, subprocess.CalledProcessError):
exit_msg = f'Exit code: {e.returncode}\n'
elif isinstance(e, subprocess.TimeoutExpired):
exit_msg = f'Command timed out after {e.timeout} seconds\n'
output += exit_msg
print(output)
print('{}\n{}'.format(output, exit_msg))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output var is used to save log file below: write_log(output, args.log_file). So you need this output += exit_msg.

If I understand correctly, TimeoutExpired.output is of bytes type for you. Maybe you can cast it to str before that +=

Please, add a comment to code with link to a bug https://bugs.python.org/issue43431 to explain why we have such cast.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, TimeoutExpired.output is of bytes type for you. Maybe you can cast it to str before that +=

Yes, you are right. output var is bytes type under that host env when timeout happened. While don't know why the output is Str type on my host when timeout happened.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the bug. It appears on python3.8+ may be you have python3.7 or 3.6 on your host

failed_tests.append(test_descr + '\n' + exit_msg)
num_failures += 1
execution_time = -1
Expand Down