| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import os | 5 import os |
| 6 import pickle | 6 import pickle |
| 7 import re | 7 import re |
| 8 import shutil | 8 import shutil |
| 9 import tempfile | 9 import tempfile |
| 10 import unittest | 10 import unittest |
| 11 | 11 |
| 12 from telemetry import decorators | 12 from telemetry import decorators |
| 13 from telemetry.core import util | 13 from telemetry.core import util |
| 14 from telemetry.core.platform.profiler import android_profiling_helper | 14 from telemetry.core.platform.profiler import android_profiling_helper |
| 15 from telemetry.unittest_util import simple_mock | 15 from telemetry.unittest_util import simple_mock |
| 16 from telemetry.unittest_util import tab_test_case | 16 from telemetry.unittest_util import tab_test_case |
| 17 | 17 |
| 18 | 18 |
| 19 def _GetLibrariesMappedIntoProcesses(device, pids): | 19 def _GetLibrariesMappedIntoProcesses(device, pids): |
| 20 libs = set() | 20 libs = set() |
| 21 for pid in pids: | 21 for pid in pids: |
| 22 maps_file = '/proc/%d/maps' % pid | 22 maps_file = '/proc/%d/maps' % pid |
| 23 maps = device.ReadFile(maps_file, as_root=True) | 23 maps = device.ReadFile(maps_file, as_root=True).splitlines() |
| 24 for map_line in maps: | 24 for map_line in maps: |
| 25 lib = re.match(r'.*\s(/.*[.]so)$', map_line) | 25 lib = re.match(r'.*\s(/.*[.]so)$', map_line) |
| 26 if lib: | 26 if lib: |
| 27 libs.add(lib.group(1)) | 27 libs.add(lib.group(1)) |
| 28 return libs | 28 return libs |
| 29 | 29 |
| 30 | 30 |
| 31 class TestAndroidProfilingHelper(unittest.TestCase): | 31 class TestAndroidProfilingHelper(unittest.TestCase): |
| 32 | 32 |
| 33 def testGetRequiredLibrariesForPerfProfile(self): | 33 def testGetRequiredLibrariesForPerfProfile(self): |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 # Test fails: crbug.com/437081 | 132 # Test fails: crbug.com/437081 |
| 133 # @decorators.Enabled('android') | 133 # @decorators.Enabled('android') |
| 134 @decorators.Disabled | 134 @decorators.Disabled |
| 135 def testGetToolchainBinaryPath(self): | 135 def testGetToolchainBinaryPath(self): |
| 136 with tempfile.NamedTemporaryFile() as libc: | 136 with tempfile.NamedTemporaryFile() as libc: |
| 137 self._device.PullFile('/system/lib/libc.so', libc.name) | 137 self._device.PullFile('/system/lib/libc.so', libc.name) |
| 138 path = android_profiling_helper.GetToolchainBinaryPath(libc.name, | 138 path = android_profiling_helper.GetToolchainBinaryPath(libc.name, |
| 139 'objdump') | 139 'objdump') |
| 140 assert os.path.exists(path) | 140 assert os.path.exists(path) |
| OLD | NEW |