summaryrefslogtreecommitdiffstats
path: root/tools/code_coverage/croc_test.py
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 18:50:39 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 18:50:39 +0000
commite2027b09db15ed5ecf0a481a006655ecd5fd097a (patch)
tree7bce88ade113400a78bd9cfcfce0475f45cfb883 /tools/code_coverage/croc_test.py
parent8400e0328996ef46e390903b6c378549f7b13aa3 (diff)
downloadchromium_src-e2027b09db15ed5ecf0a481a006655ecd5fd097a.zip
chromium_src-e2027b09db15ed5ecf0a481a006655ecd5fd097a.tar.gz
chromium_src-e2027b09db15ed5ecf0a481a006655ecd5fd097a.tar.bz2
Add resilience in croc to a failed build (e.g. 0 stats generated).
Makes a failure case suck less. Review URL: http://codereview.chromium.org/660142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/code_coverage/croc_test.py')
-rw-r--r--tools/code_coverage/croc_test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/code_coverage/croc_test.py b/tools/code_coverage/croc_test.py
index 035fcf9..36fc546 100644
--- a/tools/code_coverage/croc_test.py
+++ b/tools/code_coverage/croc_test.py
@@ -650,6 +650,22 @@ GetStat('nosuch') = 42
# In the real os.walk() call this prunes the walk.
self.assertEqual(self.mock_walk_return[0][1], ['subdir'])
+
+ def testEmptyTreeStats(self):
+ """Make sure we don't choke when absolutely nothing happened.
+
+ How we might hit this: bot compile error."""
+ c = self.cov_minimal
+ t = c.tree
+ t.stats_by_group['all'].AddDefaults()
+ self.assertEqual(t.stats_by_group, {
+ 'all': { 'files_covered': 0,
+ 'files_instrumented': 0,
+ 'files_executable': 0,
+ 'lines_covered': 0,
+ 'lines_instrumented': 0,
+ 'lines_executable': 0 }})
+
def testUpdateTreeStats(self):
"""Test UpdateTreeStats()."""