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. |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 9 | """Generates a command-line for coverage.py. Useful for manual coverage runs. |
| 10 | |
| 11 | Before running the generated command line, do this: |
| 12 | |
| 13 | gn gen out/coverage --args='use_clang_coverage=true is_component_build=false' |
| 14 | """ |
| 15 | |
| 16 | import sys |
| 17 | |
| 18 | TESTS = [ |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 19 | 'video_capture_tests', 'webrtc_nonparallel_tests', 'video_engine_tests', |
| 20 | 'tools_unittests', 'test_support_unittests', 'slow_tests', |
| 21 | 'system_wrappers_unittests', 'rtc_unittests', 'rtc_stats_unittests', |
| 22 | 'rtc_pc_unittests', 'rtc_media_unittests', 'peerconnection_unittests', |
| 23 | 'modules_unittests', 'modules_tests', 'low_bandwidth_audio_test', |
| 24 | 'common_video_unittests', 'common_audio_unittests', |
| 25 | 'audio_decoder_unittests' |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 26 | ] |
| 27 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 28 | |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 29 | def main(): |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 30 | cmd = ([sys.executable, 'tools/code_coverage/coverage.py'] + TESTS + |
| 31 | ['-b out/coverage', '-o out/report'] + |
| 32 | ['-i=\'.*/out/.*|.*/third_party/.*|.*test.*\''] + |
| 33 | ['-c \'out/coverage/%s\'' % t for t in TESTS]) |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 34 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 35 | def WithXvfb(binary): |
| 36 | return '-c \'%s testing/xvfb.py %s\'' % (sys.executable, binary) |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 37 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 38 | modules_unittests = 'out/coverage/modules_unittests' |
| 39 | cmd[cmd.index('-c \'%s\'' % |
| 40 | modules_unittests)] = WithXvfb(modules_unittests) |
| 41 | |
| 42 | print ' '.join(cmd) |
| 43 | return 0 |
| 44 | |
Patrik Höglund | 317c1b8 | 2018-05-28 11:35:14 +0200 | [diff] [blame] | 45 | |
| 46 | if __name__ == '__main__': |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 47 | sys.exit(main()) |