kjellander | 8f8d1a0 | 2017-03-06 04:01:16 -0800 | [diff] [blame] | 1 | #!/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 | """ |
| 11 | This script is the wrapper that runs the low-bandwidth audio test. |
| 12 | |
| 13 | After running the test, post-process steps for calculating audio quality of the |
| 14 | output files will be performed. |
| 15 | """ |
| 16 | |
| 17 | import argparse |
| 18 | import logging |
| 19 | import os |
| 20 | import subprocess |
| 21 | import sys |
| 22 | |
| 23 | |
| 24 | SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 25 | SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, |
| 26 | os.pardir)) |
| 27 | |
| 28 | |
| 29 | def _RunCommand(argv, cwd=SRC_DIR, **kwargs): |
| 30 | logging.info('Running %r', argv) |
| 31 | subprocess.check_call(argv, cwd=cwd, **kwargs) |
| 32 | |
| 33 | |
| 34 | def _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 | |
| 42 | def 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 | |
| 55 | if __name__ == '__main__': |
| 56 | sys.exit(main()) |