Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def main():
help="optional arguments for the image",
)
args = parser.parse_args()
ret_code = run_fvp(
ret_code, data, err = run_fvp(
args.fvp_install_dir,
args.fvp_config_dir,
args.fvp_model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main():
help="optional arguments for the image",
)
args = parser.parse_args()
ret_code = run_qemu(
ret_code, data, err = run_qemu(
args.qemu_command,
args.qemu_machine,
args.qemu_cpu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def main():
help="optional arguments for the image",
)
args = parser.parse_args()
ret_code = run(args)
ret_code, data, err = run(args)
sys.exit(ret_code)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@ def run_fvp(
result_stdout = result.stdout

sys.stdout.buffer.write(result_stdout)
return result.returncode
return result.returncode, result.stdout.decode(), result.stderr.decode() if result.stderr != None else ""
Copy link
Contributor

Choose a reason for hiding this comment

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

In this kind of situation it's a good idea to add the errors='replace' argument to the decode calls. Then any bytes that aren't legal UTF-8 will be turned into a Unicode replacement character � instead of causing an exception.

If the program under test does emit invalid UTF-8, we still want to see in the log file what it was, so that we can get a clue about what went wrong. A Python exception that stops the script from showing us the useful detail isn't good for anyone.

Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ def run_qemu(
check=False,
)
sys.stdout.buffer.write(result.stdout)
return result.returncode
return result.returncode, result.stdout.decode(), result.stderr.decode() if result.stderr != None else ""