Hash :
2ce5a632
Author :
Date :
2023-01-18T11:01:41
Log screen state if log=debug. Prints either of: mScreenState=ON_UNLOCKED mScreenState=ON_LOCKED mScreenState=OFF_LOCKED Oddly, there doesn't seem to be a standard way to do this on Android, so using the nfc trick with "|| true" to ignore potential failures. Also setup logging using the util in run_angle_android_test as the current way seems to no longer be working. Bug: chromium:1405504 Change-Id: I448be86e8f0d72905948e68ffb076605273fa958 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4178011 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Auto-Submit: Roman Lavrov <romanl@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
#! /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_trace_tests \
# --filter='TraceTest.words_with_friends_2' \
# --no-warmup --steps-per-trial 1000 --trials 1)
import argparse
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 main():
parser = argparse.ArgumentParser()
parser.add_argument(
'suite',
help='Test suite to run.',
choices=['angle_end2end_tests', 'angle_perftests', 'angle_trace_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()
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_flags, 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_flags)[0]
if __name__ == '__main__':
sys.exit(main())