Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/test/buildbot_tests.py @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

  • Property exe set to *
File size: 5.0 KB
Line 
1#!/usr/bin/env python
2#
3# Copyright (c) 2012 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
11
12"""Script to run tests with pre-configured command line arguments.
13
14NOTICE: This test is designed to be run from the build output folder! It is
15copied automatically during build.
16
17With this script, it's easier for anyone to enable/disable or extend a test that
18runs on the buildbots. It is also easier for developers to run the tests in the
19same way as they run on the bots.
20"""
21
22import optparse
23import os
24import subprocess
25import sys
26
27_CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
28_HOME = os.environ.get('HOME', '')
29
30_VIE_AUTO_TEST_CMD_LIST = [
31    'vie_auto_test',
32    '--automated',
33    '--gtest_filter=-ViERtpFuzzTest*',
34    '--capture_test_ensure_resolution_alignment_in_capture_device=false']
35_WIN_TESTS = {
36    'vie_auto_test': _VIE_AUTO_TEST_CMD_LIST,
37    'voe_auto_test': ['voe_auto_test',
38                      '--automated'],
39}
40_MAC_TESTS = {
41    'libjingle_peerconnection_objc_test': [
42        ('libjingle_peerconnection_objc_test.app/Contents/MacOS/'
43         'libjingle_peerconnection_objc_test')],
44    'vie_auto_test': _VIE_AUTO_TEST_CMD_LIST,
45    'voe_auto_test': ['voe_auto_test',
46                      '--automated',
47                      ('--gtest_filter='
48                       '-VolumeTest.SetVolumeBeforePlayoutWorks' # bug 527
49                       )],
50}
51_LINUX_TESTS = {
52    'vie_auto_test': _VIE_AUTO_TEST_CMD_LIST,
53    'voe_auto_test': ['voe_auto_test',
54                      '--automated',
55                      '--gtest_filter=-RtpFuzzTest.*'],
56    'audio_e2e_test': ['python',
57                       'run_audio_test.py',
58                       '--input=../../resources/e2e_audio_in.pcm',
59                       '--output=/tmp/e2e_audio_out.pcm',
60                       '--codec=L16',
61                       '--harness=%s/audio_e2e_harness' % _CURRENT_DIR,
62                       '--compare=%s/bin/compare-audio +16000 +wb' % _HOME,
63                       '--regexp=(\d\.\d{3})'],
64    'audioproc_perf': ['audioproc',
65                       '-aecm', '-ns', '-agc', '--fixed_digital', '--perf',
66                       '-pb', '../../resources/audioproc.aecdump'],
67    'isac_fixed_perf': ['iSACFixtest',
68                        '32000', '../../resources/speech_and_misc_wb.pcm',
69                        'isac_speech_and_misc_wb.pcm'],
70    'libjingle_peerconnection_java_unittest': [
71        'libjingle_peerconnection_java_unittest'],
72}
73
74_CUSTOM_ENV = {
75    'libjingle_peerconnection_java_unittest':
76        {'LD_PRELOAD': '/usr/lib/x86_64-linux-gnu/libpulse.so.0'},
77}
78
79def main():
80  parser = optparse.OptionParser('usage: %prog -t <test> [-t <test> ...]\n'
81                                 'If no test is specified, all tests are run.')
82  parser.add_option('-l', '--list', action='store_true', default=False,
83                    help='Lists all currently supported tests.')
84  parser.add_option('-t', '--test', action='append', default=[],
85                    help='Which test to run. May be specified multiple times.')
86  options, _ = parser.parse_args()
87
88  if sys.platform.startswith('win'):
89    test_dict = _WIN_TESTS
90  elif sys.platform.startswith('linux'):
91    test_dict = _LINUX_TESTS
92  elif sys.platform.startswith('darwin'):
93    test_dict = _MAC_TESTS
94  else:
95    parser.error('Unsupported platform: %s' % sys.platform)
96
97  if options.list:
98    print 'Available tests:'
99    print 'Test name              Command line'
100    print '=========              ============'
101    for test, cmd_line in test_dict.items():
102      print '%-20s   %s' % (test, ' '.join(cmd_line))
103    return
104
105  if not options.test:
106    options.test = test_dict.keys()
107  for test in options.test:
108    if test not in test_dict:
109      parser.error('Test "%s" is not supported (use --list to view supported '
110                   'tests).')
111
112  # Change current working directory to the script's dir to make the relative
113  # paths always work.
114  os.chdir(_CURRENT_DIR)
115  print 'Changed working directory to: %s' % _CURRENT_DIR
116
117  print 'Running WebRTC Buildbot tests: %s' % options.test
118  for test in options.test:
119    cmd_line = test_dict[test]
120    env = os.environ.copy()
121    if test in _CUSTOM_ENV:
122      env.update(_CUSTOM_ENV[test])
123
124    # Create absolute paths to test executables for non-Python tests.
125    if cmd_line[0] != 'python':
126      cmd_line[0] = os.path.join(_CURRENT_DIR, cmd_line[0])
127
128    print 'Running: %s' % ' '.join(cmd_line)
129    try:
130      subprocess.check_call(cmd_line, env=env)
131    except subprocess.CalledProcessError as e:
132      print >> sys.stderr, ('An error occurred during test execution: return '
133                            'code: %d' % e.returncode)
134      return -1
135
136  print 'Testing completed successfully.'
137  return 0
138
139
140if __name__ == '__main__':
141  sys.exit(main())
Note: See TracBrowser for help on using the repository browser.