From 1d7392a45c95794b385f6a7c3a9dfa5428c4bbed Mon Sep 17 00:00:00 2001 From: oprypin Date: Tue, 16 May 2017 05:36:15 -0700 Subject: [PATCH] Update testing tools (AppRTC, Go) to new versions App engine is included in the AppRTC archive, so the separate archive is not needed anymore. Mercurial is no longer necessary to include but it will be required during the vendoring step when the prebuilt archives are update. The download/build scripts have been simplified accordingly. The video quality test has been updated to work with the new appengine. BUG=webrtc:7602 Review-Url: https://codereview.webrtc.org/2882073003 Cr-Commit-Position: refs/heads/master@{#18162} --- .../video_quality_loopback_test.py | 143 +++++++++--------- webrtc/tools/testing/README.md | 38 +++++ ...ild_apprtc_collider.py => build_apprtc.py} | 23 ++- webrtc/tools/testing/build_mercurial_local.py | 47 ------ webrtc/tools/testing/download_apprtc.py | 58 +++++++ ...download_apprtc_appengine_and_mercurial.py | 75 --------- webrtc/tools/testing/download_golang.py | 57 ------- .../tools/testing/golang/linux/go.tar.gz.sha1 | 2 +- .../tools/testing/golang/mac/go.tar.gz.sha1 | 2 +- webrtc/tools/testing/golang/win/go.zip.sha1 | 2 +- .../tools/testing/google-appengine.zip.sha1 | 1 - .../tools/testing/mercurial-src.tar.gz.sha1 | 1 - webrtc/tools/testing/prebuilt_apprtc.zip.sha1 | 2 +- webrtc/tools/testing/setup_apprtc.py | 22 +-- webrtc/tools/testing/utils.py | 21 +-- 15 files changed, 192 insertions(+), 302 deletions(-) create mode 100644 webrtc/tools/testing/README.md rename webrtc/tools/testing/{build_apprtc_collider.py => build_apprtc.py} (67%) delete mode 100755 webrtc/tools/testing/build_mercurial_local.py create mode 100755 webrtc/tools/testing/download_apprtc.py delete mode 100755 webrtc/tools/testing/download_apprtc_appengine_and_mercurial.py delete mode 100755 webrtc/tools/testing/download_golang.py delete mode 100644 webrtc/tools/testing/google-appengine.zip.sha1 delete mode 100644 webrtc/tools/testing/mercurial-src.tar.gz.sha1 mode change 100644 => 100755 webrtc/tools/testing/setup_apprtc.py diff --git a/webrtc/examples/androidtests/video_quality_loopback_test.py b/webrtc/examples/androidtests/video_quality_loopback_test.py index 2500057320..e8c4381f1f 100755 --- a/webrtc/examples/androidtests/video_quality_loopback_test.py +++ b/webrtc/examples/androidtests/video_quality_loopback_test.py @@ -19,7 +19,6 @@ It assumes you have a Android device plugged in. """ import argparse -import atexit import logging import os import shutil @@ -32,13 +31,6 @@ import time 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)) -WEBRTC_DEPS_INSTRUCTIONS = """Please add a solution to your .gclient file like -this and run gclient sync: -{ - "name": "webrtc.DEPS", - "url": "https://chromium.googlesource.com/chromium/deps/webrtc/webrtc.DEPS", -}, -""" class Error(Exception): @@ -62,7 +54,6 @@ def _RunCommandWithOutput(argv, cwd=SRC_DIR, **kwargs): def _RunBackgroundCommand(argv, cwd=SRC_DIR): logging.info('Running %r', argv) process = subprocess.Popen(argv, cwd=cwd) - atexit.register(process.terminate) time.sleep(0.5) status = process.poll() if status: # is not None or 0 @@ -108,8 +99,14 @@ def main(): toolchain_dir = os.path.join(tools_dir, 'video_quality_toolchain') # Download ffmpeg and zxing. - download_script = os.path.join(tools_dir, 'download_tools.py') - _RunCommand([sys.executable, download_script, toolchain_dir]) + download_tools_script = os.path.join(tools_dir, 'download_tools.py') + _RunCommand([sys.executable, download_tools_script, toolchain_dir]) + + testing_tools_dir = os.path.join(SRC_DIR, 'webrtc', 'tools', 'testing') + + # Download, extract and build AppRTC. + setup_apprtc_script = os.path.join(testing_tools_dir, 'setup_apprtc.py') + _RunCommand([sys.executable, setup_apprtc_script, temp_dir]) # Select an Android device in case multiple are connected for line in _RunCommandWithOutput([adb_path, 'devices']).splitlines(): @@ -119,82 +116,88 @@ def main(): else: raise VideoQualityTestError('Cannot find any connected Android device.') - # Start AppRTC Server - dev_appserver = os.path.join(SRC_DIR, 'out', 'apprtc', 'google_appengine', - 'dev_appserver.py') - if not os.path.isfile(dev_appserver): - raise VideoQualityTestError('Cannot find %s.\n%s' % - (dev_appserver, WEBRTC_DEPS_INSTRUCTIONS)) - appengine_dir = os.path.join(SRC_DIR, 'out', 'apprtc', 'out', 'app_engine') - _RunBackgroundCommand(['python', dev_appserver, appengine_dir, - '--port=9999', '--admin_port=9998', - '--skip_sdk_update_check', '--clear_datastore=yes']) + processes = [] + try: + # Start AppRTC Server + dev_appserver = os.path.join(temp_dir, 'apprtc', 'temp', 'google-cloud-sdk', + 'bin', 'dev_appserver.py') + appengine_dir = os.path.join(temp_dir, 'apprtc', 'out', 'app_engine') + processes.append(_RunBackgroundCommand([ + 'python', dev_appserver, appengine_dir, + '--port=9999', '--admin_port=9998', + '--skip_sdk_update_check', '--clear_datastore=yes'])) - # Start Collider - collider_path = os.path.join(SRC_DIR, 'out', 'go-workspace', 'bin', - 'collidermain') - if not os.path.isfile(collider_path): - raise VideoQualityTestError('Cannot find %s.\n%s' % - (collider_path, WEBRTC_DEPS_INSTRUCTIONS)) - _RunBackgroundCommand([collider_path, '-tls=false', - '-port=8089', '-room-server=http://localhost:9999']) + # Start Collider + collider_path = os.path.join(temp_dir, 'collider', 'collidermain') + processes.append(_RunBackgroundCommand([ + collider_path, '-tls=false', '-port=8089', + '-room-server=http://localhost:9999'])) - # Start adb reverse forwarder - reverseforwarder_path = os.path.join( - SRC_DIR, 'build', 'android', 'adb_reverse_forwarder.py') - _RunBackgroundCommand([reverseforwarder_path, '--device', android_device, - '9999', '9999', '8089', '8089']) + # Start adb reverse forwarder + reverseforwarder_path = os.path.join( + SRC_DIR, 'build', 'android', 'adb_reverse_forwarder.py') + processes.append(_RunBackgroundCommand([ + reverseforwarder_path, '--device', android_device, + '9999', '9999', '8089', '8089'])) - # Run the Espresso code. - test_script = os.path.join(build_dir_android, - 'bin', 'run_AppRTCMobileTestStubbedVideoIO') - _RunCommand([test_script, '--device', android_device]) + # Run the Espresso code. + test_script = os.path.join(build_dir_android, + 'bin', 'run_AppRTCMobileTestStubbedVideoIO') + _RunCommand([test_script, '--device', android_device]) - # Pull the output video. - test_video = os.path.join(temp_dir, 'test_video.y4m') - _RunCommand([adb_path, '-s', android_device, - 'pull', '/sdcard/output.y4m', test_video]) + # Pull the output video. + test_video = os.path.join(temp_dir, 'test_video.y4m') + _RunCommand([adb_path, '-s', android_device, + 'pull', '/sdcard/output.y4m', test_video]) - test_video_yuv = os.path.join(temp_dir, 'test_video.yuv') + test_video_yuv = os.path.join(temp_dir, 'test_video.yuv') - ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg') + ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg') - def ConvertVideo(input_video, output_video): - _RunCommand([ffmpeg_path, '-y', '-i', input_video, output_video]) + def ConvertVideo(input_video, output_video): + _RunCommand([ffmpeg_path, '-y', '-i', input_video, output_video]) - ConvertVideo(test_video, test_video_yuv) + ConvertVideo(test_video, test_video_yuv) - reference_video = os.path.join(SRC_DIR, - 'resources', 'reference_video_640x360_30fps.y4m') + reference_video = os.path.join(SRC_DIR, + 'resources', 'reference_video_640x360_30fps.y4m') - reference_video_yuv = os.path.join(temp_dir, - 'reference_video_640x360_30fps.yuv') + reference_video_yuv = os.path.join(temp_dir, + 'reference_video_640x360_30fps.yuv') - ConvertVideo(reference_video, reference_video_yuv) + ConvertVideo(reference_video, reference_video_yuv) - # Run compare script. - compare_script = os.path.join(SRC_DIR, 'webrtc', 'tools', 'compare_videos.py') - zxing_path = os.path.join(toolchain_dir, 'linux', 'zxing') + # Run compare script. + compare_script = os.path.join(SRC_DIR, 'webrtc', 'tools', + 'compare_videos.py') + zxing_path = os.path.join(toolchain_dir, 'linux', 'zxing') - # The frame_analyzer binary should be built for local computer and not for - # Android - frame_analyzer = os.path.join(build_dir_x86, 'frame_analyzer') + # The frame_analyzer binary should be built for local computer and not for + # Android + frame_analyzer = os.path.join(build_dir_x86, 'frame_analyzer') - frame_width = 640 - frame_height = 360 + frame_width = 640 + frame_height = 360 - stats_file_ref = os.path.join(temp_dir, 'stats_ref.txt') - stats_file_test = os.path.join(temp_dir, 'stats_test.txt') + stats_file_ref = os.path.join(temp_dir, 'stats_ref.txt') + stats_file_test = os.path.join(temp_dir, 'stats_test.txt') - _RunCommand([ - sys.executable, compare_script, '--ref_video', reference_video_yuv, - '--test_video', test_video_yuv, '--yuv_frame_width', str(frame_width), - '--yuv_frame_height', str(frame_height), - '--stats_file_ref', stats_file_ref, - '--stats_file_test', stats_file_test, '--frame_analyzer', frame_analyzer, - '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path]) + _RunCommand([ + sys.executable, compare_script, '--ref_video', reference_video_yuv, + '--test_video', test_video_yuv, '--yuv_frame_width', str(frame_width), + '--yuv_frame_height', str(frame_height), + '--stats_file_ref', stats_file_ref, + '--stats_file_test', stats_file_test, + '--frame_analyzer', frame_analyzer, + '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path]) - shutil.rmtree(temp_dir) + finally: + for process in processes: + if process: + process.terminate() + process.wait() + + shutil.rmtree(temp_dir) if __name__ == '__main__': diff --git a/webrtc/tools/testing/README.md b/webrtc/tools/testing/README.md new file mode 100644 index 0000000000..9068b5bfd3 --- /dev/null +++ b/webrtc/tools/testing/README.md @@ -0,0 +1,38 @@ +This directory contains prebuilt tools used during end-to-end tests. +They will be downloaded by their SHA1 hash, and are not meant to be checked in. + +Updating prebuilt_apprtc.zip: + +- Follow AppRTC instructions: + - `git clone https://github.com/webrtc/apprtc` + - Install NodeJS: + - Download and extract it + - `export PATH="$(pwd)/node-v6.10.3-linux-x64/bin:$PATH"` + - `cd apprtc` + - `npm install` + - `export PATH="$(pwd)/node_modules/.bin:$PATH"` + - `pip install --user --upgrade pip setuptools` - needed only on old systems + - `grunt` +- Vendor collider's dependencies: + - `ln -s "$(pwd)/src/collider" src/src` + - `GOPATH="$(pwd)/src" go get -d collidermain` + - `rm src/src` +- Remove unneeded files: + - `rm -rf .git node_modules browsers` +- `zip -r prebuilt_apprtc.zip apprtc/` +- `mv prebuilt_apprtc.zip webrtc/src/webrtc/tools/testing/prebuilt_apprtc.zip` + +Updating golang/*: + +- Go to +- Download these files: + - go*.linux-amd64.tar.gz -> golang/linux/go.tar.gz + - go*.darwin-amd64.tar.gz -> golang/mac/go.tar.gz + - go*.windows-amd64.zip -> golang/windows/go.zip + +After updating the archives: + +- `cd webrtc/src/webrtc/tools/testing` +- For each updated archive: + - `upload_to_google_storage.py file.zip --bucket=chromium-webrtc-resources` +- `git commit -a && git cl upload` diff --git a/webrtc/tools/testing/build_apprtc_collider.py b/webrtc/tools/testing/build_apprtc.py similarity index 67% rename from webrtc/tools/testing/build_apprtc_collider.py rename to webrtc/tools/testing/build_apprtc.py index 5ff09bbeab..a390c94f0e 100755 --- a/webrtc/tools/testing/build_apprtc_collider.py +++ b/webrtc/tools/testing/build_apprtc.py @@ -9,11 +9,11 @@ """Builds the AppRTC collider using the golang toolchain. -The golang toolchain is downloaded by download_golang.py. We use that here +The golang toolchain is downloaded by download_apprtc.py. We use that here to build the AppRTC collider server. This script needs to know the path to the 'src' directory in apprtc, the -root directory of 'go', the root directory of 'hg' and the output_dir. +root directory of 'go' and the output_dir. """ import os @@ -24,35 +24,30 @@ import sys import utils -USAGE_STR = "Usage: {} " +USAGE_STR = "Usage: {} " def main(argv): - if len(argv) != 5: + if len(argv) != 4: return USAGE_STR.format(argv[0]) - apprtc_dir = argv[1] - go_root_dir = argv[2] - mercurial_dir = argv[3] - golang_workspace = argv[4] + apprtc_dir = os.path.abspath(argv[1]) + go_root_dir = os.path.abspath(argv[2]) + golang_workspace = os.path.abspath(argv[3]) utils.RemoveDirectory(golang_workspace) golang_workspace_src = os.path.join(golang_workspace, 'src') collider_dir = os.path.join(apprtc_dir, 'collider') - shutil.copytree(collider_dir, golang_workspace_src, - ignore=shutil.ignore_patterns('.svn', '.git')) + shutil.copytree(collider_dir, golang_workspace_src) golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '') golang_path = os.path.join(go_root_dir, 'bin', golang_binary) golang_env = os.environ.copy() golang_env['GOROOT'] = go_root_dir - golang_env['GOPATH'] = os.path.abspath(golang_workspace) - golang_env['PATH'] += os.pathsep + mercurial_dir - subprocess.check_call([golang_path, 'get', 'collidermain'], - env=golang_env) + golang_env['GOPATH'] = golang_workspace collider_exec = os.path.join(golang_workspace, 'collidermain') subprocess.check_call([golang_path, 'build', '-o', collider_exec, 'collidermain'], env=golang_env) diff --git a/webrtc/tools/testing/build_mercurial_local.py b/webrtc/tools/testing/build_mercurial_local.py deleted file mode 100755 index 512ca78d3e..0000000000 --- a/webrtc/tools/testing/build_mercurial_local.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/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. - -"""Builds a local mercurial (hg) copy. - -This is used by the go toolchain. -""" - -import os -import subprocess -import sys - -import utils - - -def main(argv): - if len(argv) != 2: - return 'Usage: %s ' % argv[0] - - mercurial_dir = argv[1] - if not os.path.exists(mercurial_dir): - return 'Expected mercurial at {}.'.format(mercurial_dir) - - os.chdir(mercurial_dir) - - if utils.GetPlatform() == 'win': - subprocess.check_call(['python', 'setup.py', '--pure', 'build_py', '-c', - '-d', '.', 'build_ext', - '-i', 'build_mo', '--force']) - with open('hg.bat', 'w') as put_hg_in_path: - # Write a hg.bat since the go toolchain expects to find something called - # 'hg' in the path, but Windows only recognizes executables ending with - # an extension in PATHEXT. Writing hg.bat effectively makes 'hg' callable - # if the mercurial folder is in PATH. - mercurial_path = os.path.abspath('hg') - put_hg_in_path.write('python %s %%*' % mercurial_path) - else: - subprocess.check_call(['make', 'local']) - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/webrtc/tools/testing/download_apprtc.py b/webrtc/tools/testing/download_apprtc.py new file mode 100755 index 0000000000..f6db785275 --- /dev/null +++ b/webrtc/tools/testing/download_apprtc.py @@ -0,0 +1,58 @@ +#!/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. + +"""Downloads prebuilt AppRTC and Go from WebRTC storage and unpacks it. + +Requires that depot_tools is installed and in the PATH. + +It downloads compressed files in the directory where the script lives. +This is because the precondition is that the script lives in the same +directory of the .sha1 files. +""" + +import os +import sys + +import utils + + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def _GetGoArchivePathForPlatform(): + archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz' + return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension) + + +def main(argv): + if len(argv) > 2: + return 'Usage: %s [output_dir]' % argv[0] + + output_dir = os.path.abspath(argv[1]) if len(argv) > 1 else None + + apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip') + if os.path.isfile(apprtc_zip_path + '.sha1'): + utils.DownloadFilesFromGoogleStorage(SCRIPT_DIR, auto_platform=False) + + if output_dir is not None: + utils.RemoveDirectory(os.path.join(output_dir, 'apprtc')) + utils.UnpackArchiveTo(apprtc_zip_path, output_dir) + + golang_path = os.path.join(SCRIPT_DIR, 'golang') + golang_zip_path = os.path.join(golang_path, _GetGoArchivePathForPlatform()) + if os.path.isfile(golang_zip_path + '.sha1'): + utils.DownloadFilesFromGoogleStorage(golang_path) + + if output_dir is not None: + utils.RemoveDirectory(os.path.join(output_dir, 'go')) + utils.UnpackArchiveTo(golang_zip_path, output_dir) + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/webrtc/tools/testing/download_apprtc_appengine_and_mercurial.py b/webrtc/tools/testing/download_apprtc_appengine_and_mercurial.py deleted file mode 100755 index 2d5b620561..0000000000 --- a/webrtc/tools/testing/download_apprtc_appengine_and_mercurial.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/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. - -"""Downloads the appengine SDK from WebRTC storage and unpacks it. - -Requires that depot_tools is installed and in the PATH. - -It downloads compressed files in the directory where the script lives. -This is because the precondition is that the script lives in the same -directory of the .sha1 files. -""" - -import glob -import os -import sys -import subprocess - -import utils - - -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) - -def _DownloadResources(dir_to_scan_for_sha1): - print 'Downloading files in %s...' % dir_to_scan_for_sha1 - - extension = 'bat' if 'win32' in sys.platform else 'py' - cmd = ['download_from_google_storage.%s' % extension, - '--bucket=chromium-webrtc-resources', - '--directory', dir_to_scan_for_sha1] - subprocess.check_call(cmd) - - -def _StripVersionNumberFromMercurialFolder(output_dir): - unpacked_name = glob.glob(os.path.join(output_dir, 'mercurial*')) - assert len(unpacked_name) == 1, 'Should have precisely one mercurial!' - os.rename(unpacked_name[0], os.path.join(output_dir, 'mercurial')) - - -def main(argv): - if len(argv) == 1: - return 'Usage: %s ' % argv[0] - - output_dir = argv[1] - appengine_zip_path = os.path.join(SCRIPT_DIR, 'google-appengine.zip') - old_appengine_sha1 = utils.ComputeSHA1(appengine_zip_path) - - mercurial_tar_path = os.path.join(SCRIPT_DIR, 'mercurial-src.tar.gz') - old_mercurial_sha1 = utils.ComputeSHA1(mercurial_tar_path) - - apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip') - old_apprtc_sha1 = utils.ComputeSHA1(apprtc_zip_path) - - _DownloadResources(SCRIPT_DIR) - - if old_appengine_sha1 != utils.ComputeSHA1(appengine_zip_path): - utils.RemoveDirectory(os.path.join(output_dir, 'google_appengine')) - utils.UnpackArchiveTo(appengine_zip_path, output_dir) - - if old_mercurial_sha1 != utils.ComputeSHA1(mercurial_tar_path): - utils.RemoveDirectory(os.path.join(output_dir, 'mercurial')) - utils.UnpackArchiveTo(mercurial_tar_path, output_dir) - _StripVersionNumberFromMercurialFolder(output_dir) - - if old_apprtc_sha1 != utils.ComputeSHA1(apprtc_zip_path): - utils.RemoveDirectory(os.path.join(output_dir, 'apprtc')) - utils.UnpackArchiveTo(apprtc_zip_path, output_dir) - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/webrtc/tools/testing/download_golang.py b/webrtc/tools/testing/download_golang.py deleted file mode 100755 index a6665bb719..0000000000 --- a/webrtc/tools/testing/download_golang.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/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. - -"""Downloads the golang SDK from WebRTC storage and unpacks it. - -Requires that depot_tools is installed and in the PATH. - -The precondition is that a directory 'golang' lives in the same directory -as the script. -This 'golang' directory has the following structure: - -/golang - | - |-----/linux/go.tar.gz.sha1 - |-----/win/go.zip.sha1 - |-----/mac/go.tar.gz.sha1 -""" - -import os -import sys - -import utils - - -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) - - -def _GetGoArchivePathForPlatform(): - archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz' - return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension) - - -def main(argv): - if len(argv) == 1: - return 'Usage: %s ' % argv[0] - - output_dir = os.path.join(argv[1]) - golang_path = os.path.join(SCRIPT_DIR, 'golang') - archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform()) - old_archive_sha1 = utils.ComputeSHA1(archive_path) - - utils.DownloadFilesFromGoogleStorage(golang_path) - - if (old_archive_sha1 != utils.ComputeSHA1(archive_path) - or not os.path.exists('go')): - utils.RemoveDirectory(os.path.join(output_dir, 'go')) - utils.UnpackArchiveTo(archive_path, output_dir) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/webrtc/tools/testing/golang/linux/go.tar.gz.sha1 b/webrtc/tools/testing/golang/linux/go.tar.gz.sha1 index f6554894af..aa2509557d 100644 --- a/webrtc/tools/testing/golang/linux/go.tar.gz.sha1 +++ b/webrtc/tools/testing/golang/linux/go.tar.gz.sha1 @@ -1 +1 @@ -14068fbe349db34b838853a7878621bbd2b24646 +a433f76c569055ff8536d796995518dd91a9fa5b \ No newline at end of file diff --git a/webrtc/tools/testing/golang/mac/go.tar.gz.sha1 b/webrtc/tools/testing/golang/mac/go.tar.gz.sha1 index c76e704527..6dbaaf347c 100644 --- a/webrtc/tools/testing/golang/mac/go.tar.gz.sha1 +++ b/webrtc/tools/testing/golang/mac/go.tar.gz.sha1 @@ -1 +1 @@ -be686ec7ba68d588735cc2094ccab8bdd651de9e +aecf5ec9360a004fdbff181269554892743f4bf6 \ No newline at end of file diff --git a/webrtc/tools/testing/golang/win/go.zip.sha1 b/webrtc/tools/testing/golang/win/go.zip.sha1 index a6bcbab4a1..00fae8de9a 100644 --- a/webrtc/tools/testing/golang/win/go.zip.sha1 +++ b/webrtc/tools/testing/golang/win/go.zip.sha1 @@ -1 +1 @@ -ba99083b22e0b22b560bb2d28b9b99b405d01b6b +26bf854fb81f12e9c80a146d8f0081cd22ae9d02 \ No newline at end of file diff --git a/webrtc/tools/testing/google-appengine.zip.sha1 b/webrtc/tools/testing/google-appengine.zip.sha1 deleted file mode 100644 index cf13e4c6c8..0000000000 --- a/webrtc/tools/testing/google-appengine.zip.sha1 +++ /dev/null @@ -1 +0,0 @@ -827468f89c78f292c28ceac50e6109c8d649fa61 diff --git a/webrtc/tools/testing/mercurial-src.tar.gz.sha1 b/webrtc/tools/testing/mercurial-src.tar.gz.sha1 deleted file mode 100644 index 5ef3e9d738..0000000000 --- a/webrtc/tools/testing/mercurial-src.tar.gz.sha1 +++ /dev/null @@ -1 +0,0 @@ -a8a51aa412abd5155c7de29fd39c9774decb4d3f \ No newline at end of file diff --git a/webrtc/tools/testing/prebuilt_apprtc.zip.sha1 b/webrtc/tools/testing/prebuilt_apprtc.zip.sha1 index 7e2833ef3d..95b41c7158 100644 --- a/webrtc/tools/testing/prebuilt_apprtc.zip.sha1 +++ b/webrtc/tools/testing/prebuilt_apprtc.zip.sha1 @@ -1 +1 @@ -6a96fc234cfa92ffaa79b0aeb5f4bdc1f31c6340 \ No newline at end of file +d8d95f55129e0c1a4e0f5d0d3acbf7163395354c \ No newline at end of file diff --git a/webrtc/tools/testing/setup_apprtc.py b/webrtc/tools/testing/setup_apprtc.py old mode 100644 new mode 100755 index 801da73ae0..697d5031d8 --- a/webrtc/tools/testing/setup_apprtc.py +++ b/webrtc/tools/testing/setup_apprtc.py @@ -22,30 +22,22 @@ import utils SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) + def main(argv): if len(argv) == 1: return 'Usage %s ' % argv[0] - output_dir = argv[1] - apprtc_appengine_mercurial_path = os.path.join( - SCRIPT_DIR, 'download_apprtc_appengine_and_mercurial.py') - utils.RunSubprocessWithRetry([apprtc_appengine_mercurial_path, - output_dir]) + output_dir = os.path.abspath(argv[1]) - download_golang_path = os.path.join(SCRIPT_DIR, 'download_golang.py') - utils.RunSubprocessWithRetry([download_golang_path, output_dir]) + download_apprtc_path = os.path.join(SCRIPT_DIR, 'download_apprtc.py') + utils.RunSubprocessWithRetry([download_apprtc_path, output_dir]) - build_mercurial_path = os.path.join(SCRIPT_DIR, 'build_mercurial_local.py') - hg_dir = os.path.join(output_dir, 'mercurial') - utils.RunSubprocessWithRetry([build_mercurial_path, hg_dir]) - - build_apprtc_collider_path = os.path.join(SCRIPT_DIR, - 'build_apprtc_collider.py') + build_apprtc_path = os.path.join(SCRIPT_DIR, 'build_apprtc.py') apprtc_src_dir = os.path.join(output_dir, 'apprtc', 'src') go_dir = os.path.join(output_dir, 'go') collider_dir = os.path.join(output_dir, 'collider') - utils.RunSubprocessWithRetry([build_apprtc_collider_path, apprtc_src_dir, - go_dir, hg_dir, collider_dir]) + utils.RunSubprocessWithRetry([build_apprtc_path, apprtc_src_dir, + go_dir, collider_dir]) if __name__ == '__main__': diff --git a/webrtc/tools/testing/utils.py b/webrtc/tools/testing/utils.py index 7e38b42a71..3b82fc8867 100755 --- a/webrtc/tools/testing/utils.py +++ b/webrtc/tools/testing/utils.py @@ -9,7 +9,6 @@ """Utilities for all our deps-management stuff.""" -import hashlib import os import shutil import sys @@ -34,32 +33,18 @@ def RunSubprocessWithRetry(cmd): raise exception -def DownloadFilesFromGoogleStorage(path): +def DownloadFilesFromGoogleStorage(path, auto_platform=True): print 'Downloading files in %s...' % path extension = 'bat' if 'win32' in sys.platform else 'py' cmd = ['download_from_google_storage.%s' % extension, '--bucket=chromium-webrtc-resources', - '--auto_platform', - '--recursive', '--directory', path] + if auto_platform: + cmd += ['--auto_platform', '--recursive'] subprocess.check_call(cmd) -def ComputeSHA1(path): - if not os.path.exists(path): - return 0 - - sha1 = hashlib.sha1() - file_to_hash = open(path, 'rb') - try: - sha1.update(file_to_hash.read()) - finally: - file_to_hash.close() - - return sha1.hexdigest() - - # Code partially copied from # https://cs.chromium.org#chromium/build/scripts/common/chromium_utils.py def RemoveDirectory(*path):