GaudiTest.XMLResultStream Class Reference
Inheritance diagram for GaudiTest.XMLResultStream:
Collaboration diagram for GaudiTest.XMLResultStream:

Public Member Functions

def __init__ (self, arguments=None, args)
 
def WriteAnnotation (self, key, value)
 
def WriteResult (self, result)
 
def Summarize (self)
 
def __init__ (self, arguments=None, args)
 
def WriteAnnotation (self, key, value)
 
def WriteResult (self, result)
 
def Summarize (self)
 

Static Public Attributes

list arguments
 

Private Attributes

 _xmlFile
 
 _startTime
 
 _endTime
 
 _tree
 
 _site
 
 _Testing
 
 _StartDateTime
 
 _StartTestTime
 
 _TestList
 
 _EndDateTime
 End time elements. More...
 
 _EndTestTime
 
 _ElapsedMinutes
 

Detailed Description

An 'XMLResultStream' writes its output to a Ctest XML file.

The argument 'dir' is used to select the destination file for the XML
report.
The destination directory may already contain the report from a previous run
(for example of a different package), in which case it will be overrided to
with the new data.

Definition at line 1944 of file GaudiTest.py.

Constructor & Destructor Documentation

def GaudiTest.XMLResultStream.__init__ (   self,
  arguments = None,
  args 
)
Prepare the destination directory.

Creates the destination directory and store in it some preliminary
annotations .

Definition at line 1971 of file GaudiTest.py.

1971  def __init__(self, arguments = None, **args):
1972  """Prepare the destination directory.
1973 
1974  Creates the destination directory and store in it some preliminary
1975  annotations .
1976  """
1977  ResultStream.__init__(self, arguments, **args)
1978 
1979  self._xmlFile = os.path.join(self.dir, self.prefix + 'Test.xml')
1980 
1981  # add some global variable
1982  self._startTime = None
1983  self._endTime = None
1984  # Format the XML file if it not exists
1985  if not os.path.isfile(self._xmlFile):
1986  # check that the container directory exists and create it if not
1987  if not os.path.exists(os.path.dirname(self._xmlFile)):
1988  os.makedirs(os.path.dirname(self._xmlFile))
1989 
1990  newdataset = ET.Element("newdataset")
1991  self._tree = ET.ElementTree(newdataset)
1992  self._tree.write(self._xmlFile)
1993  else :
1994  # Read the xml file
1995  self._tree = ET.parse(self._xmlFile)
1996  newdataset = self._tree.getroot()
1997 
1998  # Find the corresponding site, if do not exist, create it
1999 
2000  #site = newdataset.find('Site[@BuildStamp="'+result["qmtest.start_time"]+'"][@OSPlatform="'+os.getenv("CMTOPT")+'"]')
2001  # I don't know why this syntax doesn't work. Maybe it is because of the python version. Indeed,
2002  # This works well in the python terminal. So I have to make a for:
2003  for site in newdataset.getiterator() :
2004  if site.get("OSPlatform") == os.uname()[4]: # and site.get("BuildStamp") == result["qmtest.start_time"] and:
2005  # Here we can add some variable to define the difference beetween 2 site
2006  self._site = site
2007  break
2008  else :
2009  site = None
2010 
2011 
2012  if site is None :
2013  import socket
2014  import multiprocessing
2015  attrib = {
2016  "BuildName" : os.getenv("CMTCONFIG"),
2017  "Name" : os.uname()[1] ,
2018  "Generator" : "QMTest "+qm.version ,
2019  "OSName" : os.uname()[0] ,
2020  "Hostname" : socket.gethostname() ,
2021  "OSRelease" : os.uname()[2] ,
2022  "OSVersion" :os.uname()[3] ,
2023  "OSPlatform" :os.uname()[4] ,
2024  "Is64Bits" : "unknown" ,
2025  "VendorString" : "unknown" ,
2026  "VendorID" :"unknown" ,
2027  "FamilyID" :"unknown" ,
2028  "ModelID" :"unknown" ,
2029  "ProcessorCacheSize" :"unknown" ,
2030  "NumberOfLogicalCPU" : str(multiprocessing.cpu_count()) ,
2031  "NumberOfPhysicalCPU" : "0" ,
2032  "TotalVirtualMemory" : "0" ,
2033  "TotalPhysicalMemory" : "0" ,
2034  "LogicalProcessorsPerPhysical" : "0" ,
2035  "ProcessorClockFrequency" : "0" ,
2036  }
2037  self._site = ET.SubElement(newdataset, "Site", attrib)
2038  self._Testing = ET.SubElement(self._site,"Testing")
2039 
2040  # Start time elements
2041  self._StartDateTime = ET.SubElement(self._Testing, "StartDateTime")
2042 
2043  self._StartTestTime = ET.SubElement(self._Testing, "StartTestTime")
2044 
2045 
2046  self._TestList = ET.SubElement(self._Testing, "TestList")
2047 
2048  ## End time elements
2049  self._EndDateTime = ET.SubElement(self._Testing, "EndDateTime")
2050 
2051 
2052  self._EndTestTime = ET.SubElement(self._Testing, "EndTestTime")
2053 
2054 
2055 
2056  self._ElapsedMinutes = ET.SubElement(self._Testing, "ElapsedMinutes")
2057 
2058 
2059  else : # We get the elements
2060  self._Testing = self._site.find("Testing")
2061  self._StartDateTime = self._Testing.find("StartDateTime")
2062  self._StartTestTime = self._Testing.find("StartTestTime")
2063  self._TestList = self._Testing.find("TestList")
2064  self._EndDateTime = self._Testing.find("EndDateTime")
2065  self._EndTestTime = self._Testing.find("EndTestTime")
2066  self._ElapsedMinutes = self._Testing.find("ElapsedMinutes")
2067 
2068  """
2069  # Add some non-QMTest attributes
2070  if "CMTCONFIG" in os.environ:
2071  self.WriteAnnotation("cmt.cmtconfig", os.environ["CMTCONFIG"])
2072  import socket
2073  self.WriteAnnotation("hostname", socket.gethostname())
2074  """
2075 
2076 
_EndDateTime
End time elements.
Definition: GaudiTest.py:2049
def __init__(self, arguments=None, args)
Definition: GaudiTest.py:1971
def GaudiTest.XMLResultStream.__init__ (   self,
  arguments = None,
  args 
)
Prepare the destination directory.

