1#!/bin/bash 2 3# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 4# 5# Use of this source code is governed by a BSD-style license 6# that can be found in the LICENSE file in the root of the source 7# tree. An additional intellectual property rights grant can be found 8# in the file PATENTS. All contributing project authors may 9# be found in the AUTHORS file in the root of the source tree. 10 11if [ $# -ne 1 ]; then 12 echo "Usage: run.sh ADB-DEVICE-ID" 13 exit 1 14fi 15 16# Paths: update these based on your git checkout and gn output folder names. 17WEBRTC_DIR=$HOME/src/webrtc/src 18BUILD_DIR=$WEBRTC_DIR/out/Android_Release 19 20# Clips: update these to encode/decode other content. 21CLIPS=('Foreman') 22RESOLUTIONS=('128x96' '160x120' '176x144' '320x240' '352x288') 23FRAMERATES=(30) 24 25# Other settings. 26ADB=`which adb` 27SERIAL=$1 28TIMEOUT=7200 29 30# Ensure we are using the latest version. 31ninja -C $BUILD_DIR modules_tests 32 33# Transfer the required files by trying to run a test that doesn't exist. 34echo "===> Transferring required resources to device $1." 35$WEBRTC_DIR/build/android/test_runner.py gtest \ 36 --output-directory $BUILD_DIR \ 37 --suite modules_tests \ 38 --gtest_filter "DoesNotExist" \ 39 --shard-timeout $TIMEOUT \ 40 --runtime-deps-path $BUILD_DIR/gen.runtime/modules/modules_tests__test_runner_script.runtime_deps \ 41 --adb-path $ADB \ 42 --device $SERIAL \ 43 --verbose 44 45# Run all tests as separate test invocations. 46mkdir $SERIAL 47pushd $SERIAL 48for clip in "${CLIPS[@]}"; do 49 for resolution in "${RESOLUTIONS[@]}"; do 50 for framerate in "${FRAMERATES[@]}"; do 51 test_name="${clip}_${resolution}_${framerate}" 52 log_name="${test_name}.log" 53 54 echo "===> Running ${test_name} on device $1." 55 56 $WEBRTC_DIR/build/android/test_runner.py gtest \ 57 --output-directory $BUILD_DIR \ 58 --suite modules_tests \ 59 --gtest_filter "CodecSettings/*${test_name}*" \ 60 --shard-timeout $TIMEOUT \ 61 --runtime-deps-path ../empty-runtime-deps \ 62 --test-launcher-retry-limit 0 \ 63 --adb-path $ADB \ 64 --device $SERIAL \ 65 --verbose \ 66 2>&1 | tee -a ${log_name} 67 done 68 done 69done 70popd 71