--- a/python/mozbuild/mozbuild/controller/building.py +++ b/python/mozbuild/mozbuild/controller/building.py @@ -1070,6 +1070,8 @@ class CCacheStats(object): ts = time.strptime(raw_value, "%c") return int(time.mktime(ts)) except ValueError: + if raw_value == "never": + return 0 pass value = raw_value.split() --- a/python/mozbuild/mozbuild/test/controller/test_ccachestats.py +++ b/python/mozbuild/mozbuild/test/controller/test_ccachestats.py @@ -356,6 +356,26 @@ Primary storage: timestamp=time.strftime("%c") ) + STAT12 = """ +Summary: + Cache directory: /home/suer/.ccache + Primary config: /home/suer/.ccache/ccache.conf + Secondary config: /etc/ccache.conf + Stats updated: never + Hits: 0 / 0 + Direct: 0 / 0 + Preprocessed: 0 / 0 + Misses: 0 + Direct: 0 + Preprocessed: 0 +Primary storage: + Hits: 0 / 0 + Misses: 0 + Cache size (GB): 0.00 / 5.00 (0.00 %) + Files: 0 + Cleanups: 16 + """ + def test_parse_garbage_stats_message(self): self.assertRaises(ValueError, CCacheStats, self.STAT_GARBAGE) @@ -438,6 +458,9 @@ Primary storage: stat11 = CCacheStats(self.STAT11, True) self.assertTrue(stat11) + stat12 = CCacheStats(self.STAT12, True) + self.assertTrue(stat12) + if __name__ == "__main__": main()