Write instr-gen build output to a log file, rather than stdout

This commit is contained in:
Rupert Swarbrick 2022-04-19 22:59:45 +01:00 committed by Rupert Swarbrick
parent 9dfdc800b7
commit 3e42d128cd

View file

@ -5,6 +5,7 @@
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import shutil
import sys
@ -21,12 +22,16 @@ def main() -> int:
args = parser.parse_args()
# Delete the output directory if it existed to ensure a clear build
# Delete the output directory if it existed to ensure a clean build, then
# create it. (The creation step is needed so that we can write our log file
# in the directory from the outset).
try:
shutil.rmtree(args.output)
except FileNotFoundError:
pass
os.makedirs(args.output, exist_ok=True)
cmd = (start_riscv_dv_run_cmd(args.verbose) +
['--co', '--steps=gen',
'--simulator', args.simulator,
@ -34,7 +39,8 @@ def main() -> int:
'--isa', args.isa,
'--end_signature_addr', args.end_signature_addr])
return run_one(args.verbose, cmd)
log_path = os.path.join(args.output, 'build.log')
return run_one(args.verbose, cmd, redirect_stdstreams=log_path)
if __name__ == '__main__':