| 965 | |
| 966 | |
| 967 | class AndroidPlatform(Platform): # pragma: no cover |
| 968 | |
| 969 | def __init__(self, args): |
| 970 | super(AndroidPlatform, self).__init__(args) |
| 971 | self.driver = android.Driver.instance(args.device) |
| 972 | |
| 973 | def PreExecution(self): |
| 974 | self.driver.set_high_perf_mode() |
| 975 | |
| 976 | def PostExecution(self): |
| 977 | self.driver.set_default_perf_mode() |
| 978 | self.driver.tear_down() |
| 979 | |
| 980 | def PreTests(self, node, path): |
| 981 | if isinstance(node, RunnableConfig): |
| 982 | node.ChangeCWD(path) |
| 983 | suite_dir = os.path.abspath(os.path.dirname(path)) |
| 984 | if node.path: |
| 985 | bench_rel = os.path.normpath(os.path.join(*node.path)) |
| 986 | bench_abs = os.path.join(suite_dir, bench_rel) |
| 987 | else: |
| 988 | bench_rel = '.' |
| 989 | bench_abs = suite_dir |
| 990 | |
| 991 | self.driver.push_executable(self.shell_dir, 'bin', node.binary) |
| 992 | if self.shell_dir_secondary: |
| 993 | self.driver.push_executable( |
| 994 | self.shell_dir_secondary, 'bin_secondary', node.binary) |
| 995 | |
| 996 | if isinstance(node, RunnableConfig): |
| 997 | self.driver.push_file(bench_abs, node.main, bench_rel) |
| 998 | for resource in node.resources: |
| 999 | if resource == '*': |
| 1000 | self.driver.push_files_rec(bench_abs, bench_rel) |
| 1001 | else: |
| 1002 | self.driver.push_file(bench_abs, resource, bench_rel) |
| 1003 | |
| 1004 | def _Run(self, runnable, count, secondary=False, post_process=True): |
| 1005 | target_dir = 'bin_secondary' if secondary else 'bin' |
| 1006 | self.driver.drop_ram_caches() |
| 1007 | |
| 1008 | # Relative path to benchmark directory. |
| 1009 | if runnable.path: |
| 1010 | bench_rel = os.path.normpath(os.path.join(*runnable.path)) |
| 1011 | else: |
| 1012 | bench_rel = '.' |
| 1013 | |
| 1014 | logcat_file = None |
| 1015 | if self.args.dump_logcats_to: |
| 1016 | runnable_name = '-'.join(runnable.graphs) |
| 1017 | logcat_file = os.path.join( |
| 1018 | self.args.dump_logcats_to, 'logcat-%s-#%d%s.log' % ( |
| 1019 | runnable_name, count + 1, '-secondary' if secondary else '')) |
| 1020 | logging.debug('Dumping logcat into %s', logcat_file) |
| 1021 | |
| 1022 | output = Output() |
| 1023 | output.start_time = time.time() |
| 1024 | try: |
no outgoing calls
no test coverage detected
searching dependent graphs…