From 632a8d3bef49b63ef9b2e923e1ad408d8b14e474 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 8 May 2026 11:13:02 +0200 Subject: [PATCH 1/4] Log and present mcdisplay output pr. example instr --- tools/Python/mctest/main.template | 12 +++++++++--- tools/Python/mctest/mctest.py | 21 ++++++++++++++++----- tools/Python/mctest/mcviewtest.py | 26 ++++++++++++++++++++------ 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/tools/Python/mctest/main.template b/tools/Python/mctest/main.template index 2ddb49bedf..e4629ae8fd 100644 --- a/tools/Python/mctest/main.template +++ b/tools/Python/mctest/main.template @@ -47,11 +47,17 @@ a:visited { color: lightgrey; background-color: transparent; text-decoration: no {%- for c in row %} {%- if loop.index0 > 0 %} {%- if c.0 == 1 %} - C:{{ c.1 }}/R:{{ c.2 }}
I={{ c.3 }} ({{ c.4 }})
+ C:{{ c.1 }}/R:{{ c.2 }}
I={{ c.3 }} ({{ c.4 }})
+
{{ c.6 }} + {%- elif c.0 == 2 %} - C:{{ c.1 }}/R:{{ c.2 }}
I={{ c.3 }} ({{ c.4 }})
+ C:{{ c.1 }}/R:{{ c.2 }}
I={{ c.3 }} ({{ c.4 }})
+
{{ c.6 }} + {%- elif c.0 == 3 %} - C:{{ c.1 }} + C:{{ c.1 }} +
{{ c.6 }} + {%- else %} {{ c.1}} diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index 06c1dc71f3..fa27a2792a 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -67,6 +67,7 @@ def __init__(self, sourcefile, localfile, parvals=None, detector=None, targetval self.linted = None self.compiled = None + self.displayed = None self.compiletime = None self.didrun = None self.runtime = None @@ -88,6 +89,7 @@ def get_json_repr(self): "linted" : self.linted, "compiled" : self.compiled, "compiletime" : self.compiletime, + "displayed" : self.displayed, "didrun" : self.didrun, "runtime" : self.runtime, "errmsg" : self.errmsg, @@ -340,10 +342,13 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, compfilt formatstr = "%-" + "%ds: " % maxnamelen + \ "{:3d}.".format(math.floor(test.compiletime)) + str(test.compiletime-int(test.compiletime)).split('.')[1][:2] logging.info(formatstr % test.get_display_name()) - # Run mcdisplay if not openacc - if not openacc: - cmd = mccode_config.configuration["MCDISPLAY"]+'-classic --nobrowse %s -y -d display > displaylog.txt 2>&1' % (test.instrname+'.instr') - utils.run_subtool_noread(cmd, cwd=join(testdir, test.instrname), timeout=compilemax) + # Run mcdisplay (single particle only) + cmd = mccode_config.configuration["MCDISPLAY"]+'-classic --nobrowse %s -y -n1 -d display > displaylog.txt 2>&1' % (test.instrname+'.instr') + retcode = utils.run_subtool_noread(cmd, cwd=join(testdir, test.instrname), timeout=compilemax) + if retcode[0]==0: + test.displayed = True + else: + test.displayed = False else: if lint: formatstr = "%-" + "%ds: Linted using using:\n" % maxnamelen @@ -379,7 +384,13 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, compfilt failed=True logging.info(formatstr % test.instrname) continue - + if test.displayed: + formatstr = "%-" + "%ds: Display OK" % (maxnamelen+1) + logging.info(formatstr % test.instrname) + else: + formatstr = "%-" + "%ds: Display FAILED" % (maxnamelen+1) + logging.info(formatstr % test.instrname) + # runable tests have testnb > 0 if test.testnb <= 0: formatstr = "%-" + "%ds: NO TEST" % (maxnamelen+1) diff --git a/tools/Python/mctest/mcviewtest.py b/tools/Python/mctest/mcviewtest.py index d76ea07773..2a52fa78e4 100755 --- a/tools/Python/mctest/mcviewtest.py +++ b/tools/Python/mctest/mcviewtest.py @@ -67,24 +67,38 @@ def get_cell_tuple(cellobj, refval=None): label = cellobj["localfile"].split("\\"); label=label[len(label)-3]; + # URL for test output data in success (i.e. 1/ or 2/ etc.) url = label + "/" + cellobj["instrname"] + "/" + str(cellobj["testnb"]) + "/" + # URL for compiling instrs - without data burl = label + "/" + cellobj["instrname"] + "/" + # URL for instruments that failed compiling curl = label + "/" + cellobj["instrname"] + "/compile_stdout.txt" - + # Display URL if display succeeded + durl = label + "/" + cellobj["instrname"] + "/display/index.html" + # Display URL if display failed + fdurl = label + "/" + cellobj["instrname"] + "/displaylog.txt" + + if not cellobj["displayed"]: + display="DISPLAY: FAILED! (log)" + displayurl=fdurl + else: + display="DISPLAY: OK (link)" + displayurl=durl + if not cellobj["compiled"]: if cellobj["linted"]: state = 4 - return (state, "C-linter output", "", "", "", curl) + return (state, "C-linter output", "", "", "", curl, "", "") else: state = 4 - return (state, "! Compile error !", "", "", "", curl) + return (state, "! Compile error !", "", "", "", curl, "", "") elif not cellobj["didrun"]: state = 3 compiletime = "%.2f s" % cellobj["compiletime"] if cellobj["testnb"] > 1: # if this is a second test of the same instr, it was already compiled, thus 0.001 compiletime is nonsense compiletime = "" - return (state, compiletime, "", "", "", burl) + return (state, compiletime, "", "", "", burl, display, displayurl) elif cellobj["testval"]==None: testval = "missing" runtime = "%.2f s" % cellobj["runtime"] @@ -92,7 +106,7 @@ def get_cell_tuple(cellobj, refval=None): if cellobj["testnb"] > 1: compiletime = "" state = 2 - return (state, compiletime, runtime, testval, "", url) + return (state, compiletime, runtime, testval, "", url, display, displayurl) else: testval = "%.2g" % float(cellobj["testval"]) runtime = "%.2f s" % cellobj["runtime"] @@ -120,7 +134,7 @@ def get_cell_tuple(cellobj, refval=None): else: refp = "%2.f" % refp + "%" - return (state, compiletime, runtime, testval, refp, url) + return (state, compiletime, runtime, testval, refp, url, display, displayurl) def get_empty_cell_tuple(tag=None): ''' return a "state_four" black cell, optionally with a tag, this could be "no ref" or "no test" etc. ''' From 1461928aca5cc7ccc7ad65cdeb061d60cd51e287 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 8 May 2026 12:00:23 +0200 Subject: [PATCH 2/4] Only provide display info on 1st test entry --- tools/Python/mctest/mctest.py | 1 + tools/Python/mctest/mcviewtest.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index fa27a2792a..49c4e95e0b 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -115,6 +115,7 @@ def load(self,testnb=0): self.linted=obj['linted'] self.compiled=obj['compiled'] self.compiletime=obj['compiletime'] + self.displayed=obj['displayed'] self.didrun=obj['didrun'] self.runtime=obj['runtime'] self.errmsg=obj['errmsg'] diff --git a/tools/Python/mctest/mcviewtest.py b/tools/Python/mctest/mcviewtest.py index 2a52fa78e4..a392dd6545 100755 --- a/tools/Python/mctest/mcviewtest.py +++ b/tools/Python/mctest/mcviewtest.py @@ -78,12 +78,16 @@ def get_cell_tuple(cellobj, refval=None): # Display URL if display failed fdurl = label + "/" + cellobj["instrname"] + "/displaylog.txt" - if not cellobj["displayed"]: - display="DISPLAY: FAILED! (log)" - displayurl=fdurl + if cellobj["testnb"] <= 1: + if not cellobj["displayed"]: + display="DISPLAY: FAILED! (log)" + displayurl=fdurl + else: + display="DISPLAY: OK (link)" + displayurl=durl else: - display="DISPLAY: OK (link)" - displayurl=durl + display="" + displayurl="" if not cellobj["compiled"]: if cellobj["linted"]: From ae3e4b66690054fe320a8952e2bdd0e77712bd2a Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 8 May 2026 12:26:42 +0200 Subject: [PATCH 3/4] Only log display status once to output --- tools/Python/mctest/mctest.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index 49c4e95e0b..a8509e99b9 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -385,12 +385,13 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, compfilt failed=True logging.info(formatstr % test.instrname) continue - if test.displayed: - formatstr = "%-" + "%ds: Display OK" % (maxnamelen+1) - logging.info(formatstr % test.instrname) - else: - formatstr = "%-" + "%ds: Display FAILED" % (maxnamelen+1) - logging.info(formatstr % test.instrname) + if testnb <=1: + if test.displayed: + formatstr = "%-" + "%ds: Display OK" % (maxnamelen+1) + logging.info(formatstr % test.instrname) + else: + formatstr = "%-" + "%ds: Display FAILED" % (maxnamelen+1) + logging.info(formatstr % test.instrname) # runable tests have testnb > 0 if test.testnb <= 0: From 76caa33e990fc9688cb4784980a65188e6121399 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 8 May 2026 12:36:20 +0200 Subject: [PATCH 4/4] Member of test struct --- tools/Python/mctest/mctest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index a8509e99b9..cce7be42ce 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -385,7 +385,7 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, compfilt failed=True logging.info(formatstr % test.instrname) continue - if testnb <=1: + if test.testnb <= 1: if test.displayed: formatstr = "%-" + "%ds: Display OK" % (maxnamelen+1) logging.info(formatstr % test.instrname)