blob: aaba9d23984c587fce0a0a8b4686a80f29b5a080 [file] [log] [blame]
kjellander8f8d1a02017-03-06 04:01:16 -08001#!/usr/bin/env python
2# Copyright (c) 2017 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"""
11This script is the wrapper that runs the low-bandwidth audio test.
12
13After running the test, post-process steps for calculating audio quality of the
14output files will be performed.
15"""
16
17import argparse
18import logging
19import os
20import subprocess
21import sys
22
23
24SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
25SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
26 os.pardir))
27
28
29def _RunCommand(argv, cwd=SRC_DIR, **kwargs):
30 logging.info('Running %r', argv)
31 subprocess.check_call(argv, cwd=cwd, **kwargs)
32
33
34def _ParseArgs():
35 parser = argparse.ArgumentParser(description='Run low-bandwidth audio tests.')
36 parser.add_argument('build_dir',
37 help='Path to the build directory (e.g. out/Release).')
38 args = parser.parse_args()
39 return args
40
41
42def main():
43 # pylint: disable=W0101
44 logging.basicConfig(level=logging.INFO)
45
46 args = _ParseArgs()
47
48 test_executable = os.path.join(args.build_dir, 'low_bandwidth_audio_test')
49 if sys.platform == 'win32':
50 test_executable += '.exe'
51
52 _RunCommand([test_executable])
53
54
55if __name__ == '__main__':
56 sys.exit(main())