Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style license |
| 5 | # that can be found in the LICENSE file in the root of the source |
| 6 | # tree. An additional intellectual property rights grant can be found |
| 7 | # in the file PATENTS. All contributing project authors may |
| 8 | # be found in the AUTHORS file in the root of the source tree. |
| 9 | |
| 10 | """Generates a command-line for coverage.py. Useful for manual coverage runs. |
| 11 | |
| 12 | Before running the generated command line, do this: |
| 13 | |
| 14 | gn gen out/coverage --args='use_clang_coverage=true is_component_build=false' |
| 15 | """ |
| 16 | |
| 17 | import sys |
| 18 | |
| 19 | TESTS = [ |
| 20 | 'video_capture_tests', |
| 21 | 'webrtc_nonparallel_tests', |
| 22 | 'video_engine_tests', |
| 23 | 'tools_unittests', |
| 24 | 'test_support_unittests', |
| 25 | 'system_wrappers_unittests', |
| 26 | 'rtc_unittests', |
| 27 | 'rtc_stats_unittests', |
| 28 | 'rtc_pc_unittests', |
| 29 | 'rtc_media_unittests', |
| 30 | 'peerconnection_unittests', |
| 31 | 'ortc_unittests', |
| 32 | 'modules_unittests', |
| 33 | 'modules_tests', |
| 34 | 'low_bandwidth_audio_test', |
| 35 | 'common_video_unittests', |
| 36 | 'common_audio_unittests', |
| 37 | 'audio_decoder_unittests' |
| 38 | ] |
| 39 | |
| 40 | def main(): |
| 41 | cmd = ([sys.executable, 'tools/code_coverage/coverage.py'] + TESTS + |
| 42 | ['-b out/coverage', '-o out/report'] + |
Artem Titarenko | ea5b76f | 2018-09-11 16:27:34 +0200 | [diff] [blame] | 43 | ['-i=\'.*/out/.*|.*/third_party/.*|.*test.*\''] + |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 44 | ['-c \'out/coverage/%s\'' % t for t in TESTS]) |
| 45 | |
| 46 | def WithXvfb(binary): |
| 47 | return '-c \'%s testing/xvfb.py %s\'' % (sys.executable, binary) |
| 48 | modules_unittests = 'out/coverage/modules_unittests' |
| 49 | cmd[cmd.index('-c \'%s\'' % modules_unittests)] = WithXvfb(modules_unittests) |
| 50 | |
| 51 | print ' '.join(cmd) |
| 52 | return 0 |
| 53 | |
| 54 | if __name__ == '__main__': |
| 55 | sys.exit(main()) |