From 8f8d1a06b97d0cbb9cae90afcddb93f5de2450a7 Mon Sep 17 00:00:00 2001 From: kjellander Date: Mon, 6 Mar 2017 04:01:16 -0800 Subject: [PATCH] Adding placeholder for low bandwidth audio test This will allow the trybots to be updated to start running this new test executable, so that they can be used when landing this CL which will replace the dummy test with real code: https://codereview.webrtc.org/2694203002 Most likely, the trybots will just run the test binary while the perf bots will run a Python wrapper script that takes care of the post-processing to calculate audio quality using PESQ. BUG=webrtc:7229 NOTRY=True Review-Url: https://codereview.webrtc.org/2717683002 Cr-Commit-Position: refs/heads/master@{#17063} --- webrtc/audio/BUILD.gn | 20 +++++++ webrtc/audio/test/low_bandwidth_audio_test.cc | 16 ++++++ webrtc/audio/test/low_bandwidth_audio_test.py | 56 +++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 webrtc/audio/test/low_bandwidth_audio_test.cc create mode 100755 webrtc/audio/test/low_bandwidth_audio_test.py diff --git a/webrtc/audio/BUILD.gn b/webrtc/audio/BUILD.gn index acd8dfa7e8..a6a22e652c 100644 --- a/webrtc/audio/BUILD.gn +++ b/webrtc/audio/BUILD.gn @@ -7,6 +7,10 @@ # be found in the AUTHORS file in the root of the source tree. import("../webrtc.gni") +if (is_android) { + import("//build/config/android/config.gni") + import("//build/config/android/rules.gni") +} rtc_static_library("audio") { sources = [ @@ -79,4 +83,20 @@ if (rtc_include_tests) { suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] } } + + if (rtc_enable_protobuf) { + rtc_executable("low_bandwidth_audio_test") { + testonly = true + + sources = [ + "test/low_bandwidth_audio_test.cc", + ] + + deps = [] + + if (is_android) { + deps += [ "//testing/android/native_test:native_test_support" ] + } + } + } } diff --git a/webrtc/audio/test/low_bandwidth_audio_test.cc b/webrtc/audio/test/low_bandwidth_audio_test.cc new file mode 100644 index 0000000000..c78e8897a8 --- /dev/null +++ b/webrtc/audio/test/low_bandwidth_audio_test.cc @@ -0,0 +1,16 @@ +/* + * Copyright 2017 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +// This is a placeholder for the work oprypin@ is doing on a low-bandwidth +// audio test executable. + +int main() { + return 0; +} diff --git a/webrtc/audio/test/low_bandwidth_audio_test.py b/webrtc/audio/test/low_bandwidth_audio_test.py new file mode 100755 index 0000000000..aaba9d2398 --- /dev/null +++ b/webrtc/audio/test/low_bandwidth_audio_test.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +""" +This script is the wrapper that runs the low-bandwidth audio test. + +After running the test, post-process steps for calculating audio quality of the +output files will be performed. +""" + +import argparse +import logging +import os +import subprocess +import sys + + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, + os.pardir)) + + +def _RunCommand(argv, cwd=SRC_DIR, **kwargs): + logging.info('Running %r', argv) + subprocess.check_call(argv, cwd=cwd, **kwargs) + + +def _ParseArgs(): + parser = argparse.ArgumentParser(description='Run low-bandwidth audio tests.') + parser.add_argument('build_dir', + help='Path to the build directory (e.g. out/Release).') + args = parser.parse_args() + return args + + +def main(): + # pylint: disable=W0101 + logging.basicConfig(level=logging.INFO) + + args = _ParseArgs() + + test_executable = os.path.join(args.build_dir, 'low_bandwidth_audio_test') + if sys.platform == 'win32': + test_executable += '.exe' + + _RunCommand([test_executable]) + + +if __name__ == '__main__': + sys.exit(main())