Bug 1341962 - Update ccache stats parser for version 3.3.3.
The "unsupported code directive" is added to the 'ccache -s' output in
https://github.com/ccache/ccache/commit/b6d7cf55028c4e23778fb02595e7d1ee6596a5a8
We need to teach our parser for it.
MozReview-Commit-ID: IrrJv7I7BVa
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -496,16 +496,17 @@ class CCacheStats(object):
('preprocessor_error', 'preprocessor error'),
('cant_use_pch', "can't use precompiled header"),
('compiler_missing', "couldn't find the compiler"),
('cache_file_missing', 'cache file missing'),
('bad_args', 'bad compiler arguments'),
('unsupported_lang', 'unsupported source language'),
('compiler_check_failed', 'compiler check failed'),
('autoconf', 'autoconf compile/link'),
+ ('unsupported_code_directive', 'unsupported code directive'),
('unsupported_compiler_option', 'unsupported compiler option'),
('out_stdout', 'output to stdout'),
('out_device', 'output to a non-regular file'),
('no_input', 'no input file'),
('bad_extra_file', 'error hashing extra file'),
('num_cleanups', 'cleanups performed'),
('cache_files', 'files in cache'),
('cache_size', 'cache size'),
--- a/python/mozbuild/mozbuild/test/controller/test_ccachestats.py
+++ b/python/mozbuild/mozbuild/test/controller/test_ccachestats.py
@@ -147,16 +147,38 @@ class TestCcacheStats(unittest.TestCase)
unsupported compiler option 322
no input file 309538
cleanups performed 1
files in cache 17358
cache size 15.4 GB
max cache size 17.2 GB
"""
+ STAT7 = """
+ cache directory /Users/tlin/.ccache
+ primary config /Users/tlin/.ccache/ccache.conf
+ secondary config (readonly) /usr/local/Cellar/ccache/3.3.3/etc/ccache.conf
+ cache hit (direct) 27035
+ cache hit (preprocessed) 13939
+ cache miss 62630
+ cache hit rate 39.55 %
+ called for link 1280
+ called for preprocessing 736
+ compile failed 550
+ preprocessor error 638
+ bad compiler arguments 20
+ autoconf compile/link 1751
+ unsupported code directive 2
+ no input file 2378
+ cleanups performed 1792
+ files in cache 3479
+ cache size 4.4 GB
+ max cache size 5.0 GB
+ """
+
def test_parse_garbage_stats_message(self):
self.assertRaises(ValueError, CCacheStats, self.STAT_GARBAGE)
def test_parse_zero_stats_message(self):
stats = CCacheStats(self.STAT0)
self.assertEqual(stats.cache_dir, "/home/tlin/.ccache")
self.assertEqual(stats.hit_rates(), (0, 0, 0))
@@ -192,17 +214,22 @@ class TestCcacheStats(unittest.TestCase)
stat4 = CCacheStats(self.STAT4)
stat5 = CCacheStats(self.STAT5)
stats_diff = stat5 - stat4
self.assertTrue(stat4)
self.assertTrue(stat5)
self.assertTrue(stats_diff)
def test_stats_version33(self):
+ # Test stats for 3.3.2.
stat3 = CCacheStats(self.STAT3)
stat6 = CCacheStats(self.STAT6)
stats_diff = stat6 - stat3
self.assertTrue(stat6)
self.assertTrue(stat3)
self.assertTrue(stats_diff)
+ # Test stats for 3.3.3.
+ stat7 = CCacheStats(self.STAT7)
+ self.assertTrue(stat7)
+
if __name__ == '__main__':
main()