This is an archive of the discontinued LLVM Phabricator instance.

lit: Add StringMetricValue for TestResult.addMetric()
AbandonedPublic

Authored by MatzeB on Feb 3 2016, 5:38 PM.

Details

Summary

The test-suite will use this to attach additional infos like the md5sum
of the executable to the test result. We should not use the existing
addMetric() interface for this as an md5sum is not really a metric.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 46855.Feb 3 2016, 5:38 PM
MatzeB retitled this revision from to lit: Allow arbitrary key/value data in a test result.
MatzeB updated this object.
MatzeB added reviewers: ddunbar, cmatthews, EricWF.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
ddunbar edited edge metadata.Feb 10 2016, 3:22 PM
ddunbar added a subscriber: ddunbar.

I would just use addMetric for this. I see a binary signature as just
another kind of metric data, sometimes people even use the term "measure"
to the process of computing a hash signature for a binary.

If you really dislike the term metric, I would probably rather just change
the one method name than have two methods that basically do the same job.

Also, +1 on getting test suite support for reporting binary hashes!

  • Daniel

I would just use addMetric for this. I see a binary signature as just
another kind of metric data, sometimes people even use the term "measure"
to the process of computing a hash signature for a binary.

I'm sure mathematicians will cry seeing the terms used like this, or they get nerd sniped into defining a metric space on md5sums :)

Anyway my thinking was mainly that analysis software can know which things we can compute deltas between runs and plot graphs and which information does not fit this category. Then again we can just check whether the datatype is a number or not, so I'll go with addMetric() then if an addData() is deemed unnecessary.

PS: For the record: lnt already collects md5sums, I just think that it would be more natural to collect such data with the test-suite lit runner (also because I like to run custom analysis scripts on the test-suite/lit output).

I just tried changing my code to use addMetric to store the md5sum, but that fails: TypeError: unexpected metric value: '577ee3bb6917176a1130303424ed1aea' because only subclasses of IntMetricValue and RealMetricValue are accepted.

So this patch seems the only way to store those, it is ok to push it?

EricWF edited edge metadata.Feb 19 2016, 4:19 PM

I just tried changing my code to use addMetric to store the md5sum, but that fails: TypeError: unexpected metric value: '577ee3bb6917176a1130303424ed1aea' because only subclasses of IntMetricValue and RealMetricValue are accepted.

So this patch seems the only way to store those, it is ok to push it?

Why don't you define a MetricValue subclass that works for your data?

Right, that is what I expected, something like MetricValueSignature that
clients would anticipate is a unique but otherwise meaningless signature
for some part of the test (and display accordingly, maybe by highlighting
when it changes).

MatzeB updated this revision to Diff 48877.Feb 23 2016, 6:51 PM
MatzeB retitled this revision from lit: Allow arbitrary key/value data in a test result to lit: Add StringMetricValue for TestResult.addMetric().
MatzeB edited edge metadata.
MatzeB abandoned this revision.Feb 29 2016, 12:48 PM

Turns out you don't need a special StringMetricValue as the default fallback JSONMetricValue works as well here. Discovered because James
independently created a pretty similar patch for the testsuite (http://reviews.llvm.org/rL262220) in the meantime...