Skip to content

Commit

Permalink
[test] fixed the bugs in unicode failures. Refer to ttps://github.com/d…
Browse files Browse the repository at this point in the history
  • Loading branch information
tangxifan committed Nov 13, 2024
1 parent 5c8b7c5 commit 9e6f975
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions openfpga_flow/scripts/run_fpga_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,17 +1017,17 @@ def run_command(taskname, logfile, command, exit_if_fail=True):
try:
output.write(" ".join(command) + "\n")
process = subprocess.run(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False
)
output.write(process.stdout)
output.write(process.stderr)
output.write(process.stdout.decode("cp1252"))
output.write(process.stderr.decode("cp1252"))
output.write(str(process.returncode))
if "openfpgashell" in logfile:
filter_openfpga_output(process.stdout)
filter_openfpga_output(process.stdout.decode("cp1252"))
if process.returncode:
logger.error("%s run failed with returncode %d" % (taskname, process.returncode))
logger.error("command %s" % " ".join(command))
filter_failed_process_output(process.stderr)
filter_failed_process_output(process.stderr.decode("cp1252"))
if exit_if_fail:
clean_up_and_exit("Failed to run %s task" % taskname)
except Exception:
Expand All @@ -1036,7 +1036,7 @@ def run_command(taskname, logfile, command, exit_if_fail=True):
if exit_if_fail:
clean_up_and_exit("Failed to run %s task" % taskname)
logger.info("%s is written in file %s" % (taskname, logfile))
return process.stdout
return process.stdout.decode("cp1252")


def filter_openfpga_output(vpr_output):
Expand Down

0 comments on commit 9e6f975

Please sign in to comment.