Creates the destination directory and store in it some preliminary
annotations .

Definition at line 1971 of file GaudiTest.py.

1971  def __init__(self, arguments = None, **args):
1972  """Prepare the destination directory.
1973 
1974  Creates the destination directory and store in it some preliminary
1975  annotations .
1976  """
1977  ResultStream.__init__(self, arguments, **args)
1978 
1979  self._xmlFile = os.path.join(self.dir, self.prefix + 'Test.xml')
1980 
1981  # add some global variable
1982  self._startTime = None
1983  self._endTime = None
1984  # Format the XML file if it not exists
1985  if not os.path.isfile(self._xmlFile):
1986  # check that the container directory exists and create it if not
1987  if not os.path.exists(os.path.dirname(self._xmlFile)):
1988  os.makedirs(os.path.dirname(self._xmlFile))
1989 
1990  newdataset = ET.Element("newdataset")
1991  self._tree = ET.ElementTree(newdataset)
1992  self._tree.write(self._xmlFile)
1993  else :
1994  # Read the xml file
1995  self._tree = ET.parse(self._xmlFile)
1996  newdataset = self._tree.getroot()
1997 
1998  # Find the corresponding site, if do not exist, create it
1999 
2000  #site = newdataset.find('Site[@BuildStamp="'+result["qmtest.start_time"]+'"][@OSPlatform="'+os.getenv("CMTOPT")+'"]')
2001  # I don't know why this syntax doesn't work. Maybe it is because of the python version. Indeed,
2002  # This works well in the python terminal. So I have to make a for:
2003  for site in newdataset.getiterator() :
2004  if site.get("OSPlatform") == os.uname()[4]: # and site.get("BuildStamp") == result["qmtest.start_time"] and:
2005  # Here we can add some variable to define the difference beetween 2 site
2006  self._site = site
2007  break
2008  else :
2009  site = None
2010 
2011 
2012  if site is None :
2013  import socket
2014  import multiprocessing
2015  attrib = {
2016  "BuildName" : os.getenv("CMTCONFIG"),
2017  "Name" : os.uname()[1] ,
2018  "Generator" : "QMTest "+qm.version ,
2019  "OSName" : os.uname()[0] ,
2020  "Hostname" : socket.gethostname() ,
2021  "OSRelease" : os.uname()[2] ,
2022  "OSVersion" :os.uname()[3] ,
2023  "OSPlatform" :os.uname()[4] ,
2024  "Is64Bits" : "unknown" ,
2025  "VendorString" : "unknown" ,
2026  "VendorID" :"unknown" ,
2027  "FamilyID" :"unknown" ,
2028  "ModelID" :"unknown" ,
2029  "ProcessorCacheSize" :"unknown" ,
2030  "NumberOfLogicalCPU" : str(multiprocessing.cpu_count()) ,
2031  "NumberOfPhysicalCPU" : "0" ,
2032  "TotalVirtualMemory" : "0" ,
2033  "TotalPhysicalMemory" : "0" ,
2034  "LogicalProcessorsPerPhysical" : "0" ,
2035  "ProcessorClockFrequency" : "0" ,
2036  }
2037  self._site = ET.SubElement(newdataset, "Site", attrib)
2038  self._Testing = ET.SubElement(self._site,"Testing")
2039 
2040  # Start time elements
2041  self._StartDateTime = ET.SubElement(self._Testing, "StartDateTime")
2042 
2043  self._StartTestTime = ET.SubElement(self._Testing, "StartTestTime")
2044 
2045 
2046  self._TestList = ET.SubElement(self._Testing, "TestList")
2047 
2048  ## End time elements
2049  self._EndDateTime = ET.SubElement(self._Testing, "EndDateTime")
2050 
2051 
2052  self._EndTestTime = ET.SubElement(self._Testing, "EndTestTime")
2053 
2054 
2055 
2056  self._ElapsedMinutes = ET.SubElement(self._Testing, "ElapsedMinutes")
2057 
2058 
2059  else : # We get the elements
2060  self._Testing = self._site.find("Testing")
2061  self._StartDateTime = self._Testing.find("StartDateTime")
2062  self._StartTestTime = self._Testing.find("StartTestTime")
2063  self._TestList = self._Testing.find("TestList")
2064  self._EndDateTime = self._Testing.find("EndDateTime")
2065  self._EndTestTime = self._Testing.find("EndTestTime")
2066  self._ElapsedMinutes = self._Testing.find("ElapsedMinutes")
2067 
2068  """
2069  # Add some non-QMTest attributes
2070  if "CMTCONFIG" in os.environ:
2071  self.WriteAnnotation("cmt.cmtconfig", os.environ["CMTCONFIG"])
2072  import socket
2073  self.WriteAnnotation("hostname", socket.gethostname())
2074  """
2075 
2076 
_EndDateTime
End time elements.
Definition: GaudiTest.py:2049
def __init__(self, arguments=None, args)
Definition: GaudiTest.py:1971

