[PATCH] D16871: lit: Add StringMetricValue for TestResult.addMetric()
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 18:51:09 PST 2016
MatzeB retitled this revision from "lit: Allow arbitrary key/value data in a test result" to "lit: Add StringMetricValue for TestResult.addMetric()".
MatzeB updated this revision to Diff 48877.
Repository:
rL LLVM
http://reviews.llvm.org/D16871
Files:
utils/lit/lit/Test.py
Index: utils/lit/lit/Test.py
===================================================================
--- utils/lit/lit/Test.py
+++ utils/lit/lit/Test.py
@@ -1,6 +1,10 @@
import os
from xml.sax.saxutils import escape
from json import JSONEncoder
+try:
+ basestring
+except NameError:
+ basestring = str # python3 compatibility
# Test result codes.
@@ -76,6 +80,16 @@
def todata(self):
return self.value
+class StringMetricValue(MetricValue):
+ def __init__(self, value):
+ self.value = value
+
+ def format(self):
+ return self.value
+
+ def todata(self):
+ return self.value
+
class JSONMetricValue(MetricValue):
"""
JSONMetricValue is used for types that are representable in the output
@@ -106,6 +120,8 @@
return IntMetricValue(value)
elif isinstance(value, float):
return RealMetricValue(value)
+ elif isinstance(value, basestring):
+ return StringMetricValue(value)
else:
# Try to create a JSONMetricValue and let the constructor throw
# if value is not a valid type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16871.48877.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160224/f5a62b3b/attachment.bin>
More information about the llvm-commits
mailing list