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

Side by Side Diff: build/android/pylib/gtest/test_package_apk.py

Issue 15942016: Creates a new test running script test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts flakiness server change, uses os.path.join 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 """Defines TestPackageApk to help run APK-based native tests."""
5 6
6 import logging 7 import logging
7 import os 8 import os
8 import shlex 9 import shlex
9 import sys 10 import sys
10 import tempfile 11 import tempfile
11 import time 12 import time
12 13
13 from pylib import android_commands 14 from pylib import android_commands
14 from pylib import constants 15 from pylib import constants
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 def GetAllTests(self): 90 def GetAllTests(self):
90 """Returns a list of all tests available in the test suite.""" 91 """Returns a list of all tests available in the test suite."""
91 self._CreateTestRunnerScript('--gtest_list_tests') 92 self._CreateTestRunnerScript('--gtest_list_tests')
92 try: 93 try:
93 self.tool.SetupEnvironment() 94 self.tool.SetupEnvironment()
94 # Clear and start monitoring logcat. 95 # Clear and start monitoring logcat.
95 self._ClearFifo() 96 self._ClearFifo()
96 self._StartActivity() 97 self._StartActivity()
97 # Wait for native test to complete. 98 # Wait for native test to complete.
98 p = self._WatchFifo(timeout=30 * self.tool.GetTimeoutScale()) 99 p = self._WatchFifo(timeout=30 * self.tool.GetTimeoutScale())
99 p.expect("<<ScopedMainEntryLogger") 100 p.expect('<<ScopedMainEntryLogger')
100 p.close() 101 p.close()
101 finally: 102 finally:
102 self.tool.CleanUpEnvironment() 103 self.tool.CleanUpEnvironment()
103 # We need to strip the trailing newline. 104 # We need to strip the trailing newline.
104 content = [line.rstrip() for line in p.before.splitlines()] 105 content = [line.rstrip() for line in p.before.splitlines()]
105 ret = self._ParseGTestListTests(content) 106 ret = self._ParseGTestListTests(content)
106 return ret 107 return ret
107 108
108 def CreateTestRunnerScript(self, gtest_filter, test_arguments): 109 def CreateTestRunnerScript(self, test_filter, test_arguments):
109 self._CreateTestRunnerScript('--gtest_filter=%s %s' % (gtest_filter, 110 self._CreateTestRunnerScript('--gtest_filter=%s %s' % (test_filter,
110 test_arguments)) 111 test_arguments))
111 112
112 def RunTestsAndListResults(self): 113 def RunTestsAndListResults(self):
113 try: 114 try:
114 self.tool.SetupEnvironment() 115 self.tool.SetupEnvironment()
115 self._ClearFifo() 116 self._ClearFifo()
116 self._StartActivity() 117 self._StartActivity()
117 finally: 118 finally:
118 self.tool.CleanUpEnvironment() 119 self.tool.CleanUpEnvironment()
119 logfile = android_commands.NewLineNormalizer(sys.stdout) 120 logfile = android_commands.NewLineNormalizer(sys.stdout)
(...skipping 12 matching lines...) Expand all
132 if self._NeedsInstall(): 133 if self._NeedsInstall():
133 # Always uninstall the previous one (by activity name); we don't 134 # Always uninstall the previous one (by activity name); we don't
134 # know what was embedded in it. 135 # know what was embedded in it.
135 self.adb.ManagedInstall(self.test_suite_full, False, 136 self.adb.ManagedInstall(self.test_suite_full, False,
136 package_name=self._apk_package_name) 137 package_name=self._apk_package_name)
137 138
138 def _GetTestSuiteBaseName(self): 139 def _GetTestSuiteBaseName(self):
139 """Returns the base name of the test suite.""" 140 """Returns the base name of the test suite."""
140 # APK test suite names end with '-debug.apk' 141 # APK test suite names end with '-debug.apk'
141 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] 142 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0]
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/dispatch.py ('k') | build/android/pylib/gtest/test_package_executable.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698