2070 """Prepare the test result directory in the destination directory storing
2071 into it the result fields.
2072 A summary of the test result is stored both in a file in the test directory
2073 and in the global summary file.
2076 summary[
"id"] = result.GetId()
2077 summary[
"outcome"] = result.GetOutcome()
2078 summary[
"cause"] = result.GetCause()
2079 summary[
"fields"] = result.keys()
2080 summary[
"fields"].sort()
2084 for f
in [
"id",
"outcome",
"cause"]:
2085 summary[f] = str(summary[f])
2086 summary[
"fields"] =
map(str, summary[
"fields"])
2092 if "qmtest.start_time" in summary[
"fields"]:
2093 haveStartDate =
True
2095 haveStartDate =
False
2096 if "qmtest.end_time" in summary[
"fields"]:
2103 self.
_startTime = calendar.timegm(time.strptime(result[
"qmtest.start_time"],
"%Y-%m-%dT%H:%M:%SZ"))
2104 if self._StartTestTime.text
is None:
2105 self._StartDateTime.text = time.strftime(
"%b %d %H:%M %Z", time.localtime(self.
_startTime))
2106 self._StartTestTime.text = str(self.
_startTime)
2107 self._site.set(
"BuildStamp" , result[
"qmtest.start_time"] )
2111 self.
_endTime = calendar.timegm(time.strptime(result[
"qmtest.end_time"],
"%Y-%m-%dT%H:%M:%SZ"))
2115 tl = ET.Element(
"Test")
2116 tl.text = summary[
"id"]
2117 self._TestList.insert(0,tl)
2120 Test = ET.Element(
"Test")
2121 if summary[
"outcome"] ==
"PASS":
2122 Test.set(
"Status",
"passed")
2123 elif summary[
"outcome"] ==
"FAIL":
2124 Test.set(
"Status",
"failed")
2125 elif summary[
"outcome"] ==
"SKIPPED" or summary[
"outcome"] ==
"UNTESTED":
2126 Test.set(
"Status",
"skipped")
2127 elif summary[
"outcome"] ==
"ERROR":
2128 Test.set(
"Status",
"failed")
2129 Name = ET.SubElement(Test,
"Name",)
2130 Name.text = summary[
"id"]
2131 Results = ET.SubElement(Test,
"Results")
2134 self._Testing.insert(3,Test)
2136 if haveStartDate
and haveEndDate:
2139 testduration = str(delta)
2140 Testduration= ET.SubElement(Results,
"NamedMeasurement")
2141 Testduration.set(
"name",
"Execution Time")
2142 Testduration.set(
"type",
"numeric/float" )
2143 value = ET.SubElement(Testduration,
"Value")
2144 value.text = testduration
2147 for n
in (
"qmtest.end_time",
"qmtest.start_time",
"qmtest.cause",
"ExecTest.stdout"):
2148 if n
in summary[
"fields"]:
2149 summary[
"fields"].
remove(n)
2153 if "ExecTest.exit_code" in summary[
"fields"] :
2154 summary[
"fields"].
remove(
"ExecTest.exit_code")
2155 ExitCode= ET.SubElement(Results,
"NamedMeasurement")
2156 ExitCode.set(
"name",
"exit_code")
2157 ExitCode.set(
"type",
"numeric/integer" )
2158 value = ET.SubElement(ExitCode,
"Value")
2161 TestStartTime= ET.SubElement(Results,
"NamedMeasurement")
2162 TestStartTime.set(
"name",
"Start_Time")
2163 TestStartTime.set(
"type",
"String" )
2164 value = ET.SubElement(TestStartTime,
"Value")
2170 TestEndTime= ET.SubElement(Results,
"NamedMeasurement")
2171 TestEndTime.set(
"name",
"End_Time")
2172 TestEndTime.set(
"type",
"String" )
2173 value = ET.SubElement(TestEndTime,
"Value")
2179 if summary[
"cause"]:
2180 FailureCause= ET.SubElement(Results,
"NamedMeasurement")
2181 FailureCause.set(
"name",
"Cause")
2182 FailureCause.set(
"type",
"String" )
2183 value = ET.SubElement(FailureCause,
"Value")
2188 for field
in summary[
"fields"] :
2189 fields[field] = ET.SubElement(Results,
"NamedMeasurement")
2190 fields[field].set(
"type",
"String")
2191 fields[field].set(
"name",field)
2192 value = ET.SubElement(fields[field],
"Value")
2194 if "<pre>" in result[field][0:6] :
2200 if result.has_key(
"ExecTest.stdout" ) :
2201 Measurement = ET.SubElement(Results,
"Measurement")
2202 value = ET.SubElement(Measurement,
"Value")
2203 if "<pre>" in result[
"ExecTest.stdout"][0:6] :
2210 self._tree.write(self.
_xmlFile,
"utf-8")