OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Generate and process code coverage. | 6 """Generate and process code coverage. |
7 | 7 |
8 TODO(jrg): rename this from coverage_posix.py to coverage_all.py! | 8 TODO(jrg): rename this from coverage_posix.py to coverage_all.py! |
9 | 9 |
10 Written for and tested on Mac, Linux, and Windows. To use this script | 10 Written for and tested on Mac, Linux, and Windows. To use this script |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 return retcode | 540 return retcode |
541 | 541 |
542 def IsPosix(self): | 542 def IsPosix(self): |
543 """Return True if we are POSIX.""" | 543 """Return True if we are POSIX.""" |
544 return self.IsMac() or self.IsLinux() | 544 return self.IsMac() or self.IsLinux() |
545 | 545 |
546 def IsMac(self): | 546 def IsMac(self): |
547 return sys.platform == 'darwin' | 547 return sys.platform == 'darwin' |
548 | 548 |
549 def IsLinux(self): | 549 def IsLinux(self): |
550 return sys.platform == 'linux2' | 550 return sys.platform.startswith('linux') |
551 | 551 |
552 def IsWindows(self): | 552 def IsWindows(self): |
553 """Return True if we are Windows.""" | 553 """Return True if we are Windows.""" |
554 return sys.platform in ('win32', 'cygwin') | 554 return sys.platform in ('win32', 'cygwin') |
555 | 555 |
556 def ClearData(self): | 556 def ClearData(self): |
557 """Clear old gcda files and old coverage info files.""" | 557 """Clear old gcda files and old coverage info files.""" |
558 if self.options.dont_clear_coverage_data: | 558 if self.options.dont_clear_coverage_data: |
559 print 'Clearing of coverage data NOT performed.' | 559 print 'Clearing of coverage data NOT performed.' |
560 return | 560 return |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 if options.trim: | 907 if options.trim: |
908 coverage.TrimTests() | 908 coverage.TrimTests() |
909 coverage.RunTests() | 909 coverage.RunTests() |
910 if options.genhtml: | 910 if options.genhtml: |
911 coverage.GenerateHtml() | 911 coverage.GenerateHtml() |
912 return 0 | 912 return 0 |
913 | 913 |
914 | 914 |
915 if __name__ == '__main__': | 915 if __name__ == '__main__': |
916 sys.exit(main()) | 916 sys.exit(main()) |
OLD | NEW |