Hash :
b7bd0808
        
        Author :
  
        
        Date :
2022-06-06T10:54:30
        
      
Support running end2end tests. There is no batching though so all tests matching the filter will be ran at once which will block without any output until evertyhing is done (android runner runs tests in batches of 256 IIRC). Also make suite arg positional and explicitly list supported tests. Bug: angleproject:6854 Change-Id: Ibe108f24d6c3ec8b966eda1cf9ae92119a517548 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691048 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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
#! /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.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
    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(flags + extra_flags)[0]
if __name__ == '__main__':
    sys.exit(main())