Hash :
25def1a0
Author :
Date :
2023-05-11T17:52:09
Android test runner expects 'gtest' and marks test list gtest is passed as the first argument when running as out/Android/angle_trace_tests, previously skipped via argv[2:] --list-tests usually includes "Tests list:" / "End tests list." markers around the list - which is how GetTestsFromOutput finds them, but we didn't include them in stdout. There is some other noise in stdout on Android so instead of printing full stdout just add the markers back Bug: b/276474703 Change-Id: I20ba59eb25e543b005974674b0f3688cd767b1aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4519232 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
#! /usr/bin/env vpython3
#
# Copyright 2023 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.
#
# angle_android_test_runner.py:
# Runs (a subset of) ANGLE tests on Android using android_helper
# instead of chromium test_runner scripts. This script is integrated into
# gn builds via the android_test_runner_script var, which creates wrappers
# (out/<config>/angle_trace_tests) calling into this script
# with additional args like --output-directory=out/<config> etc
import argparse
import json
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
import angle_test_util
def AddCommonParserArgs(parser):
parser.add_argument(
'--suite',
help='Test suite to run.',
required=True,
choices=['angle_end2end_tests', 'angle_perftests', 'angle_trace_tests'])
parser.add_argument('-l', '--log', help='Logging level.', default='info')
parser.add_argument('--list-tests', help='List tests.', action='store_true')
parser.add_argument(
'-f',
'--filter',
'--isolated-script-test-filter',
'--gtest_filter',
type=str,
help='Test filter.')
def RunAndroidTestSuite(args, extra_args):
angle_test_util.SetupLogging(args.log.upper())
android_helper.Initialize(args.suite)
assert android_helper.IsAndroid()
rc, output, _ = android_helper.RunTests(
args.suite, ['--list-tests', '--verbose'] + extra_args, log_output=False)
if rc != 0:
logging.fatal('Could not find test list from test output:\n%s' % output)
return rc
tests = angle_test_util.GetTestsFromOutput(output)
if args.filter:
tests = angle_test_util.FilterTests(tests, args.filter)
if args.list_tests:
print('\n'.join(['Tests list:'] + tests + ['End tests list.']))
return 0
if args.suite == 'angle_trace_tests':
traces = set(android_helper.GetTraceFromTestName(test) for test in tests)
android_helper.PrepareRestrictedTraces(traces)
flags = ['--gtest_filter=' + args.filter] if args.filter else []
return android_helper.RunTests(args.suite, flags + extra_args)[0]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('test_type', choices=['gtest'])
parser.add_argument('--output-directory', required=True)
parser.add_argument('--wrapper-script-args')
parser.add_argument('--runtime-deps-path')
AddCommonParserArgs(parser)
args, extra_args = parser.parse_known_args()
os.chdir(args.output_directory)
return RunAndroidTestSuite(args, extra_args)
if __name__ == "__main__":
sys.exit(main())