| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Base class for linker-specific test cases. | 5 """Base class for linker-specific test cases. |
| 6 | 6 |
| 7 The custom dynamic linker can only be tested through a custom test case | 7 The custom dynamic linker can only be tested through a custom test case |
| 8 for various technical reasons: | 8 for various technical reasons: |
| 9 | 9 |
| 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or | 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line' | 52 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line' |
| 53 | 53 |
| 54 # Path to the Linker.java source file. | 54 # Path to the Linker.java source file. |
| 55 _LINKER_JAVA_SOURCE_PATH = ( | 55 _LINKER_JAVA_SOURCE_PATH = ( |
| 56 'base/android/java/src/org/chromium/base/library_loader/Linker.java') | 56 'base/android/java/src/org/chromium/base/library_loader/Linker.java') |
| 57 | 57 |
| 58 # A regular expression used to extract the browser shared RELRO configuration | 58 # A regular expression used to extract the browser shared RELRO configuration |
| 59 # from the Java source file above. | 59 # from the Java source file above. |
| 60 _RE_LINKER_BROWSER_CONFIG = re.compile( | 60 _RE_LINKER_BROWSER_CONFIG = re.compile( |
| 61 r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' + | 61 r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' + |
| 62 'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*', | 62 r'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*', |
| 63 re.MULTILINE | re.DOTALL) | 63 re.MULTILINE | re.DOTALL) |
| 64 | 64 |
| 65 # Logcat filters used during each test. Only the 'chromium' one is really | 65 # Logcat filters used during each test. Only the 'chromium' one is really |
| 66 # needed, but the logs are added to the TestResult in case of error, and | 66 # needed, but the logs are added to the TestResult in case of error, and |
| 67 # it is handy to have the 'chromium_android_linker' ones as well when | 67 # it is handy to have the 'chromium_android_linker' ones as well when |
| 68 # troubleshooting. | 68 # troubleshooting. |
| 69 _LOGCAT_FILTERS = [ '*:s', 'chromium:v', 'chromium_android_linker:v' ] | 69 _LOGCAT_FILTERS = ['*:s', 'chromium:v', 'chromium_android_linker:v'] |
| 70 #_LOGCAT_FILTERS = [ '*:v' ] ## DEBUG | 70 #_LOGCAT_FILTERS = ['*:v'] ## DEBUG |
| 71 | 71 |
| 72 # Regular expression used to match status lines in logcat. | 72 # Regular expression used to match status lines in logcat. |
| 73 re_status_line = re.compile(r'(BROWSER|RENDERER)_LINKER_TEST: (FAIL|SUCCESS)') | 73 re_status_line = re.compile(r'(BROWSER|RENDERER)_LINKER_TEST: (FAIL|SUCCESS)') |
| 74 | 74 |
| 75 # Regular expression used to mach library load addresses in logcat. | 75 # Regular expression used to mach library load addresses in logcat. |
| 76 re_library_address = re.compile( | 76 re_library_address = re.compile( |
| 77 r'(BROWSER|RENDERER)_LIBRARY_ADDRESS: (\S+) ([0-9A-Fa-f]+)') | 77 r'(BROWSER|RENDERER)_LIBRARY_ADDRESS: (\S+) ([0-9A-Fa-f]+)') |
| 78 | 78 |
| 79 | 79 |
| 80 def _GetBrowserSharedRelroConfig(): | 80 def _GetBrowserSharedRelroConfig(): |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 # Note that this behaviour doesn't seem to happen when starting an | 533 # Note that this behaviour doesn't seem to happen when starting an |
| 534 # application 'normally', i.e. when using the application launcher to | 534 # application 'normally', i.e. when using the application launcher to |
| 535 # start the activity. | 535 # start the activity. |
| 536 logging.info('Ignoring system\'s low randomization of browser libraries' + | 536 logging.info('Ignoring system\'s low randomization of browser libraries' + |
| 537 ' for regular devices') | 537 ' for regular devices') |
| 538 | 538 |
| 539 if not renderer_status: | 539 if not renderer_status: |
| 540 return ResultType.FAIL, renderer_logs | 540 return ResultType.FAIL, renderer_logs |
| 541 | 541 |
| 542 return ResultType.PASS, logs | 542 return ResultType.PASS, logs |
| OLD | NEW |