OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Setup for linker tests.""" | 5 """Setup for linker tests.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import types | 10 import types |
11 | 11 |
12 import test_case | 12 import test_case |
13 import test_runner | 13 import test_runner |
14 | 14 |
15 from pylib import constants | |
16 | |
17 sys.path.insert(0, | |
18 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', | |
19 'common')) | |
20 import unittest_util | |
15 | 21 |
16 def Setup(options, devices): | 22 def Setup(options, devices): |
17 """Creates a list of test cases and a runner factory. | 23 """Creates a list of test cases and a runner factory. |
18 | 24 |
19 Returns: | 25 Returns: |
20 A tuple of (TestRunnerFactory, tests). | 26 A tuple of (TestRunnerFactory, tests). |
21 """ | 27 """ |
28 all_tests = [ | |
29 test_case.LinkerLibraryAddressTest(is_low_memory=False), | |
30 test_case.LinkerLibraryAddressTest(is_low_memory=True), | |
31 test_case.LinkerSharedRelroTest(is_low_memory=False), | |
32 test_case.LinkerSharedRelroTest(is_low_memory=True), | |
33 test_case.LinkerRandomizationTest(is_low_memory=False), | |
bulach
2013/10/07 16:49:44
probably less readable, but:
test_cases = [
test
digit1
2013/10/07 20:31:58
I see, good idea, but I think I've found something
| |
34 test_case.LinkerRandomizationTest(is_low_memory=True)] | |
22 | 35 |
23 all_tests = [ | 36 if options.test_filter: |
24 test_case.LinkerTestCase('ForRegularDevice', | 37 all_test_names = [ test.qualified_name for test in all_tests ] |
25 is_low_memory=False), | 38 filtered_test_names = unittest_util.FilterTestNames(all_test_names, |
26 test_case.LinkerTestCase('ForLowMemoryDevice', | 39 options.test_filter) |
27 is_low_memory=True) ] | 40 all_tests = [t for t in all_tests \ |
41 if t.qualified_name in filtered_test_names] | |
28 | 42 |
29 def TestRunnerFactory(device, shard_index): | 43 def TestRunnerFactory(device, shard_index): |
30 return test_runner.LinkerTestRunner( | 44 return test_runner.LinkerTestRunner( |
31 device, options.tool, options.push_deps, | 45 device, options.tool, options.push_deps, |
32 options.cleanup_test_files) | 46 options.cleanup_test_files) |
33 | 47 |
34 return (TestRunnerFactory, all_tests) | 48 return (TestRunnerFactory, all_tests) |
OLD | NEW |