Lines Matching refs:self
25 def setUp(self): argument
26 super(TestNativeProfiling, self).setUp()
27 self.is_rooted_device = TestHelper.adb.switch_to_root()
29 def test_profile_cmd(self): argument
30 self.run_cmd(["app_profiler.py", "-cmd", "pm -l", "--disable_adb_root"])
31 self.run_cmd(["report.py", "-g", "-o", "report.txt"])
33 def test_profile_native_program(self): argument
34 if not self.is_rooted_device:
36 self.run_cmd(["app_profiler.py", "-np", "surfaceflinger"])
37 self.run_cmd(["report.py", "-g", "-o", "report.txt"])
38 self.run_cmd([INFERNO_SCRIPT, "-sc"])
39 self.run_cmd([INFERNO_SCRIPT, "-np", "surfaceflinger"])
41 def test_profile_pids(self): argument
42 if not self.is_rooted_device:
45 self.run_cmd(['app_profiler.py', '--pid', str(pid), '-r', '--duration 1'])
46 self.run_cmd(['app_profiler.py', '--pid', str(pid), str(pid), '-r', '--duration 1'])
47 self.run_cmd(['app_profiler.py', '--tid', str(pid), '-r', '--duration 1'])
48 self.run_cmd(['app_profiler.py', '--tid', str(pid), str(pid), '-r', '--duration 1'])
49 self.run_cmd([INFERNO_SCRIPT, '--pid', str(pid), '-t', '1'])
51 def test_profile_system_wide(self): argument
52 if not self.is_rooted_device:
54 self.run_cmd(['app_profiler.py', '--system_wide', '-r', '--duration 1'])
58 def setUp(self): argument
59 super(TestNativeLibDownloader, self).setUp()
60 self.adb = TestHelper.adb
61 self.adb.check_run(['shell', 'rm', '-rf', '/data/local/tmp/native_libs'])
62 self.ndk_path = TestHelper.ndk_path
64 def tearDown(self): argument
65 self.adb.check_run(['shell', 'rm', '-rf', '/data/local/tmp/native_libs'])
66 super(TestNativeLibDownloader, self).tearDown()
68 def list_lib_on_device(self, path): argument
69 result, output = self.adb.run_and_return_output(['shell', 'ls', '-llc', path])
72 def test_smoke(self): argument
74 downloader = NativeLibDownloader(self.ndk_path, 'arm64', self.adb)
77 self.assertEqual(len(downloader.host_build_id_map), 2)
79 self.assertEqual(entry.score, 3)
81 self.assertEqual(len(downloader.device_build_id_map), 0)
91 self.assertEqual(len(downloader.device_build_id_map), sync_count)
96 self.assertTrue(build_id in downloader.device_build_id_map)
97 self.assertEqual(name, downloader.device_build_id_map[build_id])
98 self.assertTrue(self.list_lib_on_device(downloader.dir_on_device + name))
100 self.assertTrue(build_id not in downloader.device_build_id_map)
101 self.assertFalse(self.list_lib_on_device(downloader.dir_on_device + name))
103 self.adb.run(['pull', '/data/local/tmp/native_libs/build_id_list',
106 self.assertEqual(bytes_to_str(fh.read()),
110 def test_handle_wrong_build_id_list(self): argument
113 self.adb.check_run(['shell', 'mkdir', '-p', '/data/local/tmp/native_libs'])
114 self.adb.check_run(['push', 'build_id_list', '/data/local/tmp/native_libs'])
116 downloader = NativeLibDownloader(self.ndk_path, 'arm64', self.adb)
118 self.assertEqual(len(downloader.device_build_id_map), 0)
120 def test_download_file_without_build_id(self): argument
121 downloader = NativeLibDownloader(self.ndk_path, 'x86_64', self.adb)
126 self.assertIn(name, downloader.no_build_id_file_map)
130 target_file_stat = self.list_lib_on_device(target_file)
131 self.assertTrue(target_file_stat)
135 self.assertEqual(target_file_stat, self.list_lib_on_device(target_file))
138 self.adb.check_run(['shell', 'truncate', '-s', '0', target_file])
139 target_file_stat = self.list_lib_on_device(target_file)
141 self.assertNotEqual(target_file_stat, self.list_lib_on_device(target_file))