| OLD | NEW |
| 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 """ | 5 """ |
| 6 Classes in this file define additional actions that need to be taken to run a | 6 Classes in this file define additional actions that need to be taken to run a |
| 7 test under some kind of runtime error detection tool. | 7 test under some kind of runtime error detection tool. |
| 8 | 8 |
| 9 The interface is intended to be used as follows. | 9 The interface is intended to be used as follows. |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 def GetUtilWrapper(self): | 117 def GetUtilWrapper(self): |
| 118 """Returns the wrapper for utilities, such as forwarder. | 118 """Returns the wrapper for utilities, such as forwarder. |
| 119 | 119 |
| 120 AddressSanitizer wrapper must be added to all instrumented binaries, | 120 AddressSanitizer wrapper must be added to all instrumented binaries, |
| 121 including forwarder and the like. This can be removed if such binaries | 121 including forwarder and the like. This can be removed if such binaries |
| 122 were built without instrumentation. """ | 122 were built without instrumentation. """ |
| 123 return self.GetTestWrapper() | 123 return self.GetTestWrapper() |
| 124 | 124 |
| 125 def SetupEnvironment(self): | 125 def SetupEnvironment(self): |
| 126 self._adb.EnableAdbRoot() | 126 self._adb.EnableAdbRoot() |
| 127 self._adb.RunShellCommand('setenforce 0') |
| 127 for prop in self._wrap_properties: | 128 for prop in self._wrap_properties: |
| 128 self._adb.RunShellCommand('setprop %s "logwrapper %s"' % ( | 129 self._adb.RunShellCommand('setprop %s "logwrapper %s"' % ( |
| 129 prop, self.GetTestWrapper())) | 130 prop, self.GetTestWrapper())) |
| 130 SetChromeTimeoutScale(self._adb, self.GetTimeoutScale()) | 131 SetChromeTimeoutScale(self._adb, self.GetTimeoutScale()) |
| 131 | 132 |
| 132 def CleanUpEnvironment(self): | 133 def CleanUpEnvironment(self): |
| 133 for prop in self._wrap_properties: | 134 for prop in self._wrap_properties: |
| 134 self._adb.RunShellCommand('setprop %s ""' % (prop,)) | 135 self._adb.RunShellCommand('setprop %s ""' % (prop,)) |
| 135 SetChromeTimeoutScale(self._adb, None) | 136 SetChromeTimeoutScale(self._adb, None) |
| 136 | 137 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 160 ValgrindTool.VGLOGS_DIR)) | 161 ValgrindTool.VGLOGS_DIR)) |
| 161 files = self.GetFilesForTool() | 162 files = self.GetFilesForTool() |
| 162 for f in files: | 163 for f in files: |
| 163 self._adb.PushIfNeeded(os.path.join(DIR_SOURCE_ROOT, f), | 164 self._adb.PushIfNeeded(os.path.join(DIR_SOURCE_ROOT, f), |
| 164 os.path.join(ValgrindTool.VG_DIR, | 165 os.path.join(ValgrindTool.VG_DIR, |
| 165 os.path.basename(f))) | 166 os.path.basename(f))) |
| 166 | 167 |
| 167 def SetupEnvironment(self): | 168 def SetupEnvironment(self): |
| 168 """Sets up device environment.""" | 169 """Sets up device environment.""" |
| 169 self._adb.RunShellCommand('chmod 777 /data/local/tmp') | 170 self._adb.RunShellCommand('chmod 777 /data/local/tmp') |
| 171 self._adb.RunShellCommand('setenforce 0') |
| 170 for prop in self._wrap_properties: | 172 for prop in self._wrap_properties: |
| 171 self._adb.RunShellCommand('setprop %s "logwrapper %s"' % ( | 173 self._adb.RunShellCommand('setprop %s "logwrapper %s"' % ( |
| 172 prop, self.GetTestWrapper())) | 174 prop, self.GetTestWrapper())) |
| 173 SetChromeTimeoutScale(self._adb, self.GetTimeoutScale()) | 175 SetChromeTimeoutScale(self._adb, self.GetTimeoutScale()) |
| 174 | 176 |
| 175 def CleanUpEnvironment(self): | 177 def CleanUpEnvironment(self): |
| 176 """Cleans up device environment.""" | 178 """Cleans up device environment.""" |
| 177 for prop in self._wrap_properties: | 179 for prop in self._wrap_properties: |
| 178 self._adb.RunShellCommand('setprop %s ""' % (prop,)) | 180 self._adb.RunShellCommand('setprop %s ""' % (prop,)) |
| 179 SetChromeTimeoutScale(self._adb, None) | 181 SetChromeTimeoutScale(self._adb, None) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if not tool_name: | 257 if not tool_name: |
| 256 return BaseTool() | 258 return BaseTool() |
| 257 | 259 |
| 258 ctor = TOOL_REGISTRY.get(tool_name) | 260 ctor = TOOL_REGISTRY.get(tool_name) |
| 259 if ctor: | 261 if ctor: |
| 260 return ctor(adb) | 262 return ctor(adb) |
| 261 else: | 263 else: |
| 262 print 'Unknown tool %s, available tools: %s' % ( | 264 print 'Unknown tool %s, available tools: %s' % ( |
| 263 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) | 265 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) |
| 264 sys.exit(1) | 266 sys.exit(1) |
| OLD | NEW |