Hash :
1ad27152
Author :
Date :
2023-04-18T12:17:00
Switch angle_trace_tests scripts to android_helper
out/Android/angle_trace_tests {args}
replaces
(cd out/Android; python3 ../../src/tests/run_angle_android_test.py {args})
changes this generated file:
% grep angle_android_test_runner out/Android/bin/run_angle_trace_tests
args = ['@WrappedPath(../../src/tests/angle_android_test_runner.py)', 'gtest', '--output-directory', '@WrappedPath(.)', '--wrapper-script-args', '--runtime-deps-path', '@WrappedPath(gen.runtime/src/tests/angle_trace_tests__test_runner_script.runtime_deps)', '--suite', 'angle_trace_tests']
android_helper.py is already what we use for running traces on bots
(we don't invoke out/Android/angle_trace_tests when IsAndroid())
so this change affects only local runs
Keep run_angle_android_test.py to be able to run other suites,
but now it takes --suite instead of a positional arg (which is
consistent with how scripts are invoked on CI)
Bug: chromium:1441148
Change-Id: I5af10e8df7d9a651e0a9d52e47e3bce28d7a931b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4442006
Reviewed-by: Cody Northrop <cnorthrop@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:
for test in tests:
print(test)
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(raw_args):
parser = argparse.ArgumentParser()
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(raw_args)
os.chdir(args.output_directory)
return RunAndroidTestSuite(args, extra_args)
if __name__ == "__main__":
sys.exit(main(sys.argv[2:]))