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 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', 21 'webrtc_nonparallel_tests', 22 'video_engine_tests', 23 'tools_unittests', 24 'test_support_unittests', 25 'slow_tests', 26 'system_wrappers_unittests', 27 'rtc_unittests', 28 'rtc_stats_unittests', 29 'rtc_pc_unittests', 30 'rtc_media_unittests', 31 'peerconnection_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 40def main(): 41 cmd = ([sys.executable, 'tools/code_coverage/coverage.py'] + TESTS + 42 ['-b out/coverage', '-o out/report'] + 43 ['-i=\'.*/out/.*|.*/third_party/.*|.*test.*\''] + 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 54if __name__ == '__main__': 55 sys.exit(main()) 56