Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: build/android/pylib/linker/test_case.py

Issue 141223002: Move the android library loader from content to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move Android Library Loader - Fix findbugs merge issue Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 22
23 - Enabling test support in the Linker code requires building a special 23 - Enabling test support in the Linker code requires building a special
24 APK with a flag to activate special test-only support code in the 24 APK with a flag to activate special test-only support code in the
25 Linker code itself. 25 Linker code itself.
26 26
27 Host-driven tests have also been tried, but since they're really 27 Host-driven tests have also been tried, but since they're really
28 sub-classes of instrumentation tests, they didn't work well either. 28 sub-classes of instrumentation tests, they didn't work well either.
29 29
30 To build and run the linker tests, do the following: 30 To build and run the linker tests, do the following:
31 31
32 ninja -C out/Debug content_linker_test_apk 32 ninja -C out/Debug chromium_linker_test_apk
33 build/android/test_runner.py linker 33 build/android/test_runner.py linker
34 34
35 """ 35 """
36 36
37 import logging 37 import logging
38 import os 38 import os
39 import re 39 import re
40 import StringIO 40 import StringIO
41 import subprocess 41 import subprocess
42 import tempfile 42 import tempfile
43 import time 43 import time
44 44
45 from pylib import constants 45 from pylib import constants
46 from pylib import android_commands 46 from pylib import android_commands
47 from pylib import flag_changer 47 from pylib import flag_changer
48 from pylib.base import base_test_result 48 from pylib.base import base_test_result
49 49
50 ResultType = base_test_result.ResultType 50 ResultType = base_test_result.ResultType
51 51
52 _PACKAGE_NAME='org.chromium.content_linker_test_apk' 52 _PACKAGE_NAME='org.chromium.chromium_linker_test_apk'
53 _ACTIVITY_NAME='.ContentLinkerTestActivity' 53 _ACTIVITY_NAME='.ChromiumLinkerTestActivity'
54 _COMMAND_LINE_FILE='/data/local/tmp/content-linker-test-command-line' 54 _COMMAND_LINE_FILE='/data/local/tmp/chromium-linker-test-command-line'
55 55
56 # Path to the Linker.java source file. 56 # Path to the Linker.java source file.
57 _LINKER_JAVA_SOURCE_PATH = \ 57 _LINKER_JAVA_SOURCE_PATH = \
58 'content/public/android/java/src/org/chromium/content/app/Linker.java' 58 'base/android/java/src/org/chromium/base/library_loader/Linker.java'
59 59
60 # A regular expression used to extract the browser shared RELRO configuration 60 # A regular expression used to extract the browser shared RELRO configuration
61 # from the Java source file above. 61 # from the Java source file above.
62 _RE_LINKER_BROWSER_CONFIG = \ 62 _RE_LINKER_BROWSER_CONFIG = \
63 re.compile(r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' + \ 63 re.compile(r'.*BROWSER_SHARED_RELRO_CONFIG\s+=\s+' + \
64 'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*', 64 'BROWSER_SHARED_RELRO_CONFIG_(\S+)\s*;.*',
65 re.MULTILINE | re.DOTALL) 65 re.MULTILINE | re.DOTALL)
66 66
67 # Logcat filters used during each test. Only the 'chromium' one is really 67 # Logcat filters used during each test. Only the 'chromium' one is really
68 # needed, but the logs are added to the TestResult in case of error, and 68 # needed, but the logs are added to the TestResult in case of error, and
69 # it is handy to have the 'content_android_linker' ones as well when 69 # it is handy to have the 'chromium_android_linker' ones as well when
70 # troubleshooting. 70 # troubleshooting.
71 _LOGCAT_FILTERS = [ '*:s', 'chromium:v', 'content_android_linker:v' ] 71 _LOGCAT_FILTERS = [ '*:s', 'chromium:v', 'chromium_android_linker:v' ]
72 #_LOGCAT_FILTERS = [ '*:v' ] ## DEBUG 72 #_LOGCAT_FILTERS = [ '*:v' ] ## DEBUG
73 73
74 # Regular expression used to match status lines in logcat. 74 # Regular expression used to match status lines in logcat.
75 re_status_line = re.compile(r'(BROWSER|RENDERER)_LINKER_TEST: (FAIL|SUCCESS)') 75 re_status_line = re.compile(r'(BROWSER|RENDERER)_LINKER_TEST: (FAIL|SUCCESS)')
76 76
77 # Regular expression used to mach library load addresses in logcat. 77 # Regular expression used to mach library load addresses in logcat.
78 re_library_address = re.compile( 78 re_library_address = re.compile(
79 r'(BROWSER|RENDERER)_LIBRARY_ADDRESS: (\S+) ([0-9A-Fa-f]+)') 79 r'(BROWSER|RENDERER)_LIBRARY_ADDRESS: (\S+) ([0-9A-Fa-f]+)')
80 80
81 81
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 # Note that this behaviour doesn't seem to happen when starting an 547 # Note that this behaviour doesn't seem to happen when starting an
548 # application 'normally', i.e. when using the application launcher to 548 # application 'normally', i.e. when using the application launcher to
549 # start the activity. 549 # start the activity.
550 logging.info('Ignoring system\'s low randomization of browser libraries' + 550 logging.info('Ignoring system\'s low randomization of browser libraries' +
551 ' for regular devices') 551 ' for regular devices')
552 552
553 if not renderer_status: 553 if not renderer_status:
554 return ResultType.FAIL, renderer_logs 554 return ResultType.FAIL, renderer_logs
555 555
556 return ResultType.PASS, logs 556 return ResultType.PASS, logs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698