[PATCH] D24163: [scan-build-py] Increase precision of timestamp in report directory name
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 6 16:51:19 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280768: [scan-build-py] Increase precision of timestamp in report directory name (authored by dcoughlin).
Changed prior to commit:
https://reviews.llvm.org/D24163?vs=70458&id=70493#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24163
Files:
cfe/trunk/tools/scan-build-py/libscanbuild/report.py
cfe/trunk/tools/scan-build-py/tests/unit/test_report.py
Index: cfe/trunk/tools/scan-build-py/libscanbuild/report.py
===================================================================
--- cfe/trunk/tools/scan-build-py/libscanbuild/report.py
+++ cfe/trunk/tools/scan-build-py/libscanbuild/report.py
@@ -21,6 +21,7 @@
import json
import logging
import contextlib
+import datetime
from libscanbuild import duplicate_check
from libscanbuild.clang import get_version
@@ -34,7 +35,8 @@
hint -- could specify the parent directory of the output directory.
keep -- a boolean value to keep or delete the empty report directory. """
- stamp = time.strftime('scan-build-%Y-%m-%d-%H%M%S-', time.localtime())
+ stamp_format = 'scan-build-%Y-%m-%d-%H-%M-%S-%f-'
+ stamp = datetime.datetime.now().strftime(stamp_format)
parentdir = os.path.abspath(hint)
if not os.path.exists(parentdir):
Index: cfe/trunk/tools/scan-build-py/tests/unit/test_report.py
===================================================================
--- cfe/trunk/tools/scan-build-py/tests/unit/test_report.py
+++ cfe/trunk/tools/scan-build-py/tests/unit/test_report.py
@@ -146,3 +146,16 @@
def test_empty(self):
self.assertEqual(
sut.commonprefix([]), '')
+
+class ReportDirectoryTest(unittest.TestCase):
+
+ # Test that successive report directory names ascend in lexicographic
+ # order. This is required so that report directories from two runs of
+ # scan-build can be easily matched up to compare results.
+ def test_directory_name_comparison(self):
+ with libear.TemporaryDirectory() as tmpdir, \
+ sut.report_directory(tmpdir, False) as report_dir1, \
+ sut.report_directory(tmpdir, False) as report_dir2, \
+ sut.report_directory(tmpdir, False) as report_dir3:
+ self.assertLess(report_dir1, report_dir2)
+ self.assertLess(report_dir2, report_dir3)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24163.70493.patch
Type: text/x-patch
Size: 1899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160906/460a7f51/attachment.bin>
More information about the cfe-commits
mailing list