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 """Generates test runner factory and tests for instrumentation tests."""
10 from pylib.instrumentation import test_package
11 from pylib.instrumentation import test_runner
14 def Setup(test_options):
15 """Create and return the test runner factory and tests.
18 test_options: An InstrumentationOptions object.
21 A tuple of (TestRunnerFactory, tests).
23 if (test_options.coverage_dir and not
24 os.path.exists(test_options.coverage_dir)):
25 os.makedirs(test_options.coverage_dir)
27 test_pkg = test_package.TestPackage(test_options.test_apk_path,
28 test_options.test_apk_jar_path)
29 tests = test_pkg.GetAllMatchingTests(
30 test_options.annotations,
31 test_options.exclude_annotations,
32 test_options.test_filter)
34 logging.error('No instrumentation tests to run with current args.')
36 def TestRunnerFactory(device, shard_index):
37 return test_runner.TestRunner(test_options, device, shard_index,
40 return (TestRunnerFactory, tests)