Skip to content

Commit 20703d3

Browse files
authored
Merge pull request #2161 from willend/main
Update mctest with log of attained test value if test ran
2 parents 9a12c8d + 3afc245 commit 20703d3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/Python/mctest/mctest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,7 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, version=
340340
test.runtime = t2 - t1
341341

342342
# log to terminal
343-
if test.didrun:
344-
formatstr = "%-" + "%ds: " % (maxnamelen+1) + \
345-
"{:3d}.".format(math.floor(test.runtime)) + str(test.runtime-int(test.runtime)).split('.')[1][:2]
346-
logging.info(formatstr % test.get_display_name())
347-
else:
343+
if not test.didrun:
348344
formatstr = "%-" + "%ds: RUNTIME ERROR" % (maxnamelen+1)
349345
logging.info(formatstr % instrname + ", " + cmd)
350346
failed=True
@@ -369,6 +365,13 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, version=
369365
except:
370366
test.testval=-1
371367
failed=True
368+
369+
if test.didrun and not failed:
370+
formatstr = "%-" + "%ds: " % (maxnamelen+1) + \
371+
"{:3d}.".format(math.floor(test.runtime)) + str(test.runtime-int(test.runtime)).split('.')[1][:2]
372+
print(formatstr)
373+
logging.info(formatstr % test.get_display_name() + " [val: " + str(test.testval) + " / " + str(test.targetval) + " = " + str(round(100.0*test.testval/test.targetval)) + " %]")
374+
372375
# save test result to disk
373376
test.testcomplete = True
374377
test.save(infolder=join(testdir, test.instrname))

0 commit comments

Comments
 (0)