def METHOD_NAME(ttype, test):
    # populate the table for one test
    # returns: html & markdown formatted text to be added to 'body'
    b = "<tr><td>Code " + ttype
    output = test.find("Results").find("Measurement").find("Value").text
    w = output.count("WARNING")
    w += output.count("warning")
    lines = output.split("\n")
    if "The rest of the test output was removed since it exceeds the threshold of" in lines[-2]:
        trunc1 = "at least "
        trunc2 = "(ctest truncated output)"
    else:
        trunc1 = ""
        trunc2 = ""
    if test.get("Status") == "passed":
        #print summary in b
        b += " succeeded with " + trunc1 + w.__str__() + " warnings " + trunc2
        if w == 0:  #nothing to print in the table, so skip it
            b += "</td></tr>\n"
            return b
    else:
        #print warnings and errors in b
        e = output.count("ERROR")
        e += output.count("error")
        b += " failed with %s%d warnings and %d errors %s" %(trunc1, w, e, trunc2)
    b += "<br>\n<table border=1 width=100%>\n"
    b += "<tr><th>Line</th><th>Text</th></tr>\n"
    # ERRORs
    # 242_n2813_mim_lf.exp:2278: --ERROR: Expected a type...
    # gcc errors look like ???
    l=0
    for line in lines:
        if ": --ERROR:" in line:
            l += 1
            c1 = line.find(":")
            c2 = line.find(":",c1+1)
            b += "<tr><td>" + line[c1+1:c2] + "</td><td>" + line[c2+4:] + "</td></tr>\n"
        elif ": error:" in line:
            l += 1
            c1 = line.find(":")
            c2 = line.find(":",c1+1)
            c3 = line.find(":",c2+1) #skip the character number
            b += "<tr><td>" + line[c1+1:c2] + "</td><td>" + line[c3+2:] + "</td></tr>\n"
        if l > 20:
            b += "<tr><td>-</td><td><font color=red>-- maximum number of errors printed --</font></td></tr>\n"
            break
    # WARNINGs
    # ap239_arm_lf.exp:2731: WARNING: Implicit downcast...
    # WARNING: in SELECT TYPE date_or_date... (multi-line warning)
    # compstructs.cc:28:23: warning: unused
    l=0
    for line in lines:
        if ": WARNING" in line:
            l += 1
            c1 = line.find(":")
            c2 = line.find(":",c1+1)
            b += "<tr><td>" + line[c1+1:c2] + "</td><td>" + line[c2+2:] + "</td></tr>\n"
        elif "WARNING" in line:
            b += "<tr><td>????</td><td>" + line + "</td></tr>\n"
        elif ": warning:" in line:
            l += 1
            c1 = line.find(":")
            c2 = line.find(":",c1+1)
            c3 = line.find(":",c2+1) #skip the character number
            b += "<tr><td>" + line[c1+1:c2] + "</td><td>" + line[c3+2:] + "</td></tr>\n"
        if l > 20:
            b += "<tr><td>-</td><td><font color=red>-- maximum number of warnings printed --</font></td></tr>\n"
            break
    b += "</table></td></tr>\n"
    return b