Use information about blacklisted devices in video_quality_loopback_test
BUG=webrtc:7724 NOTRY=True Review-Url: https://codereview.webrtc.org/2937123002 Cr-Commit-Position: refs/heads/master@{#18654}
This commit is contained in:
@ -19,6 +19,7 @@ It assumes you have a Android device plugged in.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@ -31,6 +32,9 @@ import time
|
|||||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
|
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
|
||||||
os.pardir))
|
os.pardir))
|
||||||
|
BAD_DEVICES_JSON = os.path.join(SRC_DIR,
|
||||||
|
os.environ.get('CHROMIUM_OUT_DIR', 'out'),
|
||||||
|
'bad_devices.json')
|
||||||
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
@ -109,10 +113,19 @@ def main():
|
|||||||
_RunCommand([sys.executable, setup_apprtc_script, temp_dir])
|
_RunCommand([sys.executable, setup_apprtc_script, temp_dir])
|
||||||
|
|
||||||
# Select an Android device in case multiple are connected
|
# Select an Android device in case multiple are connected
|
||||||
|
try:
|
||||||
|
with open(BAD_DEVICES_JSON) as bad_devices_file:
|
||||||
|
bad_devices = json.load(bad_devices_file)
|
||||||
|
except IOError:
|
||||||
|
if os.environ.get('CHROME_HEADLESS'):
|
||||||
|
logging.warning('Cannot read %r', BAD_DEVICES_JSON)
|
||||||
|
bad_devices = {}
|
||||||
|
|
||||||
for line in _RunCommandWithOutput([adb_path, 'devices']).splitlines():
|
for line in _RunCommandWithOutput([adb_path, 'devices']).splitlines():
|
||||||
if line.endswith('\tdevice'):
|
if line.endswith('\tdevice'):
|
||||||
android_device = line.split('\t')[0]
|
android_device = line.split('\t')[0]
|
||||||
break
|
if android_device not in bad_devices:
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
raise VideoQualityTestError('Cannot find any connected Android device.')
|
raise VideoQualityTestError('Cannot find any connected Android device.')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user