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

Side by Side Diff: tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py

Issue 806843002: Reland of Migrate DeviceUtils.ReadFile to adb_wrapper (try 3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable command line test only for android Created 5 years, 11 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
« no previous file with comments | « tools/telemetry/telemetry/core/platform/power_monitor/android_temperature_monitor_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/platform/power_monitor/android_temperature_monitor_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698