Skip to content

Commit

Permalink
Catch JSONDecodeError and printout some debug info (#291)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <brawner@gmail.com>
  • Loading branch information
brawner authored Oct 20, 2020
1 parent 3064fbc commit a5fb311
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def main(argv=sys.argv[1:]):
args = parser.parse_args(argv)
args.command = command

print("Executing benchmark test command: %s\n\n" % ' '.join(args.command))
res = subprocess.run(args.command)
print("\n\nTest command returned result status {}".format(res.returncode))

try:
with open(args.result_file_in, 'r') as in_file:
Expand All @@ -94,7 +96,17 @@ def main(argv=sys.argv[1:]):
open(args.result_file_out, 'w').close()
return res.returncode

in_data = json.loads(in_text)
try:
in_data = json.loads(in_text)
except json.decoder.JSONDecodeError as e:
print(
'Failure parsing performance results file at: %s' % args.result_file_in,
file=sys.stderr)
print(e)
if res.returncode == 0:
res.returncode = 1
return res.returncode

overlay_data = None
if args.result_file_overlay:
with open(args.result_file_overlay, 'r') as overlay_file:
Expand Down

0 comments on commit a5fb311

Please sign in to comment.