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