Hash :
88b05d3c
Author :
Date :
2022-08-03T15:21:00
Use globals in android_helper to simplify flow. Explicit .Initialize(suite_name) call to detect Android Track suite (apk) that was installed. We use the same package com.android.angle.test in multiple apks (eg system info and perftests) so keeping track of which one is currently installed avoids the need to take care of it manually (with PrepareTestSuite). Bug: angleproject:7299 Change-Id: I4b96f0fb24e38fc42d3814fb0eeda5aae527de5a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3808292 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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 63 64 65 66
#! /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 \
# 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.', choices=['angle_perftests', 'angle_end2end_tests'])
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.Initialize(args.suite)
assert android_helper.IsAndroid()
tests = android_helper.ListTests(args.suite)
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
if args.suite == 'angle_perftests':
traces = set(android_helper.GetTraceFromTestName(test) for test in tests)
android_helper.PrepareRestrictedTraces(traces, check_hash=True)
flags = ['--gtest_filter=' + args.filter] if args.filter else []
return android_helper.RunTests(args.suite, flags + extra_flags)[0]
if __name__ == '__main__':
sys.exit(main())