Page MenuHomePhabricator

[scan-build-py] Increase precision of timestamp in report directory name
ClosedPublic

Authored by dcoughlin on Sep 1 2016, 3:22 PM.

Details

Summary

This patch improves compatibility with the perl version of scan-build.

The perl version of scan-build produces output report directories with increasing lexicographic ordering. This ordering is relied on by the CmpRuns.py tool in utils/analyzer when comparing results for build commands with multiple steps. That tool tries to line up the output directory for each step between different runs of the analyzer based on the increasing directory name.

The python version of scan-build uses tmp file.mkdtemp() with a time stamp prefix to create report directories. The timestamp has a 1-second precision. This means that when analysis of a single build step takes less than a second the ordering property that CmpRuns.py expects will sometimes not hold, depending on the timing and the random suffix generated by mkdtemp(). Ultimately this causes CmpRuns to incorrectly correlate results from build steps and report spurious differences between runs.

To fix this, I propose increasing the precision of the timestamp used in scan-build-py to the microsecond level. This approach still has the same underlying issue -- but in practice, analysis of any build step is unlikely to take less than a millisecond.

What do you think?

Diff Detail

Repository
rL LLVM

Event Timeline

dcoughlin updated this revision to Diff 70077.Sep 1 2016, 3:22 PM
dcoughlin retitled this revision from to [scan-build-py] Increase precision of timestamp in report directory name.
dcoughlin updated this object.
dcoughlin added a reviewer: rizsotto.mailinglist.
dcoughlin added a subscriber: cfe-commits.
NoQ added a subscriber: NoQ.Sep 2 2016, 4:32 AM

looks good to me. i like the test. :) but would keep the pep8 cleanness.

tools/scan-build-py/libscanbuild/report.py
38 ↗(On Diff #70077)

this line length's is 80, which breaks the pep8 check. (would kill some of the -)

dcoughlin updated this revision to Diff 70458.Sep 6 2016, 12:56 PM
dcoughlin edited edge metadata.

Fix the pep8 79-column violation.

This revision was automatically updated to reflect the committed changes.