Member Function Documentation

def GaudiTest.XMLResultStream.Summarize (   self)

Definition at line 2226 of file GaudiTest.py.

2226  def Summarize(self):
2227 
2228  # Set the final end date time
2229  self._EndTestTime.text = str(self._endTime)
2230  self._EndDateTime.text = time.strftime("%b %d %H:%M %Z", time.localtime(self._endTime))
2231 
2232  # Compute the total duration
2233  if self._endTime and self._startTime:
2234  delta = self._endTime - self._startTime
2235  else:
2236  delta = 0
2237  self._ElapsedMinutes.text = str(delta/60)
2238 
2239  # Write into the file
2240  self._tree.write(self._xmlFile, "utf-8") #,True) in python 2.7 to add the xml header
2241 
def GaudiTest.XMLResultStream.Summarize (   self)

Definition at line 2226 of file GaudiTest.py.

2226  def Summarize(self):
2227 
2228  # Set the final end date time
2229  self._EndTestTime.text = str(self._endTime)
2230  self._EndDateTime.text = time.strftime("%b %d %H:%M %Z", time.localtime(self._endTime))
2231 
2232  # Compute the total duration
2233  if self._endTime and self._startTime:
2234  delta = self._endTime - self._startTime
2235  else:
2236  delta = 0
2237  self._ElapsedMinutes.text = str(delta/60)
2238 
2239  # Write into the file
2240  self._tree.write(self._xmlFile, "utf-8") #,True) in python 2.7 to add the xml header
2241 
def GaudiTest.XMLResultStream.WriteAnnotation (   self,
  key,
  value 
)

