Commit a312c443 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

add cpuinfo to the test annotations generated by CTestXML2HTML

parent 67974c92
......@@ -385,6 +385,32 @@ class TestOrganizer :
return None
def get_cpuinfo():
'''
Return the CPU information of the machine as a list of dictionaries.
Only Linux is supported.
'''
cpuinfo = []
try:
current = {}
for l in open('/proc/cpuinfo'):
try:
k, v = map(str.strip, l.split(':', 1))
if k == 'processor':
current = {k: v}
cpuinfo.append(current)
elif k == 'flags':
current[k] = v.split()
else:
current[k] = v
except ValueError:
pass # ignore lines without a ':'
except IOError:
pass # ignore missing /proc/cpuinfo
return cpuinfo
def updateAnnotations(site,Testing,outputTemp,annotationsList):
"""
Update the global annotation file with the data of the current test.
......@@ -418,6 +444,16 @@ def updateAnnotations(site,Testing,outputTemp,annotationsList):
annotations["qmtest.run.username"] = cleanWebChar(site.get("qmtest.run.username"))
if site.get("qmtest.run.command_line") is not None:
annotations["qmtest.run.command_line"] = [cleanWebChar(site.get("qmtest.run.command_line"))]
# FIXME: we assume the conversion is run on the same machine as the test
cpuinfo = get_cpuinfo()
if cpuinfo:
annotations['cpuinfo'] = [
'ncpus: {0}'.format(len(cpuinfo)),
'model name: {0}'.format(cpuinfo[0]['model name']),
'flags: {0}'.format(' '.join(cpuinfo[0]['flags'])),
]
else :
annotations = annotationsList.pop(0)
#update the start time
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment