Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: tools/code_coverage/croc_test.py

Issue 660142: Add resilience in croc to a failed build (e.g. 0 stats generated).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/code_coverage/croc.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # 2 #
3 # Copyright 2009, Google Inc. 3 # Copyright 2009, Google Inc.
4 # All rights reserved. 4 # All rights reserved.
5 # 5 #
6 # Redistribution and use in source and binary forms, with or without 6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are 7 # modification, are permitted provided that the following conditions are
8 # met: 8 # met:
9 # 9 #
10 # * Redistributions of source code must retain the above copyright 10 # * Redistributions of source code must retain the above copyright
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 # Include files from the main dir and subdir 643 # Include files from the main dir and subdir
644 self.assertEqual(sorted(c.files), [ 644 self.assertEqual(sorted(c.files), [
645 '_/proj1/a.c', 645 '_/proj1/a.c',
646 '_/proj1/subdir/cherry.c', 646 '_/proj1/subdir/cherry.c',
647 '_/proj1/yes.c']) 647 '_/proj1/yes.c'])
648 648
649 # Excluded dir should have been pruned from the mock walk data dirnames. 649 # Excluded dir should have been pruned from the mock walk data dirnames.
650 # In the real os.walk() call this prunes the walk. 650 # In the real os.walk() call this prunes the walk.
651 self.assertEqual(self.mock_walk_return[0][1], ['subdir']) 651 self.assertEqual(self.mock_walk_return[0][1], ['subdir'])
652 652
653
654 def testEmptyTreeStats(self):
655 """Make sure we don't choke when absolutely nothing happened.
656
657 How we might hit this: bot compile error."""
658 c = self.cov_minimal
659 t = c.tree
660 t.stats_by_group['all'].AddDefaults()
661 self.assertEqual(t.stats_by_group, {
662 'all': { 'files_covered': 0,
663 'files_instrumented': 0,
664 'files_executable': 0,
665 'lines_covered': 0,
666 'lines_instrumented': 0,
667 'lines_executable': 0 }})
668
653 def testUpdateTreeStats(self): 669 def testUpdateTreeStats(self):
654 """Test UpdateTreeStats().""" 670 """Test UpdateTreeStats()."""
655 671
656 c = self.cov_minimal 672 c = self.cov_minimal
657 c.AddRule('.*_test', group='test') 673 c.AddRule('.*_test', group='test')
658 674
659 # Fill the files list 675 # Fill the files list
660 c.ParseLcovData([ 676 c.ParseLcovData([
661 'SF:/src/a.c', 677 'SF:/src/a.c',
662 'DA:10,1', 'DA:11,1', 'DA:20,0', 678 'DA:10,1', 'DA:11,1', 'DA:20,0',
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 # TODO: test: less important, since these are thin wrappers around other 784 # TODO: test: less important, since these are thin wrappers around other
769 # tested methods. 785 # tested methods.
770 # ParseConfig() 786 # ParseConfig()
771 # ParseLcovFile() 787 # ParseLcovFile()
772 # PrintTree() 788 # PrintTree()
773 789
774 #------------------------------------------------------------------------------ 790 #------------------------------------------------------------------------------
775 791
776 if __name__ == '__main__': 792 if __name__ == '__main__':
777 unittest.main() 793 unittest.main()
OLDNEW
« no previous file with comments | « tools/code_coverage/croc.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698