Definition at line 2077 of file GaudiTest.py.

2077  def WriteAnnotation(self, key, value):
2078  if key == "qmtest.run.start_time":
2079  if self._site.get("qmtest.run.start_time") is not None :
2080  return None
2081  self._site.set(str(key),str(value))
def WriteAnnotation(self, key, value)
Definition: GaudiTest.py:2077
def GaudiTest.XMLResultStream.WriteAnnotation (   self,
  key,
  value 
)

Definition at line 2077 of file GaudiTest.py.

2077  def WriteAnnotation(self, key, value):
2078  if key == "qmtest.run.start_time":
2079  if self._site.get("qmtest.run.start_time") is not None :
2080  return None
2081  self._site.set(str(key),str(value))
def WriteAnnotation(self, key, value)
Definition: GaudiTest.py:2077
def GaudiTest.XMLResultStream.WriteResult (   self,
  result 
)
Prepare the test result directory in the destination directory storing
into it the result fields.
A summary of the test result is stored both in a file in the test directory
and in the global summary file.

Definition at line 2082 of file GaudiTest.py.

2082  def WriteResult(self, result):
2083  """Prepare the test result directory in the destination directory storing
2084  into it the result fields.
2085  A summary of the test result is stored both in a file in the test directory
2086  and in the global summary file.
2087  """
2088  summary = {}
2089  summary["id"] = result.GetId()
2090  summary["outcome"] = result.GetOutcome()
2091  summary["cause"] = result.GetCause()
2092  summary["fields"] = result.keys()
2093  summary["fields"].sort()
2094 
2095 
2096  # Since we miss proper JSON support, I hack a bit
2097  for f in ["id", "outcome", "cause"]:
2098  summary[f] = str(summary[f])
2099  summary["fields"] = map(str, summary["fields"])
2100 
2101 
2102  # format
2103  # package_Test.xml
2104 
2105  if "qmtest.start_time" in summary["fields"]:
2106  haveStartDate = True
2107  else :
2108  haveStartDate = False
2109  if "qmtest.end_time" in summary["fields"]:
2110  haveEndDate = True
2111  else :
2112  haveEndDate = False
2113 
2114  # writing the start date time
2115  if haveStartDate:
2116  self._startTime = calendar.timegm(time.strptime(result["qmtest.start_time"], "%Y-%m-%dT%H:%M:%SZ"))
2117  if self._StartTestTime.text is None:
2118  self._StartDateTime.text = time.strftime("%b %d %H:%M %Z", time.localtime(self._startTime))
2119  self._StartTestTime.text = str(self._startTime)
2120  self._site.set("BuildStamp" , result["qmtest.start_time"] )
2121 
2122  #Save the end date time in memory
2123  if haveEndDate:
2124  self._endTime = calendar.timegm(time.strptime(result["qmtest.end_time"], "%Y-%m-%dT%H:%M:%SZ"))
2125 
2126 
2127  #add the current test to the test list
2128  tl = ET.Element("Test")
2129  tl.text = summary["id"]
2130  self._TestList.insert(0,tl)
2131 
2132  #Fill the current test
2133  Test = ET.Element("Test")
2134  if summary["outcome"] == "PASS":
2135  Test.set("Status", "passed")
2136  elif summary["outcome"] == "FAIL":
2137  Test.set("Status", "failed")
2138  elif summary["outcome"] == "SKIPPED" or summary["outcome"] == "UNTESTED":
2139  Test.set("Status", "skipped")
2140  elif summary["outcome"] == "ERROR":
2141  Test.set("Status", "failed")
2142  Name = ET.SubElement(Test, "Name",)
2143  Name.text = summary["id"]
2144  Results = ET.SubElement(Test, "Results")
2145 
2146  # add the test after the other test
2147  self._Testing.insert(3,Test)
2148 
2149  if haveStartDate and haveEndDate:
2150  # Compute the test duration
2151  delta = self._endTime - self._startTime
2152  testduration = str(delta)
2153  Testduration= ET.SubElement(Results,"NamedMeasurement")
2154  Testduration.set("name","Execution Time")
2155  Testduration.set("type","numeric/float" )
2156  value = ET.SubElement(Testduration, "Value")
2157  value.text = testduration
2158 
2159  #remove the fields that we store in a different way
2160  for n in ("qmtest.end_time", "qmtest.start_time", "qmtest.cause", "ExecTest.stdout"):
2161  if n in summary["fields"]:
2162  summary["fields"].remove(n)
2163 
2164  # Here we can add some NamedMeasurment which we know the type
2165  #
2166  if "ExecTest.exit_code" in summary["fields"] :
2167  summary["fields"].remove("ExecTest.exit_code")
2168  ExitCode= ET.SubElement(Results,"NamedMeasurement")
2169  ExitCode.set("name","exit_code")
2170  ExitCode.set("type","numeric/integer" )
2171  value = ET.SubElement(ExitCode, "Value")
2172  value.text = convert_xml_illegal_chars(result["ExecTest.exit_code"])
2173 
2174  TestStartTime= ET.SubElement(Results,"NamedMeasurement")
2175  TestStartTime.set("name","Start_Time")
2176  TestStartTime.set("type","String" )
2177  value = ET.SubElement(TestStartTime, "Value")
2178  if haveStartDate :
2179  value.text = escape_xml_illegal_chars(time.strftime("%b %d %H:%M %Z %Y", time.localtime(self._startTime)))
2180  else :
2181  value.text = ""
2182 
2183  TestEndTime= ET.SubElement(Results,"NamedMeasurement")
2184  TestEndTime.set("name","End_Time")
2185  TestEndTime.set("type","String" )
2186  value = ET.SubElement(TestEndTime, "Value")
2187  if haveStartDate :
2188  value.text = escape_xml_illegal_chars(time.strftime("%b %d %H:%M %Z %Y", time.localtime(self._endTime)))
2189  else :
2190  value.text = ""
2191 
2192  if summary["cause"]:
2193  FailureCause= ET.SubElement(Results,"NamedMeasurement")
2194  FailureCause.set("name", "Cause")
2195  FailureCause.set("type", "String" )
2196  value = ET.SubElement(FailureCause, "Value")
2197  value.text = escape_xml_illegal_chars(summary["cause"])
2198 
2199  #Fill the result
2200  fields = {}
2201  for field in summary["fields"] :
2202  fields[field] = ET.SubElement(Results, "NamedMeasurement")
2203  fields[field].set("type","String")
2204  fields[field].set("name",field)
2205  value = ET.SubElement(fields[field], "Value")
2206  # to escape the <pre></pre>
2207  if "<pre>" in result[field][0:6] :
2208  value.text = convert_xml_illegal_chars(result[field][5:-6])
2209  else :
2210  value.text = convert_xml_illegal_chars(result[field])
2211 
2212 
2213  if result.has_key("ExecTest.stdout" ) : #"ExecTest.stdout" in result :
2214  Measurement = ET.SubElement(Results, "Measurement")
2215  value = ET.SubElement(Measurement, "Value")
2216  if "<pre>" in result["ExecTest.stdout"][0:6] :
2217  value.text = convert_xml_illegal_chars(result["ExecTest.stdout"][5:-6])
2218  else :
2219  value.text = convert_xml_illegal_chars(result["ExecTest.stdout"])
2220 
2221 
2222  # write the file
2223  self._tree.write(self._xmlFile, "utf-8") #,True) in python 2.7 to add the xml header
2224 
2225 
def remove(file, logdir)
Definition: install.py:153
def WriteResult(self, result)
Definition: GaudiTest.py:2082
struct GAUDI_API map
Parametrisation class for map-like implementation.
def escape_xml_illegal_chars
Definition: GaudiTest.py:340
def convert_xml_illegal_chars(val)
Definition: GaudiTest.py:337
def GaudiTest.XMLResultStream.WriteResult (   self,
  result 
)
Prepare the test result directory in the destination directory storing
into it the result fields.
A summary of the test result is stored both in a file in the test directory
and in the global summary file.

