| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Performance runner for d8. | 7 Performance runner for d8. |
| 8 | 8 |
| 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json | 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json |
| 10 | 10 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 def _SendCommand(self, cmd): | 532 def _SendCommand(self, cmd): |
| 533 logging.info("adb -s %s %s" % (str(self.device), cmd)) | 533 logging.info("adb -s %s %s" % (str(self.device), cmd)) |
| 534 return self.adb.SendCommand(cmd, timeout_time=60) | 534 return self.adb.SendCommand(cmd, timeout_time=60) |
| 535 | 535 |
| 536 def _PushFile(self, host_dir, file_name, target_rel="."): | 536 def _PushFile(self, host_dir, file_name, target_rel="."): |
| 537 file_on_host = os.path.join(host_dir, file_name) | 537 file_on_host = os.path.join(host_dir, file_name) |
| 538 file_on_device_tmp = os.path.join( | 538 file_on_device_tmp = os.path.join( |
| 539 AndroidPlatform.DEVICE_DIR, "_tmp_", file_name) | 539 AndroidPlatform.DEVICE_DIR, "_tmp_", file_name) |
| 540 file_on_device = os.path.join( | 540 file_on_device = os.path.join( |
| 541 AndroidPlatform.DEVICE_DIR, target_rel, file_name) | 541 AndroidPlatform.DEVICE_DIR, target_rel, file_name) |
| 542 folder_on_device = os.path.dirname(file_on_device) |
| 542 | 543 |
| 543 # Only push files not yet pushed in one execution. | 544 # Only push files not yet pushed in one execution. |
| 544 if file_on_host in self.pushed: | 545 if file_on_host in self.pushed: |
| 545 return | 546 return |
| 546 else: | 547 else: |
| 547 self.pushed.add(file_on_host) | 548 self.pushed.add(file_on_host) |
| 548 | 549 |
| 549 # Work-around for "text file busy" errors. Push the files to a temporary | 550 # Work-around for "text file busy" errors. Push the files to a temporary |
| 550 # location and then move them with a shell command. | 551 # location and then copy them with a shell command. |
| 551 output = self._SendCommand( | 552 output = self._SendCommand( |
| 552 "push %s %s" % (file_on_host, file_on_device_tmp)) | 553 "push %s %s" % (file_on_host, file_on_device_tmp)) |
| 553 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)". | 554 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)". |
| 554 # Errors look like this: "failed to copy ... ". | 555 # Errors look like this: "failed to copy ... ". |
| 555 if output and not re.search('^[0-9]', output.splitlines()[-1]): | 556 if output and not re.search('^[0-9]', output.splitlines()[-1]): |
| 556 logging.critical('PUSH FAILED: ' + output) | 557 logging.critical('PUSH FAILED: ' + output) |
| 557 self._SendCommand("shell mv %s %s" % (file_on_device_tmp, file_on_device)) | 558 self._SendCommand("shell mkdir -p %s" % folder_on_device) |
| 559 self._SendCommand("shell cp %s %s" % (file_on_device_tmp, file_on_device)) |
| 558 | 560 |
| 559 def PreTests(self, node, path): | 561 def PreTests(self, node, path): |
| 560 suite_dir = os.path.abspath(os.path.dirname(path)) | 562 suite_dir = os.path.abspath(os.path.dirname(path)) |
| 561 if node.path: | 563 if node.path: |
| 562 bench_rel = os.path.normpath(os.path.join(*node.path)) | 564 bench_rel = os.path.normpath(os.path.join(*node.path)) |
| 563 bench_abs = os.path.join(suite_dir, bench_rel) | 565 bench_abs = os.path.join(suite_dir, bench_rel) |
| 564 else: | 566 else: |
| 565 bench_rel = "." | 567 bench_rel = "." |
| 566 bench_abs = suite_dir | 568 bench_abs = suite_dir |
| 567 | 569 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 697 |
| 696 if options.json_test_results: | 698 if options.json_test_results: |
| 697 results.WriteToFile(options.json_test_results) | 699 results.WriteToFile(options.json_test_results) |
| 698 else: # pragma: no cover | 700 else: # pragma: no cover |
| 699 print results | 701 print results |
| 700 | 702 |
| 701 return min(1, len(results.errors)) | 703 return min(1, len(results.errors)) |
| 702 | 704 |
| 703 if __name__ == "__main__": # pragma: no cover | 705 if __name__ == "__main__": # pragma: no cover |
| 704 sys.exit(Main(sys.argv[1:])) | 706 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |