Hash :
b71c6427
Author :
Date :
2022-05-31T16:23:51
Add a wrapper script to run traces using android_helper. Also add missing `appops set MANAGE_EXTERNAL_STORAGE` that appears to be necessary on newer builds (catapult does it starting from Android 11). Add a hash check to skip transferring .gz files that are already there. Bug: angleproject:6854 Change-Id: Ib612d1235fe1274b8fea47718af8389e8810d34e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679486 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com> Auto-Submit: Roman Lavrov <romanl@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#! /usr/bin/env python3
#
# Copyright 2022 The ANGLE 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.
#
# run_angle_android_test.py:
# Runs ANGLE tests using android_helper wrapper. Example:
# (cd out/Android; ../../src/tests/run_angle_android_test.py \
# --suite=angle_perftests \
# --filter='TracePerfTest.Run/*_words_with_friends_2' \
# --no-warmup --steps-per-trial 1000 --trials 1)
import argparse
import fnmatch
import logging
import os
import pathlib
import sys
PY_UTILS = str(pathlib.Path(__file__).resolve().parent / 'py_utils')
if PY_UTILS not in sys.path:
os.stat(PY_UTILS) and sys.path.insert(0, PY_UTILS)
import android_helper
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--suite', help='Test suite to run (e.g. angle_perftests).', required=True)
parser.add_argument(
'-f',
'--filter',
'--isolated-script-test-filter',
'--gtest_filter',
type=str,
help='Test filter.')
parser.add_argument('--list-tests', help='List tests.', action='store_true')
parser.add_argument('-l', '--log', help='Logging level.', default='info')
args, extra_flags = parser.parse_known_args()
logging.basicConfig(level=args.log.upper())
android_helper.PrepareTestSuite(args.suite)
tests = android_helper.ListTests()
if args.filter:
tests = [test for test in tests if fnmatch.fnmatch(test, args.filter)]
if args.list_tests:
for test in tests:
print(test)
return 0
traces = set(android_helper.GetTraceFromTestName(test) for test in tests)
android_helper.PrepareRestrictedTraces(traces, check_hash=True)
return android_helper.RunTests(['--gtest_filter=' + args.filter] + extra_flags)[0]
if __name__ == '__main__':
sys.exit(main())