cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / build / android / pylib / linker / setup.py
blobe561957f6209169773b0f8062f72a2f596f67713
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Setup for linker tests."""
7 import logging
8 import os
9 import sys
11 from pylib import constants
12 from pylib.linker import test_case
13 from pylib.linker import test_runner
15 sys.path.insert(0,
16 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
17 'common'))
18 import unittest_util # pylint: disable=F0401
20 # ModernLinker requires Android M (API level 23) or later.
21 _VERSION_SDK_PROPERTY = 'ro.build.version.sdk'
22 _MODERN_LINKER_MINIMUM_SDK_INT = 23
24 def Setup(args, devices):
25 """Creates a list of test cases and a runner factory.
27 Args:
28 args: an argparse.Namespace object.
29 devices: an iterable of available devices.
30 Returns:
31 A tuple of (TestRunnerFactory, tests).
32 """
33 legacy_linker_tests = [
34 test_case.LinkerSharedRelroTest(is_modern_linker=False,
35 is_low_memory=False),
36 test_case.LinkerSharedRelroTest(is_modern_linker=False,
37 is_low_memory=True),
39 modern_linker_tests = [
40 test_case.LinkerSharedRelroTest(is_modern_linker=True),
43 min_sdk_int = 1 << 31
44 for device in devices:
45 min_sdk_int = min(min_sdk_int, device.build_version_sdk)
47 if min_sdk_int >= _MODERN_LINKER_MINIMUM_SDK_INT:
48 all_tests = legacy_linker_tests + modern_linker_tests
49 else:
50 all_tests = legacy_linker_tests
51 logging.warn('Not running LinkerModern tests (requires API %d, found %d)',
52 _MODERN_LINKER_MINIMUM_SDK_INT, min_sdk_int)
54 if args.test_filter:
55 all_test_names = [test.qualified_name for test in all_tests]
56 filtered_test_names = unittest_util.FilterTestNames(all_test_names,
57 args.test_filter)
58 all_tests = [t for t in all_tests \
59 if t.qualified_name in filtered_test_names]
61 def TestRunnerFactory(device, _shard_index):
62 return test_runner.LinkerTestRunner(device, args.tool)
64 return (TestRunnerFactory, all_tests)