Definition at line 2082 of file GaudiTest.py.

2082  def WriteResult(self, result):
2083  """Prepare the test result directory in the destination directory storing
2084  into it the result fields.
2085  A summary of the test result is stored both in a file in the test directory
2086  and in the global summary file.
2087  """
2088  summary = {}
2089  summary["id"] = result.GetId()
2090  summary["outcome"] = result.GetOutcome()
2091  summary["cause"] = result.GetCause()
2092  summary["fields"] = result.keys()
2093  summary["fields"].sort()
2094 
2095 
2096  # Since we miss proper JSON support, I hack a bit
2097  for f in ["id", "outcome", "cause"]:
2098  summary[f] = str(summary[f])
2099  summary["fields"] = map(str, summary["fields"])
2100 
2101 
2102  # format
2103  # package_Test.xml
2104 
2105  if "qmtest.start_time" in summary["fields"]:
2106  haveStartDate = True
2107  else :
2108  haveStartDate = False
2109  if "qmtest.end_time" in summary["fields"]:
2110  haveEndDate = True
2111  else :
2112  haveEndDate = False
2113 
2114  # writing the start date time
2115  if haveStartDate:
2116  self._startTime = calendar.timegm(time.strptime(result["qmtest.start_time"], "%Y-%m-%dT%H:%M:%SZ"))
2117  if self._StartTestTime.text is None:
2118  self._StartDateTime.text = time.strftime("%b %d %H:%M %Z", time.localtime(self._startTime))
2119  self._StartTestTime.text = str(self._startTime)
2120  self._site.set("BuildStamp" , result["qmtest.start_time"] )
2121 
2122  #Save the end date time in memory
2123  if haveEndDate:
2124  self._endTime = calendar.timegm(time.strptime(result["qmtest.end_time"], "%Y-%m-%dT%H:%M:%SZ"))
2125 
2126 
2127  #add the current test to the test list
2128  tl = ET.Element("Test")
2129  tl.text = summary["id"]
2130  self._TestList.insert(0,tl)
2131 
2132  #Fill the current test
2133  Test = ET.Element("Test")
2134  if summary["outcome"] == "PASS":
2135  Test.set("Status", "passed")
2136  elif summary["outcome"] == "FAIL":
2137  Test.set("Status", "failed")
2138  elif summary["outcome"] == "SKIPPED" or summary["outcome"] == "UNTESTED":
2139  Test.set("Status", "skipped")
2140  elif summary["outcome"] == "ERROR":
2141  Test.set("Status", "failed")
2142  Name = ET.SubElement(Test, "Name",)
2143  Name.text = summary["id"]
2144  Results = ET.SubElement(Test, "Results")
2145 
2146  # add the test after the other test
2147  self._Testing.insert(3,Test)
2148 
2149  if haveStartDate and haveEndDate:
2150  # Compute the test duration
2151  delta = self._endTime - self._startTime
2152  testduration = str(delta)
2153  Testduration= ET.SubElement(Results,"NamedMeasurement")
2154  Testduration.set("name","Execution Time")
2155  Testduration.set("type","numeric/float" )
2156  value = ET.SubElement(Testduration, "Value")
2157  value.text = testduration
2158 
2159  #remove the fields that we store in a different way
2160  for n in ("qmtest.end_time", "qmtest.start_time", "qmtest.cause", "ExecTest.stdout"):
2161  if n in summary["fields"]:
2162  summary["fields"].remove(n)
2163 
2164  # Here we can add some NamedMeasurment which we know the type
2165  #
2166  if "ExecTest.exit_code" in summary["fields"] :
2167  summary["fields"].remove("ExecTest.exit_code")
2168  ExitCode= ET.SubElement(Results,"NamedMeasurement")
2169  ExitCode.set("name","exit_code")
2170  ExitCode.set("type","numeric/integer" )
2171  value = ET.SubElement(ExitCode, "Value")
2172  value.text = convert_xml_illegal_chars(result["ExecTest.exit_code"])
2173 
2174  TestStartTime= ET.SubElement(Results,"NamedMeasurement")
2175  TestStartTime.set("name","Start_Time")
2176  TestStartTime.set("type","String" )
2177  value = ET.SubElement(TestStartTime, "Value")
2178  if haveStartDate :
2179  value.text = escape_xml_illegal_chars(time.strftime("%b %d %H:%M %Z %Y", time.localtime(self._startTime)))
2180  else :
2181  value.text = ""
2182 
2183  TestEndTime= ET.SubElement(Results,"NamedMeasurement")
2184  TestEndTime.set("name","End_Time")
2185  TestEndTime.set("type","String" )
2186  value = ET.SubElement(TestEndTime, "Value")
2187  if haveStartDate :
2188  value.text = escape_xml_illegal_chars(time.strftime("%b %d %H:%M %Z %Y", time.localtime(self._endTime)))
2189  else :
2190  value.text = ""
2191 
2192  if summary["cause"]:
2193  FailureCause= ET.SubElement(Results,"NamedMeasurement")
2194  FailureCause.set("name", "Cause")
2195  FailureCause.set("type", "String" )
2196  value = ET.SubElement(FailureCause, "Value")
2197  value.text = escape_xml_illegal_chars(summary["cause"])
2198 
2199  #Fill the result
2200  fields = {}
2201  for field in summary["fields"] :
2202  fields[field] = ET.SubElement(Results, "NamedMeasurement")
2203  fields[field].set("type","String")
2204  fields[field].set("name",field)
2205  value = ET.SubElement(fields[field], "Value")
2206  # to escape the <pre></pre>
2207  if "<pre>" in result[field][0:6] :
2208  value.text = convert_xml_illegal_chars(result[field][5:-6])
2209  else :
2210  value.text = convert_xml_illegal_chars(result[field])
2211 
2212 
2213  if result.has_key("ExecTest.stdout" ) : #"ExecTest.stdout" in result :
2214  Measurement = ET.SubElement(Results, "Measurement")
2215  value = ET.SubElement(Measurement, "Value")
2216  if "<pre>" in result["ExecTest.stdout"][0:6] :
2217  value.text = convert_xml_illegal_chars(result["ExecTest.stdout"][5:-6])
2218  else :
2219  value.text = convert_xml_illegal_chars(result["ExecTest.stdout"])
2220 
2221 
2222  # write the file
2223  self._tree.write(self._xmlFile, "utf-8") #,True) in python 2.7 to add the xml header
2224 
2225 
def remove(file, logdir)
Definition: install.py:153
def WriteResult(self, result)
Definition: GaudiTest.py:2082
struct GAUDI_API map
Parametrisation class for map-like implementation.
def escape_xml_illegal_chars
Definition: GaudiTest.py:340
def convert_xml_illegal_chars(val)
Definition: GaudiTest.py:337

