OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 copy | 5 import copy |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import pickle | 8 import pickle |
9 import re | 9 import re |
10 | 10 |
11 from devil.android import apk_helper | 11 from devil.android import apk_helper |
12 from devil.android import md5sum | 12 from devil.android import md5sum |
13 from pylib import constants | 13 from pylib import constants |
14 from pylib.base import base_test_result | 14 from pylib.base import base_test_result |
15 from pylib.base import test_exception | 15 from pylib.base import test_exception |
16 from pylib.base import test_instance | 16 from pylib.base import test_instance |
17 from pylib.constants import host_paths | 17 from pylib.constants import host_paths |
18 from pylib.instrumentation import test_result | 18 from pylib.instrumentation import test_result |
19 from pylib.instrumentation import instrumentation_parser | 19 from pylib.instrumentation import instrumentation_parser |
| 20 from pylib.symbols import stack_symbolizer |
20 from pylib.utils import dexdump | 21 from pylib.utils import dexdump |
21 from pylib.utils import proguard | 22 from pylib.utils import proguard |
22 from pylib.utils import shared_preference_utils | 23 from pylib.utils import shared_preference_utils |
23 | 24 |
| 25 |
24 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): | 26 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
25 import unittest_util # pylint: disable=import-error | 27 import unittest_util # pylint: disable=import-error |
26 | 28 |
27 # Ref: http://developer.android.com/reference/android/app/Activity.html | 29 # Ref: http://developer.android.com/reference/android/app/Activity.html |
28 _ACTIVITY_RESULT_CANCELED = 0 | 30 _ACTIVITY_RESULT_CANCELED = 0 |
29 _ACTIVITY_RESULT_OK = -1 | 31 _ACTIVITY_RESULT_OK = -1 |
30 | 32 |
31 _COMMAND_LINE_PARAMETER = 'cmdlinearg-parameter' | 33 _COMMAND_LINE_PARAMETER = 'cmdlinearg-parameter' |
32 _DEFAULT_ANNOTATIONS = [ | 34 _DEFAULT_ANNOTATIONS = [ |
33 'SmallTest', 'MediumTest', 'LargeTest', 'EnormousTest', 'IntegrationTest'] | 35 'SmallTest', 'MediumTest', 'LargeTest', 'EnormousTest', 'IntegrationTest'] |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 438 |
437 self._render_results_dir = None | 439 self._render_results_dir = None |
438 self._screenshot_dir = None | 440 self._screenshot_dir = None |
439 self._timeout_scale = None | 441 self._timeout_scale = None |
440 self._initializeTestControlAttributes(args) | 442 self._initializeTestControlAttributes(args) |
441 | 443 |
442 self._coverage_directory = None | 444 self._coverage_directory = None |
443 self._initializeTestCoverageAttributes(args) | 445 self._initializeTestCoverageAttributes(args) |
444 | 446 |
445 self._store_tombstones = False | 447 self._store_tombstones = False |
| 448 self._symbolizer = None |
446 self._initializeTombstonesAttributes(args) | 449 self._initializeTombstonesAttributes(args) |
447 | 450 |
448 self._gs_results_bucket = None | 451 self._gs_results_bucket = None |
449 self._should_save_logcat = None | 452 self._should_save_logcat = None |
450 self._initializeLogAttributes(args) | 453 self._initializeLogAttributes(args) |
451 | 454 |
452 self._edit_shared_prefs = [] | 455 self._edit_shared_prefs = [] |
453 self._initializeEditPrefsAttributes(args) | 456 self._initializeEditPrefsAttributes(args) |
454 | 457 |
455 self._replace_system_package = None | 458 self._replace_system_package = None |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 self._render_results_dir = args.render_results_dir | 620 self._render_results_dir = args.render_results_dir |
618 self._screenshot_dir = args.screenshot_dir | 621 self._screenshot_dir = args.screenshot_dir |
619 self._timeout_scale = args.timeout_scale or 1 | 622 self._timeout_scale = args.timeout_scale or 1 |
620 self._ui_screenshot_dir = args.ui_screenshot_dir | 623 self._ui_screenshot_dir = args.ui_screenshot_dir |
621 | 624 |
622 def _initializeTestCoverageAttributes(self, args): | 625 def _initializeTestCoverageAttributes(self, args): |
623 self._coverage_directory = args.coverage_dir | 626 self._coverage_directory = args.coverage_dir |
624 | 627 |
625 def _initializeTombstonesAttributes(self, args): | 628 def _initializeTombstonesAttributes(self, args): |
626 self._store_tombstones = args.store_tombstones | 629 self._store_tombstones = args.store_tombstones |
| 630 self._symbolizer = stack_symbolizer.Symbolizer( |
| 631 self.apk_under_test.path if self.apk_under_test else None, |
| 632 args.enable_relocation_packing) |
627 | 633 |
628 def _initializeLogAttributes(self, args): | 634 def _initializeLogAttributes(self, args): |
629 self._gs_results_bucket = args.gs_results_bucket | 635 self._gs_results_bucket = args.gs_results_bucket |
630 self._should_save_logcat = bool(args.json_results_file) | 636 self._should_save_logcat = bool(args.json_results_file) |
631 | 637 |
632 def _initializeEditPrefsAttributes(self, args): | 638 def _initializeEditPrefsAttributes(self, args): |
633 if not hasattr(args, 'shared_prefs_file') or not args.shared_prefs_file: | 639 if not hasattr(args, 'shared_prefs_file') or not args.shared_prefs_file: |
634 return | 640 return |
635 if not isinstance(args.shared_prefs_file, str): | 641 if not isinstance(args.shared_prefs_file, str): |
636 logging.warning("Given non-string for a filepath") | 642 logging.warning("Given non-string for a filepath") |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 716 |
711 @property | 717 @property |
712 def store_tombstones(self): | 718 def store_tombstones(self): |
713 return self._store_tombstones | 719 return self._store_tombstones |
714 | 720 |
715 @property | 721 @property |
716 def suite(self): | 722 def suite(self): |
717 return self._suite | 723 return self._suite |
718 | 724 |
719 @property | 725 @property |
| 726 def symbolizer(self): |
| 727 return self._symbolizer |
| 728 |
| 729 @property |
720 def test_apk(self): | 730 def test_apk(self): |
721 return self._test_apk | 731 return self._test_apk |
722 | 732 |
723 @property | 733 @property |
724 def test_apk_incremental_install_script(self): | 734 def test_apk_incremental_install_script(self): |
725 return self._test_apk_incremental_install_script | 735 return self._test_apk_incremental_install_script |
726 | 736 |
727 @property | 737 @property |
728 def test_jar(self): | 738 def test_jar(self): |
729 return self._test_jar | 739 return self._test_jar |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 return ParseAmInstrumentRawOutput(raw_output) | 849 return ParseAmInstrumentRawOutput(raw_output) |
840 | 850 |
841 @staticmethod | 851 @staticmethod |
842 def GenerateTestResults( | 852 def GenerateTestResults( |
843 result_code, result_bundle, statuses, start_ms, duration_ms): | 853 result_code, result_bundle, statuses, start_ms, duration_ms): |
844 return GenerateTestResults(result_code, result_bundle, statuses, | 854 return GenerateTestResults(result_code, result_bundle, statuses, |
845 start_ms, duration_ms) | 855 start_ms, duration_ms) |
846 | 856 |
847 #override | 857 #override |
848 def TearDown(self): | 858 def TearDown(self): |
849 pass | 859 self.symbolizer.CleanUp() |
OLD | NEW |