Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: build/android/pylib/host_driven/python_test_base.py

Issue 18770008: [Android] Redesigns the sharder to allow replicated vs distributed tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-adds -f short form to gtest_filter switch Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Base class for Android Python-driven tests. 5 """Base class for Android Python-driven tests.
6 6
7 This test case is intended to serve as the base class for any Python-driven 7 This test case is intended to serve as the base class for any Python-driven
8 tests. It is similar to the Python unitttest module in that the user's tests 8 tests. It is similar to the Python unitttest module in that the user's tests
9 inherit from this case and add their tests in that case. 9 inherit from this case and add their tests in that case.
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 fname: filename for the test (e.g. foo/bar/baz/tests/FooTest.py) 71 fname: filename for the test (e.g. foo/bar/baz/tests/FooTest.py)
72 suite: name of the Java test suite (e.g. FooTest) 72 suite: name of the Java test suite (e.g. FooTest)
73 test: name of the test method to run (e.g. testFooBar) 73 test: name of the test method to run (e.g. testFooBar)
74 74
75 Returns: 75 Returns:
76 TestRunResults object with a single test result. 76 TestRunResults object with a single test result.
77 """ 77 """
78 test = self._ComposeFullTestName(fname, suite, test) 78 test = self._ComposeFullTestName(fname, suite, test)
79 test_pkg = test_package.TestPackage( 79 test_pkg = test_package.TestPackage(
80 self.options.test_apk_path, self.options.test_apk_jar_path) 80 self.options.test_apk_path, self.options.test_apk_jar_path)
81 java_test_runner = test_runner.TestRunner(self.options, self.device_id, 81 java_test_runner = test_runner.TestRunner(self.options.build_type,
82 self.options.test_data,
83 self.options.install_apk,
84 self.options.save_perf_json,
85 self.options.screenshot_failures,
86 self.options.tool,
87 self.options.wait_for_debugger,
88 self.options.disable_assertions,
89 self.options.push_deps,
90 self.options.cleanup_test_files,
91 self.device_id,
82 self.shard_index, test_pkg, 92 self.shard_index, test_pkg,
83 self.ports_to_forward) 93 self.ports_to_forward)
84 try: 94 try:
85 java_test_runner.SetUp() 95 java_test_runner.SetUp()
86 return java_test_runner.RunTest(test)[0] 96 return java_test_runner.RunTest(test)[0]
87 finally: 97 finally:
88 java_test_runner.TearDown() 98 java_test_runner.TearDown()
89 99
90 def _RunJavaTests(self, fname, tests): 100 def _RunJavaTests(self, fname, tests):
91 """Calls a list of tests and stops at the first test failure. 101 """Calls a list of tests and stops at the first test failure.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 135
126 def _ComposeFullTestName(self, fname, suite, test): 136 def _ComposeFullTestName(self, fname, suite, test):
127 package_name = self._GetPackageName(fname) 137 package_name = self._GetPackageName(fname)
128 return package_name + '.' + suite + '#' + test 138 return package_name + '.' + suite + '#' + test
129 139
130 def _GetPackageName(self, fname): 140 def _GetPackageName(self, fname):
131 """Extracts the package name from the test file path.""" 141 """Extracts the package name from the test file path."""
132 dirname = os.path.dirname(fname) 142 dirname = os.path.dirname(fname)
133 package = dirname[dirname.rfind(BASE_ROOT) + len(BASE_ROOT):] 143 package = dirname[dirname.rfind(BASE_ROOT) + len(BASE_ROOT):]
134 return package.replace(os.sep, '.') 144 return package.replace(os.sep, '.')
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/host_driven/python_test_sharder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698