5 import configparser
as ConfigParser
10 class DummyFormat(lit
.formats
.FileBasedTest
):
11 def execute(self
, test
, lit_config
):
12 # In this dummy format, expect that each test file is actually just a
13 # .ini format dump of the results to report.
15 source_path
= test
.getSourcePath()
17 cfg
= ConfigParser
.ConfigParser()
20 # Create the basic test result.
21 result_code
= cfg
.get('global', 'result_code')
22 result_output
= cfg
.get('global', 'result_output')
23 result
= lit
.Test
.Result(getattr(lit
.Test
, result_code
),
26 # Load additional metrics.
27 for key
,value_str
in cfg
.items('results'):
28 value
= eval(value_str
)
29 if isinstance(value
, int):
30 metric
= lit
.Test
.IntMetricValue(value
)
31 elif isinstance(value
, float):
32 metric
= lit
.Test
.RealMetricValue(value
)
34 raise RuntimeError("unsupported result type")
35 result
.addMetric(key
, metric
)