Member Data Documentation

GaudiTest.XMLResultStream._ElapsedMinutes
private

Definition at line 2056 of file GaudiTest.py.

GaudiTest.XMLResultStream._EndDateTime
private

End time elements.

Definition at line 2049 of file GaudiTest.py.

GaudiTest.XMLResultStream._EndTestTime
private

Definition at line 2052 of file GaudiTest.py.

GaudiTest.XMLResultStream._endTime
private

Definition at line 1983 of file GaudiTest.py.

GaudiTest.XMLResultStream._site
private

Definition at line 2006 of file GaudiTest.py.

GaudiTest.XMLResultStream._StartDateTime
private

Definition at line 2041 of file GaudiTest.py.

GaudiTest.XMLResultStream._StartTestTime
private

Definition at line 2043 of file GaudiTest.py.

GaudiTest.XMLResultStream._startTime
private

Definition at line 1982 of file GaudiTest.py.

GaudiTest.XMLResultStream._Testing
private

Definition at line 2038 of file GaudiTest.py.

GaudiTest.XMLResultStream._TestList
private

Definition at line 2046 of file GaudiTest.py.

GaudiTest.XMLResultStream._tree
private

Definition at line 1991 of file GaudiTest.py.

GaudiTest.XMLResultStream._xmlFile
private

Definition at line 1979 of file GaudiTest.py.

list GaudiTest.XMLResultStream.arguments
static
Initial value:
1 = [
2  qm.fields.TextField(
3  name = "dir",
4  title = "Destination Directory",
5  description = ,
6  verbatim = "true",
7  default_value = ""),
8  qm.fields.TextField(
9  name = "prefix",
10  title = "Output File Prefix",
11  description = ,
12  verbatim = "true",
13  default_value = ""),
14  ]

Definition at line 1953 of file GaudiTest.py.


The documentation for this class was generated from the following file:
  • InstallArea/x86_64-slc6-gcc48-opt/qmtest_classes/GaudiTest.py