summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Rohr <prohr@google.com>2023-05-22 11:57:56 -0700
committerPatrick Rohr <prohr@google.com>2023-05-22 11:57:56 -0700
commit09f534ce0ef2846738f43be567b6bdb12d9d9273 (patch)
tree74b2d4192ca46fa9871ea1c096763a04c1040ede
parente0e3469e5a67ea66e496f346187be86f46666941 (diff)
parent918a5d9a1ba0861955e108705979be0edef0758f (diff)
downloadcronet-09f534ce0ef2846738f43be567b6bdb12d9d9273.tar.gz
Merge remote-tracking branch 'aosp/master' into upstream-staging
Update upstream-staging to state of aosp/master. Test: none Change-Id: I0fb7aabcf7c07f8bf3aa9f34c3cc848b2218cb05
-rw-r--r--Android.bp62
-rw-r--r--Android.extras.bp2
-rw-r--r--METADATA2
-rw-r--r--android/tools/gn2bp/Android.bp.swp60
-rwxr-xr-xandroid/tools/gn2bp/gen_android_bp391
-rw-r--r--android/tools/gn2bp/gn_utils.py145
-rw-r--r--base/allocator/partition_allocator/pkey.cc10
-rw-r--r--components/cronet/android/test/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java2
-rw-r--r--net/cert_net/cert_net_fetcher_url_request_unittest.cc3
-rw-r--r--test_runner/Android.bp18
-rw-r--r--test_runner/AndroidNetTest.xml7
-rw-r--r--test_runner/AndroidTest.xml16
-rw-r--r--test_runner/src/com.android.tests.chromium.host/ChromiumHostDrivenTest.java156
-rw-r--r--test_runner/src/com.android.tests.chromium.host/FailedReportingException.java23
-rw-r--r--test_runner/src/com.android.tests.chromium.host/InstrumentationFlags.java42
15 files changed, 440 insertions, 499 deletions
diff --git a/Android.bp b/Android.bp
index 3f26cff85..6e01d1270 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-// This file is automatically generated by gn2bp/gen_android_bp. Do not edit.
+// This file is automatically generated by gen_android_bp. Do not edit.
build = ["Android.extras.bp"]
@@ -547,6 +547,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -564,6 +567,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -583,6 +589,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -600,6 +609,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2333,6 +2345,10 @@ cc_library_static {
"base/time/time_android.cc",
"base/trace_event/cfi_backtrace_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2444,6 +2460,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2554,6 +2574,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2663,6 +2687,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13051,6 +13079,10 @@ cc_library_static {
],
},
android_arm: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13077,6 +13109,10 @@ cc_library_static {
],
},
android_arm64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13104,6 +13140,10 @@ cc_library_static {
],
},
android_x86: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13130,6 +13170,10 @@ cc_library_static {
],
},
android_x86_64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23829,6 +23873,10 @@ cc_library_static {
],
},
android_arm: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23855,6 +23903,10 @@ cc_library_static {
],
},
android_arm64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23882,6 +23934,10 @@ cc_library_static {
],
},
android_x86: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23908,6 +23964,10 @@ cc_library_static {
],
},
android_x86_64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
diff --git a/Android.extras.bp b/Android.extras.bp
index 0d792ac34..a5be1faf6 100644
--- a/Android.extras.bp
+++ b/Android.extras.bp
@@ -17,7 +17,6 @@
license {
name: "external_cronet_license",
license_kinds: [
- "SPDX-license-identifier-AFL-2.0",
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-BSD-3-Clause",
@@ -66,7 +65,6 @@ java_defaults {
name: "cronet_native_unittests_defaults",
defaults: [
"mts-target-sdk-version-current",
- "CronetTestJavaDefaults",
],
compile_multilib: "both",
min_sdk_version: "31", // b/270049141
diff --git a/METADATA b/METADATA
index 90a7f673e..9072e7cf9 100644
--- a/METADATA
+++ b/METADATA
@@ -3,7 +3,7 @@ description:
"Contains a subset of Chromium sources used to build Cronet from source "
"within Android."
third_party {
- license_type: NOTICE
+ license_type: RECIPROCAL
url {
type: GIT
value: "https://chromium.googlesource.com/chromium/src.git"
diff --git a/android/tools/gn2bp/Android.bp.swp b/android/tools/gn2bp/Android.bp.swp
index 3f26cff85..7a601eb80 100644
--- a/android/tools/gn2bp/Android.bp.swp
+++ b/android/tools/gn2bp/Android.bp.swp
@@ -547,6 +547,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -564,6 +567,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -583,6 +589,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -600,6 +609,9 @@ cc_library_static {
"base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
"base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2333,6 +2345,10 @@ cc_library_static {
"base/time/time_android.cc",
"base/trace_event/cfi_backtrace_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2444,6 +2460,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2554,6 +2574,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -2663,6 +2687,10 @@ cc_library_static {
"base/threading/platform_thread_android.cc",
"base/time/time_android.cc",
],
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13051,6 +13079,10 @@ cc_library_static {
],
},
android_arm: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13077,6 +13109,10 @@ cc_library_static {
],
},
android_arm64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13104,6 +13140,10 @@ cc_library_static {
],
},
android_x86: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -13130,6 +13170,10 @@ cc_library_static {
],
},
android_x86_64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23829,6 +23873,10 @@ cc_library_static {
],
},
android_arm: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23855,6 +23903,10 @@ cc_library_static {
],
},
android_arm64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23882,6 +23934,10 @@ cc_library_static {
],
},
android_x86: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
@@ -23908,6 +23964,10 @@ cc_library_static {
],
},
android_x86_64: {
+ static_libs: [
+ "cronet_aml_third_party_android_ndk_cpu_features__testing",
+ "cronet_aml_third_party_ashmem_ashmem__testing",
+ ],
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
diff --git a/android/tools/gn2bp/gen_android_bp b/android/tools/gn2bp/gen_android_bp
index acac3564b..75456a686 100755
--- a/android/tools/gn2bp/gen_android_bp
+++ b/android/tools/gn2bp/gen_android_bp
@@ -56,20 +56,6 @@ DEFAULT_TESTS = [
EXTRAS_ANDROID_BP_FILE = "Android.extras.bp"
CRONET_API_MODULE_NAME = "cronet_aml_api_java"
-# Defines a custom init_rc argument to be applied to the corresponding output
-# blueprint target.
-target_initrc = {
- # TODO: this can probably be removed.
-}
-
-target_host_supported = [
- # TODO: remove if this is not useful for the cronet build.
-]
-
-# Proto target groups which will be made public.
-proto_groups = {
- # TODO: remove if this is not used for the cronet build.
-}
# All module names are prefixed with this string to avoid collisions.
module_prefix = 'cronet_aml_'
@@ -77,29 +63,7 @@ module_prefix = 'cronet_aml_'
# Shared libraries which are directly translated to Android system equivalents.
shared_library_allowlist = [
'android',
- 'android.hardware.atrace@1.0',
- 'android.hardware.health@2.0',
- 'android.hardware.health-V1-ndk',
- 'android.hardware.power.stats@1.0',
- "android.hardware.power.stats-V1-cpp",
- 'base',
- 'binder',
- 'binder_ndk',
- 'cutils',
- 'hidlbase',
- 'hidltransport',
- 'hwbinder',
- 'incident',
'log',
- 'services',
- 'statssocket',
- "tracingproxy",
- 'utils',
-]
-
-# Static libraries which are directly translated to Android system equivalents.
-static_library_allowlist = [
- 'statslog_perfetto',
]
# Include directories that will be removed from all targets.
@@ -107,10 +71,6 @@ local_include_dirs_denylist = [
'third_party/zlib/',
]
-experimental_include_dirs_denylist = [
- 'third_party/brotli/include/',
-]
-
# Name of the module which settings such as compiler flags for all other
# modules.
defaults_module = module_prefix + 'defaults'
@@ -210,39 +170,21 @@ additional_args = {
def always_disable(module, arch):
return None
-def enable_brotli(module, arch):
- # Requires crrev/c/4111690
- if arch is None:
- module.static_libs.add('libbrotli')
- else:
- module.arch[arch].static_libs.add('libbrotli')
-
-def enable_modp_b64(module, arch):
- # Requires crrev/c/4112845
- # Requires aosp/2359455
- # Requires aosp/2359456
- if not module.is_compiled():
- return
- if arch is None:
- module.static_libs.add('libmodpb64')
- else:
- module.arch[arch].static_libs.add('libmodpb64')
-
def enable_zlib(module, arch):
# Requires crrev/c/4109079
- if arch is None:
+ if arch == 'common':
module.shared_libs.add('libz')
else:
- module.arch[arch].shared_libs.add('libz')
+ module.target[arch].shared_libs.add('libz')
def enable_boringssl(module, arch):
# Do not add boringssl targets to cc_genrules. This happens, because protobuf targets are
# originally static_libraries, but later get converted to a cc_genrule.
if module.is_genrule(): return
- if arch is None:
+ if arch == 'common':
shared_libs = module.shared_libs
else:
- shared_libs = module.arch[arch].shared_libs
+ shared_libs = module.target[arch].shared_libs
shared_libs.add('//external/cronet/third_party/boringssl:libcrypto')
shared_libs.add('//external/cronet/third_party/boringssl:libssl')
@@ -274,20 +216,6 @@ builtin_deps = {
always_disable,
}
-experimental_android_deps = {
- '//third_party/brotli:common':
- enable_brotli,
- '//third_party/brotli:dec':
- enable_brotli,
- '//third_party/modp_b64:modp_b64':
- enable_modp_b64,
-}
-
-# Uncomment the following lines to use Android deps rather than their Chromium
-# equivalent:
-#builtin_deps.update(experimental_android_deps)
-#local_include_dirs_denylist.extend(experimental_include_dirs_denylist)
-
# Name of tethering apex module
tethering_apex = "com.android.tethering"
@@ -304,21 +232,6 @@ connectivity_visibility = "//packages/modules/Connectivity:__subpackages__"
# End of configuration.
# ----------------------------------------------------------------------------
-
-class Error(Exception):
- pass
-
-
-class ThrowingArgumentParser(argparse.ArgumentParser):
-
- def __init__(self, context):
- super(ThrowingArgumentParser, self).__init__()
- self.context = context
-
- def error(self, message):
- raise Error('%s: %s' % (self.context, message))
-
-
def write_blueprint_key_value(output, name, value, sort=True):
"""Writes a Blueprint key-value pair to the output"""
@@ -338,7 +251,7 @@ def write_blueprint_key_value(output, name, value, sort=True):
output.append(' "%s",' % item)
output.append(' ],')
return
- if isinstance(value, Target):
+ if isinstance(value, Module.Target):
value.to_string(output)
return
if isinstance(value, dict):
@@ -354,65 +267,60 @@ def write_blueprint_key_value(output, name, value, sort=True):
output.append(' %s: "%s",' % (name, value))
-class Target(object):
- """A target-scoped part of a module"""
-
- def __init__(self, name):
- self.name = name
- self.srcs = set()
- self.shared_libs = set()
- self.static_libs = set()
- self.whole_static_libs = set()
- self.header_libs = set()
- self.cflags = set()
- self.dist = dict()
- self.strip = dict()
- self.stl = None
- self.cppflags = set()
- self.local_include_dirs = set()
- self.export_system_include_dirs = set()
- self.generated_headers = set()
- self.export_generated_headers = set()
- self.ldflags = set()
- self.compile_multilib = None
- if name == 'host':
- self.compile_multilib = '64'
-
- def to_string(self, output):
- nested_out = []
- self._output_field(nested_out, 'srcs')
- self._output_field(nested_out, 'shared_libs')
- self._output_field(nested_out, 'static_libs')
- self._output_field(nested_out, 'whole_static_libs')
- self._output_field(nested_out, 'header_libs')
- self._output_field(nested_out, 'cflags')
- self._output_field(nested_out, 'stl')
- self._output_field(nested_out, 'dist')
- self._output_field(nested_out, 'strip')
- self._output_field(nested_out, 'cppflags')
- self._output_field(nested_out, 'local_include_dirs')
- self._output_field(nested_out, 'export_system_include_dirs')
- self._output_field(nested_out, 'generated_headers')
- self._output_field(nested_out, 'export_generated_headers')
- self._output_field(nested_out, 'ldflags')
-
- if nested_out:
- # This is added here to make sure it doesn't add a `host` arch-specific module just for
- # `compile_multilib` flag.
- self._output_field(nested_out, 'compile_multilib')
- output.append(' %s: {' % self.name)
- for line in nested_out:
- output.append(' %s' % line)
- output.append(' },')
-
- def _output_field(self, output, name, sort=True):
- value = getattr(self, name)
- return write_blueprint_key_value(output, name, value, sort)
-
class Module(object):
"""A single module (e.g., cc_binary, cc_test) in a blueprint."""
+ class Target(object):
+ """A target-scoped part of a module"""
+
+ def __init__(self, name):
+ self.name = name
+ self.srcs = set()
+ self.shared_libs = set()
+ self.static_libs = set()
+ self.whole_static_libs = set()
+ self.header_libs = set()
+ self.cflags = set()
+ self.stl = None
+ self.cppflags = set()
+ self.local_include_dirs = set()
+ self.generated_headers = set()
+ self.export_generated_headers = set()
+ self.ldflags = set()
+ self.compile_multilib = None
+ if name == 'host':
+ self.compile_multilib = '64'
+
+ def to_string(self, output):
+ nested_out = []
+ self._output_field(nested_out, 'srcs')
+ self._output_field(nested_out, 'shared_libs')
+ self._output_field(nested_out, 'static_libs')
+ self._output_field(nested_out, 'whole_static_libs')
+ self._output_field(nested_out, 'header_libs')
+ self._output_field(nested_out, 'cflags')
+ self._output_field(nested_out, 'stl')
+ self._output_field(nested_out, 'cppflags')
+ self._output_field(nested_out, 'local_include_dirs')
+ self._output_field(nested_out, 'generated_headers')
+ self._output_field(nested_out, 'export_generated_headers')
+ self._output_field(nested_out, 'ldflags')
+
+ if nested_out:
+ # This is added here to make sure it doesn't add a `host` arch-specific module just for
+ # `compile_multilib` flag.
+ self._output_field(nested_out, 'compile_multilib')
+ output.append(' %s: {' % self.name)
+ for line in nested_out:
+ output.append(' %s' % line)
+ output.append(' },')
+
+ def _output_field(self, output, name, sort=True):
+ value = getattr(self, name)
+ return write_blueprint_key_value(output, name, value, sort)
+
+
def __init__(self, mod_type, name, gn_target):
self.type = mod_type
self.gn_target = gn_target
@@ -422,12 +330,10 @@ class Module(object):
self.shared_libs = set()
self.static_libs = set()
self.whole_static_libs = set()
- self.runtime_libs = set()
self.tools = set()
self.cmd = None
self.host_supported = False
self.device_supported = True
- self.vendor_available = False
self.init_rc = set()
self.out = set()
self.export_include_dirs = set()
@@ -440,21 +346,19 @@ class Module(object):
self.include_dirs = set()
self.local_include_dirs = set()
self.header_libs = set()
- self.required = set()
self.tool_files = set()
# target contains a dict of Targets indexed by os_arch.
# example: { 'android_x86': Target('android_x86')
self.target = dict()
- self.target['android'] = Target('android')
- self.target['android_x86'] = Target('android_x86')
- self.target['android_x86_64'] = Target('android_x86_64')
- self.target['android_arm'] = Target('android_arm')
- self.target['android_arm64'] = Target('android_arm64')
- self.target['host'] = Target('host')
- self.target['glibc'] = Target('glibc')
+ self.target['android'] = self.Target('android')
+ self.target['android_x86'] = self.Target('android_x86')
+ self.target['android_x86_64'] = self.Target('android_x86_64')
+ self.target['android_arm'] = self.Target('android_arm')
+ self.target['android_arm64'] = self.Target('android_arm64')
+ self.target['host'] = self.Target('host')
+ self.target['glibc'] = self.Target('glibc')
self.stl = None
self.cpp_std = None
- self.dist = dict()
self.strip = dict()
self.data = set()
self.apex_available = set()
@@ -471,7 +375,6 @@ class Module(object):
self.version_script = None
self.test_suites = set()
self.test_config = None
- self.stubs = {}
self.cppflags = set()
self.rtti = False
# Name of the output. Used for setting .so file name for libcronet
@@ -498,15 +401,12 @@ class Module(object):
self._output_field(output, 'shared_libs')
self._output_field(output, 'static_libs')
self._output_field(output, 'whole_static_libs')
- self._output_field(output, 'runtime_libs')
self._output_field(output, 'tools')
self._output_field(output, 'cmd', sort=False)
if self.host_supported:
self._output_field(output, 'host_supported')
if not self.device_supported:
self._output_field(output, 'device_supported')
- if self.vendor_available:
- self._output_field(output, 'vendor_available')
self._output_field(output, 'init_rc')
self._output_field(output, 'out')
self._output_field(output, 'export_include_dirs')
@@ -519,8 +419,6 @@ class Module(object):
self._output_field(output, 'include_dirs')
self._output_field(output, 'local_include_dirs')
self._output_field(output, 'header_libs')
- self._output_field(output, 'required')
- self._output_field(output, 'dist')
self._output_field(output, 'strip')
self._output_field(output, 'tool_files')
self._output_field(output, 'data')
@@ -531,7 +429,6 @@ class Module(object):
self._output_field(output, 'version_script')
self._output_field(output, 'test_suites')
self._output_field(output, 'test_config')
- self._output_field(output, 'stubs')
self._output_field(output, 'proto')
self._output_field(output, 'linker_scripts')
self._output_field(output, 'ldflags')
@@ -566,14 +463,6 @@ class Module(object):
output.append('}')
output.append('')
- def add_android_static_lib(self, lib):
- if self.type == 'cc_binary_host':
- raise Exception('Adding Android static lib for host tool is unsupported')
- elif self.host_supported:
- self.target['android'].static_libs.add(lib)
- else:
- self.static_libs.add(lib)
-
def add_android_shared_lib(self, lib):
if self.type == 'cc_binary_host':
raise Exception('Adding Android shared lib for host tool is unsupported')
@@ -607,28 +496,6 @@ class Module(object):
# the depending modules
return len(self.export_generated_headers) > 0
- def merge_attribute(self, key, source_module, allowed_archs, source_key = None):
- """
- Merges the value of the attribute `source_key` for the `dep_module` with
- the value of the attribute `key` for this module. If the value of the
- `source_key` is equal to None. Then `key` is used for both modules.
-
- This merges the attribute for both non-arch and archs
- specified in `allowed_archs`.
- :param key: The attribute used for merging in the calling module. Also
- used for `dep_module` if the `source_key` is None.
- :param source_module: The module where data is propagated from.
- :param allowed_archs: A list of archs to merge the attribute on.
- :param source_key: if the attribute merged from the `dep_module`
- is different from the `key`
- """
- if not source_key:
- source_key = key
- self.__dict__[key].update(source_module.__dict__[source_key])
- for arch_name in source_module.target.keys():
- if arch_name in allowed_archs:
- self.target[arch_name].__dict__[key].update(
- source_module.target[arch_name].__dict__[source_key])
class Blueprint(object):
"""In-memory representation of an Android.bp file."""
@@ -771,26 +638,8 @@ def create_proto_modules(blueprint, gn, target):
suffixes = ['pb']
source_module.genrule_shared_libs.add('libprotobuf-cpp-lite')
cmd += ['--cpp_out=lite=true:' + cpp_out_dir]
- elif target.proto_plugin == 'protozero':
- suffixes = ['pbzero']
- plugin = create_modules_from_target(blueprint, gn, protozero_plugin)
- tools.add(plugin.name)
- cmd += ['--plugin=protoc-gen-plugin=$(location %s)' % plugin.name]
- cmd += ['--plugin_out=wrapper_namespace=pbzero:' + cpp_out_dir]
- elif target.proto_plugin == 'cppgen':
- suffixes = ['gen']
- plugin = create_modules_from_target(blueprint, gn, cppgen_plugin)
- tools.add(plugin.name)
- cmd += ['--plugin=protoc-gen-plugin=$(location %s)' % plugin.name]
- cmd += ['--plugin_out=wrapper_namespace=gen:' + cpp_out_dir]
- elif target.proto_plugin == 'ipc':
- suffixes = ['ipc']
- plugin = create_modules_from_target(blueprint, gn, ipc_plugin)
- tools.add(plugin.name)
- cmd += ['--plugin=protoc-gen-plugin=$(location %s)' % plugin.name]
- cmd += ['--plugin_out=wrapper_namespace=gen:' + cpp_out_dir]
else:
- raise Error('Unsupported proto plugin: %s' % target.proto_plugin)
+ raise Exception('Unsupported proto plugin: %s' % target.proto_plugin)
cmd += ['$(in)']
source_module.cmd = ' '.join(cmd)
@@ -808,24 +657,6 @@ def create_proto_modules(blueprint, gn, target):
return source_module
-def create_proto_group_modules(blueprint, gn, module_name, target_names):
- # TODO(lalitm): today, we're only adding a Java lite module because that's
- # the only one used in practice. In the future, if we need other target types
- # (e.g. C++, Java full etc.) add them here.
- bp_module_name = label_to_module_name(module_name) + '_java_protos'
- module = Module('java_library', bp_module_name, bp_module_name)
- module.comment = f'''GN: [{', '.join(target_names)}]'''
- module.proto = {'type': 'lite', 'canonical_path_from_root': False}
-
- for name in target_names:
- target = gn.get_target(name)
- module.srcs.update(gn_utils.label_to_path(src) for src in target.sources)
- for dep_label in target.transitive_proto_deps:
- dep = gn.get_target(dep_label)
- module.srcs.update(gn_utils.label_to_path(src) for src in dep.sources)
-
- blueprint.add_module(module)
-
def create_gcc_preprocess_modules(blueprint, target):
# gcc_preprocess.py internally execute host gcc which is not allowed in genrule.
# So, this function create multiple modules and realize equivalent processing
@@ -1298,8 +1129,7 @@ def get_action_sanitizer(gn, target, type, arch, is_test_target):
elif target.script == '//build/protoc_java.py':
return ProtocJavaSanitizer(target, arch, gn)
else:
- # TODO: throw exception here once all script hacks have been converted.
- return BaseActionSanitizer(target, arch)
+ raise Exception('Unsupported action %s' % target.script)
def create_action_foreach_modules(blueprint, gn, target, is_test_target):
""" The following assumes that rebase_path exists in the args.
@@ -1370,7 +1200,7 @@ def get_cmd_condition(arch):
elif arch == "host":
return "$$CC_OS != 'android'"
else:
- raise Error(f'Unknown architecture type {arch}')
+ raise Exception(f'Unknown architecture type {arch}')
def merge_cmd(modules, genrule_type):
'''
@@ -1384,7 +1214,7 @@ def merge_cmd(modules, genrule_type):
return commands[0]
if genrule_type != 'cc_genrule':
- raise Error(f'{genrule_type} can not have different cmd between archs')
+ raise Exception(f'{genrule_type} can not have different cmd between archs')
merged_cmd = []
for arch, module in modules.items():
@@ -1405,7 +1235,7 @@ def merge_modules(modules, genrule_type):
# Following attributes must be the same between archs
for key in ('out', 'genrule_headers', 'srcs', 'tool_files'):
if any([getattr(merged_module, key) != getattr(module, key) for module in modules.values()]):
- raise Error(f'{merged_module.name} has different values for {key} between archs')
+ raise Exception(f'{merged_module.name} has different values for {key} between archs')
merged_module.cmd = merge_cmd(modules, genrule_type)
return merged_module
@@ -1431,7 +1261,7 @@ def create_action_module(blueprint, gn, target, genrule_type, is_test_target):
modules = {arch_name: create_action_module_internal(gn, target, genrule_type,
is_test_target, arch)
- for arch_name, arch in target.arch.items()}
+ for arch_name, arch in target.get_archs().items()}
module = merge_modules(modules, genrule_type)
blueprint.add_module(module)
return module
@@ -1527,15 +1357,14 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
# Java targets are handled outside of create_modules_from_target.
return None
else:
- raise Error('Unknown target %s (%s)' % (target.name, target.type))
+ raise Exception('Unknown target %s (%s)' % (target.name, target.type))
blueprint.add_module(module)
- module.init_rc = target_initrc.get(target.name, [])
module.srcs.update(gn_utils.label_to_path(src)
for src in target.sources if is_supported_source_file(src))
# Add arch-specific properties
- for arch_name, arch in target.arch.items():
+ for arch_name, arch in target.get_archs().items():
module.target[arch_name].srcs.update(gn_utils.label_to_path(src)
for src in arch.sources if is_supported_source_file(src))
@@ -1545,7 +1374,7 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
set_module_flags(module, module.type, target.cflags, target.defines, target.ldflags, target.libs)
set_module_include_dirs(module, target.cflags, target.include_dirs)
# TODO: set_module_xxx is confusing, apply similar function to module and target in better way.
- for arch_name, arch in target.arch.items():
+ for arch_name, arch in target.get_archs().items():
# TODO(aymanm): Make libs arch-specific.
set_module_flags(module.target[arch_name], module.type,
arch.cflags, arch.defines, arch.ldflags, [])
@@ -1576,8 +1405,6 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
else 'lib' + lib
if lib in shared_library_allowlist:
module.add_android_shared_lib(android_lib)
- if lib in static_library_allowlist:
- module.add_android_static_lib(android_lib)
# If the module is a static library, export all the generated headers.
if module.type == 'cc_library_static':
@@ -1585,7 +1412,7 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
if module.name == 'cronet_aml_components_cronet_android_cronet':
if target.output_name is None:
- raise Error('Failed to get output_name for libcronet name')
+ raise Exception('Failed to get output_name for libcronet name')
# .so file name needs to match with CronetLibraryLoader.java (e.g. libcronet.109.0.5386.0.so)
# So setting the output name based on the output_name from the desc.json
module.stem = 'lib' + target.output_name
@@ -1596,15 +1423,17 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
:target.get_target_name().find(gn_utils.TESTING_SUFFIX)]
# dep_name is an unmangled GN target name (e.g. //foo:bar(toolchain)).
- # Currently, only one module is generated from target even target has multiple toolchains.
- # And module is generated based on the first visited target.
+ all_deps = [(dep_name, 'common') for dep_name in target.transitive_proto_deps]
+ for arch_name, arch in target.arch.items():
+ all_deps += [(dep_name, arch_name) for dep_name in arch.deps]
+
# Sort deps before iteration to make result deterministic.
- all_deps = sorted(target.deps | target.source_set_deps | target.transitive_proto_deps)
- for dep_name in all_deps:
+ for (dep_name, arch_name) in sorted(all_deps):
+ module_target = module.target[arch_name] if arch_name != 'common' else module
# |builtin_deps| override GN deps with Android-specific ones. See the
# config in the top of this file.
if dep_name in builtin_deps:
- builtin_deps[dep_name](module, None)
+ builtin_deps[dep_name](module, arch_name)
continue
dep_module = create_modules_from_target(blueprint, gn, dep_name, is_test_target)
@@ -1620,8 +1449,8 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
# If this doesn't work for other target, hardcoding for specific target
# might be better.
if module.is_genrule() and dep_module.is_genrule():
- module.genrule_headers.add(dep_module.name)
- module.genrule_headers.update(dep_module.genrule_headers)
+ module_target.genrule_headers.add(dep_module.name)
+ module_target.genrule_headers.update(dep_module.genrule_headers)
# For filegroups, and genrule, recurse but don't apply the
# deps.
@@ -1636,50 +1465,20 @@ def create_modules_from_target(blueprint, gn, gn_target_name, is_test_target):
continue
if dep_module.type == 'cc_library_shared':
- module.shared_libs.add(dep_module.name)
+ module_target.shared_libs.add(dep_module.name)
elif dep_module.type == 'cc_library_static':
- if module.type in ['cc_library_shared', 'cc_binary']:
- if dep_module.gn_type == 'source_set':
- module.whole_static_libs.add(dep_module.name)
- else:
- module.static_libs.add(dep_module.name)
+ if module.type in ['cc_library_shared', 'cc_binary'] and dep_module.gn_type == 'source_set':
+ module_target.whole_static_libs.add(dep_module.name)
else:
- module.static_libs.add(dep_module.name)
+ module_target.static_libs.add(dep_module.name)
elif dep_module.type == 'cc_genrule':
- module.merge_attribute('generated_headers', dep_module, [], 'genrule_headers')
- module.merge_attribute('srcs', dep_module, [], 'genrule_srcs')
- module.merge_attribute('shared_libs', dep_module, [], 'genrule_shared_libs')
- module.merge_attribute('header_libs', dep_module, [], 'genrule_header_libs')
- elif dep_module.type == 'cc_binary':
- continue # Ignore executables deps (used by cmdline integration tests).
+ module_target.generated_headers.update(dep_module.genrule_headers)
+ module_target.srcs.update(dep_module.genrule_srcs)
+ module_target.shared_libs.update(dep_module.genrule_shared_libs)
+ module_target.header_libs.update(dep_module.genrule_header_libs)
else:
- raise Error('Unknown dep %s (%s) for target %s' %
- (dep_module.name, dep_module.type, module.name))
-
- for arch_name, arch in target.arch.items():
- for dep_name in arch.deps:
- # |builtin_deps| override GN deps with Android-specific ones. See the
- # config in the top of this file.
- if dep_name in builtin_deps:
- builtin_deps[dep_name](module, arch_name)
- continue
- dep_module = create_modules_from_target(blueprint, gn, dep_name, is_test_target)
- # Arch-specific dependencies currently only include cc_library_static.
- # Revisit this approach once we need to support more target types.
- if dep_module.type == 'cc_library_static':
- if module.type in ['cc_library_shared', 'cc_binary']:
- if dep_module.gn_type == 'source_set':
- module.target[arch_name].whole_static_libs.add(dep_module.name)
- else:
- module.target[arch_name].static_libs.add(dep_module.name)
- elif dep_module.type == 'cc_genrule':
- module.target[arch_name].generated_headers.update(dep_module.genrule_headers)
- module.target[arch_name].srcs.update(dep_module.genrule_srcs)
- module.target[arch_name].shared_libs.update(dep_module.genrule_shared_libs)
- module.target[arch_name].header_libs.update(dep_module.genrule_header_libs)
- else:
- raise Error('Unsupported arch-specific dependency %s of target %s with type %s' %
- (dep_module.name, target.name, dep_module.type))
+ raise Exception('Unsupported arch-specific dependency %s of target %s with type %s' %
+ (dep_module.name, target.name, dep_module.type))
return module
def create_java_jni_preprocessor(blueprint):
@@ -1902,11 +1701,10 @@ def create_blueprint_for_targets(gn, targets, test_targets):
setattr(module, key, add_val)
elif isinstance(add_val, dict) and isinstance(curr, dict):
curr.update(add_val)
- elif isinstance(add_val, dict) and isinstance(curr, Target):
+ elif isinstance(add_val, dict) and isinstance(curr, Module.Target):
curr.__dict__.update(add_val)
else:
- raise Error('Unimplemented type %r of additional_args: %r' %
- (type(add_val), key))
+ raise Exception('Unimplemented type %r of additional_args: %r' % (type(add_val), key))
return blueprint
@@ -1966,9 +1764,6 @@ def main():
project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
tool_name = os.path.relpath(os.path.abspath(__file__), project_root)
- # Add any proto groups to the blueprint.
- for l_name, t_names in proto_groups.items():
- create_proto_group_modules(blueprint, gn, l_name, t_names)
create_package_module(blueprint)
output = [
"""// Copyright (C) 2022 The Android Open Source Project
diff --git a/android/tools/gn2bp/gn_utils.py b/android/tools/gn2bp/gn_utils.py
index 40666738b..9c5953c6c 100644
--- a/android/tools/gn2bp/gn_utils.py
+++ b/android/tools/gn2bp/gn_utils.py
@@ -22,8 +22,6 @@ import os
import re
import collections
-BUILDFLAGS_TARGET = '//gn:gen_buildflags'
-GEN_VERSION_TARGET = '//src/base:version_gen_h'
LINKER_UNIT_TYPES = ('executable', 'shared_library', 'static_library', 'source_set')
JAVA_BANNED_SCRIPTS = [
"//build/android/gyp/turbine.py",
@@ -39,12 +37,6 @@ JAVA_BANNED_SCRIPTS = [
"//build/android/gyp/aar.py",
"//build/android/gyp/zip.py",
]
-# TODO(primiano): investigate these, they require further componentization.
-ODR_VIOLATION_IGNORE_TARGETS = {
- '//test/cts:perfetto_cts_deps',
- '//:perfetto_integrationtests',
-}
-ARCH_REGEX = r'(android_x86_64|android_x86|android_arm|android_arm64|host)'
RESPONSE_FILE = '{{response_file_name}}'
TESTING_SUFFIX = "__testing"
AIDL_INCLUDE_DIRS_REGEX = r'--includes=\[(.*)\]'
@@ -58,7 +50,6 @@ def repo_root():
def _clean_string(str):
return str.replace('\\', '').replace('../../', '').replace('"', '').strip()
-
def _extract_includes_from_aidl_args(args):
for arg in args:
is_match = re.match(AIDL_INCLUDE_DIRS_REGEX, arg)
@@ -67,12 +58,12 @@ def _extract_includes_from_aidl_args(args):
return [_clean_string(local_include) for local_include in local_includes]
return []
+
def label_to_path(label):
"""Turn a GN output label (e.g., //some_dir/file.cc) into a path."""
assert label.startswith('//')
return label[2:] or "./"
-
def label_without_toolchain(label):
"""Strips the toolchain from a GN label.
@@ -82,22 +73,9 @@ def label_without_toolchain(label):
return label.split('(')[0]
-def label_to_target_name_with_path(label):
- """
- Turn a GN label into a target name involving the full path.
- e.g., //src/perfetto:tests -> src_perfetto_tests
- """
- name = re.sub(r'^//:?', '', label)
- name = re.sub(r'[^a-zA-Z0-9_]', '_', name)
- return name
-
def _is_java_source(src):
return os.path.splitext(src)[1] == '.java' and not src.startswith("//out/")
-def is_java_action(script, outputs):
- return (script != "" and script not in JAVA_BANNED_SCRIPTS) and any(
- [file.endswith(".srcjar") or file.endswith(".java")
- for file in outputs])
class GnParser(object):
"""A parser with some cleverness for GN json desc files
@@ -139,7 +117,6 @@ class GnParser(object):
self.inputs = set()
self.outputs = set()
self.args = []
- self.script = ''
self.response_file_contents = ''
def __init__(self, name, type):
@@ -159,27 +136,16 @@ class GnParser(object):
self.proto_exports = set()
self.proto_in_dir = ""
- self.sources = set()
# TODO(primiano): consider whether the public section should be part of
# bubbled-up sources.
self.public_headers = set() # 'public'
# These are valid only for type == 'action'
- self.inputs = set()
- self.outputs = set()
self.script = ''
- self.args = []
- self.response_file_contents = ''
# These variables are propagated up when encountering a dependency
# on a source_set target.
- self.cflags = set()
- self.defines = set()
- self.deps = set()
self.libs = set()
- self.include_dirs = set()
- self.ldflags = set()
- self.source_set_deps = set() # Transitive set of source_set deps.
self.proto_deps = set()
self.transitive_proto_deps = set()
self.rtti = False
@@ -187,11 +153,79 @@ class GnParser(object):
# TODO: come up with a better way to only run this once.
# is_finalized tracks whether finalize() was called on this target.
self.is_finalized = False
- self.arch = dict()
+ # 'common' is a pseudo-architecture used to store common architecture dependent properties (to
+ # make handling of common vs architecture-specific arguments more consistent).
+ self.arch = {'common': self.Arch()}
# This is used to get the name/version of libcronet
self.output_name = None
+ # Properties to forward access to common arch.
+ # TODO: delete these after the transition has been completed.
+ @property
+ def sources(self):
+ return self.arch['common'].sources
+
+ @sources.setter
+ def sources(self, val):
+ self.arch['common'].sources = val
+
+ @property
+ def inputs(self):
+ return self.arch['common'].inputs
+
+ @inputs.setter
+ def inputs(self, val):
+ self.arch['common'].inputs = val
+
+ @property
+ def outputs(self):
+ return self.arch['common'].outputs
+
+ @outputs.setter
+ def outputs(self, val):
+ self.arch['common'].outputs = val
+
+ @property
+ def args(self):
+ return self.arch['common'].args
+
+ @args.setter
+ def args(self, val):
+ self.arch['common'].args = val
+
+ @property
+ def response_file_contents(self):
+ return self.arch['common'].response_file_contents
+
+ @response_file_contents.setter
+ def response_file_contents(self, val):
+ self.arch['common'].response_file_contents = val
+
+ @property
+ def cflags(self):
+ return self.arch['common'].cflags
+
+ @property
+ def defines(self):
+ return self.arch['common'].defines
+
+ @property
+ def deps(self):
+ return self.arch['common'].deps
+
+ @property
+ def include_dirs(self):
+ return self.arch['common'].include_dirs
+
+ @property
+ def ldflags(self):
+ return self.arch['common'].ldflags
+
+ @property
+ def source_set_deps(self):
+ return self.arch['common'].source_set_deps
+
def host_supported(self):
return 'host' in self.arch
@@ -220,28 +254,29 @@ class GnParser(object):
for key in ('cflags', 'defines', 'deps', 'include_dirs', 'ldflags',
'source_set_deps', 'proto_deps', 'transitive_proto_deps',
'libs', 'proto_paths'):
- self.__dict__[key].update(other.__dict__.get(key, []))
+ getattr(self, key).update(getattr(other, key, []))
for key_in_arch in ('cflags', 'defines', 'include_dirs', 'source_set_deps', 'ldflags'):
- self.arch[arch].__dict__[key_in_arch].update(
- other.arch[arch].__dict__.get(key_in_arch, []))
+ getattr(self.arch[arch], key_in_arch).update(getattr(other.arch[arch], key_in_arch, []))
+
+ def get_archs(self):
+ """ Returns a dict of archs without the common arch """
+ return {arch: val for arch, val in self.arch.items() if arch != 'common'}
def _finalize_set_attribute(self, key):
# Target contains the intersection of arch-dependent properties
- getattr(self, key)\
- .update(set.intersection(*[getattr(arch, key) for arch in self.arch.values()]))
+ getattr(self, key).update(set.intersection(*[getattr(arch, key) for arch in
+ self.get_archs().values()]))
# Deduplicate arch-dependent properties
- for arch in self.arch.values():
+ for arch in self.get_archs().values():
getattr(arch, key).difference_update(getattr(self, key))
def _finalize_non_set_attribute(self, key):
# Only when all the arch has the same non empty value, move the value to the target common
- val = getattr(list(self.arch.values())[0], key)
- if val and all([val == getattr(arch, key) for arch in self.arch.values()]):
+ val = getattr(list(self.get_archs().values())[0], key)
+ if val and all([val == getattr(arch, key) for arch in self.get_archs().values()]):
setattr(self, key, copy.deepcopy(val))
- for arch in self.arch.values():
- getattr(arch, key, None)
def _finalize_attribute(self, key):
val = getattr(self, key)
@@ -261,11 +296,11 @@ class GnParser(object):
return
self.is_finalized = True
- if len(self.arch) == 0:
+ if len(self.arch) == 1:
return
for key in ('sources', 'cflags', 'defines', 'include_dirs', 'deps', 'source_set_deps',
- 'inputs', 'outputs', 'args', 'script', 'response_file_contents', 'ldflags'):
+ 'inputs', 'outputs', 'args', 'response_file_contents', 'ldflags'):
self._finalize_attribute(key)
def get_target_name(self):
@@ -275,10 +310,6 @@ class GnParser(object):
def __init__(self, builtin_deps):
self.builtin_deps = builtin_deps
self.all_targets = {}
- self.linker_units = {} # Executables, shared or static libraries.
- self.source_sets = {}
- self.actions = {}
- self.proto_libs = {}
self.java_sources = collections.defaultdict(set)
self.aidl_local_include_dirs = set()
self.java_actions = collections.defaultdict(set)
@@ -364,7 +395,6 @@ class GnParser(object):
proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name)
if proto_target_type is not None:
- self.proto_libs[target.name] = target
target.type = 'proto_library'
target.proto_plugin = proto_target_type
target.proto_paths.update(self.get_proto_paths(proto_desc))
@@ -376,10 +406,8 @@ class GnParser(object):
target.arch[arch].sources.update(proto_desc.get('sources', []))
assert (all(x.endswith('.proto') for x in target.arch[arch].sources))
elif target.type == 'source_set':
- self.source_sets[gn_target_name] = target
target.arch[arch].sources.update(desc.get('sources', []))
elif target.is_linker_unit_type():
- self.linker_units[gn_target_name] = target
target.arch[arch].sources.update(desc.get('sources', []))
elif (desc.get("script", "") in JAVA_BANNED_SCRIPTS
or self._is_java_group(target.type, target.name)):
@@ -392,17 +420,18 @@ class GnParser(object):
target.inputs.update(desc.get('inputs', []))
target.type = 'java_group'
elif target.type in ['action', 'action_foreach']:
- self.actions[gn_target_name] = target
target.arch[arch].inputs.update(desc.get('inputs', []))
target.arch[arch].sources.update(desc.get('sources', []))
outs = [re.sub('^//out/.+?/gen/', '', x) for x in desc['outputs']]
target.arch[arch].outputs.update(outs)
- target.arch[arch].script = desc['script']
+ # While the arguments might differ, an action should always use the same script for every
+ # architecture. (gen_android_bp's get_action_sanitizer actually relies on this fact.
+ target.script = desc['script']
target.arch[arch].args = desc['args']
target.arch[arch].response_file_contents = self._get_response_file_contents(desc)
elif target.type == 'copy':
# TODO: copy rules are not currently implemented.
- self.actions[gn_target_name] = target
+ pass
# Default for 'public' is //* - all headers in 'sources' are public.
# TODO(primiano): if a 'public' section is specified (even if empty), then
diff --git a/base/allocator/partition_allocator/pkey.cc b/base/allocator/partition_allocator/pkey.cc
index f78fd3a20..de5f1fe20 100644
--- a/base/allocator/partition_allocator/pkey.cc
+++ b/base/allocator/partition_allocator/pkey.cc
@@ -32,11 +32,7 @@ PkeySettings PkeySettings::settings PA_PKEY_ALIGN;
PA_COMPONENT_EXPORT(PARTITION_ALLOC)
int PkeyMprotect(void* addr, size_t len, int prot, int pkey) {
-#if BUILDFLAG(ENABLE_PKEYS)
return syscall(SYS_pkey_mprotect, addr, len, prot, pkey);
-#else
- return 0;
-#endif
}
int PkeyMprotectIfEnabled(void* addr, size_t len, int prot, int pkey) {
@@ -80,18 +76,12 @@ void TagGlobalsWithPkey(int pkey) {
PA_COMPONENT_EXPORT(PARTITION_ALLOC)
int PkeyAlloc(int access_rights) {
-#if BUILDFLAG(ENABLE_PKEYS)
return syscall(SYS_pkey_alloc, 0, access_rights);
-#else
- return 0;
-#endif
}
PA_COMPONENT_EXPORT(PARTITION_ALLOC)
void PkeyFree(int pkey) {
-#if BUILDFLAG(ENABLE_PKEYS)
PA_PCHECK(syscall(SYS_pkey_free, pkey) == 0);
-#endif
}
uint32_t Rdpkru() {
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
index 09feaa0a5..0d4ed6a31 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
@@ -95,7 +95,7 @@ public class NetworkChangeNotifierTest {
CronetLibraryLoader.postToInitThread(new Runnable() {
@Override
public void run() {
- NetworkChangeNotifier.getInstance().fakeDefaultNetwork(
+ NetworkChangeNotifier.fakeDefaultNetwork(
NetworkChangeNotifier.getInstance().getCurrentDefaultNetId(),
ConnectionType.CONNECTION_4G);
}
diff --git a/net/cert_net/cert_net_fetcher_url_request_unittest.cc b/net/cert_net/cert_net_fetcher_url_request_unittest.cc
index 08406ecb7..775c722f1 100644
--- a/net/cert_net/cert_net_fetcher_url_request_unittest.cc
+++ b/net/cert_net/cert_net_fetcher_url_request_unittest.cc
@@ -527,7 +527,8 @@ TEST_F(CertNetFetcherURLRequestTest, CancelAfterRunningMessageLoop) {
// Fetch the same URLs in parallel and verify that only 1 request is made per
// URL.
-TEST_F(CertNetFetcherURLRequestTest, ParallelFetchDuplicates) {
+// b/283075390
+TEST_F(CertNetFetcherURLRequestTest, DISABLED_ParallelFetchDuplicates) {
ASSERT_TRUE(test_server_.Start());
CreateFetcher();
diff --git a/test_runner/Android.bp b/test_runner/Android.bp
index 75182a94a..19063c24b 100644
--- a/test_runner/Android.bp
+++ b/test_runner/Android.bp
@@ -29,9 +29,6 @@ java_test_host {
libs: [
"tradefed",
],
- defaults: [
- "CronetTestJavaDefaults",
- ],
required: [
"cronet_net_tester_app",
],
@@ -42,10 +39,8 @@ java_test_host {
"general-tests",
"mts-tethering",
],
- // It will get build error if just set enabled to true. It fails with "windows_common"
- // depends on some disabled modules that are used by this test and it looks like set
- // CronetTestJavaDefaults to true also enables "windows" variant. Thus,
- // disable this on target windows.
+ // This build fails on windows targets with "windows_common" depends on some disabled modules
+ // that are used by this test. Thus, disable this on target windows.
// TODO(aymanm): Remove this when b/201754360 is fixed.
target: {
windows: {
@@ -62,9 +57,6 @@ java_test_host {
libs: [
"tradefed",
],
- defaults: [
- "CronetTestJavaDefaults",
- ],
required: [
"cronet_tester_app",
],
@@ -72,10 +64,8 @@ java_test_host {
"general-tests",
"mts-tethering",
],
- // It will get build error if just set enabled to true. It fails with "windows_common"
- // depends on some disabled modules that are used by this test and it looks like set
- // CronetTestJavaDefaults to true also enables "windows" variant. Thus,
- // disable this on target windows.
+ // This build fails on windows targets with "windows_common" depends on some disabled modules
+ // that are used by this test. Thus, disable this on target windows.
// TODO(aymanm): Remove this when b/201754360 is fixed.
target: {
windows: {
diff --git a/test_runner/AndroidNetTest.xml b/test_runner/AndroidNetTest.xml
index b54b0870c..5d9822350 100644
--- a/test_runner/AndroidNetTest.xml
+++ b/test_runner/AndroidNetTest.xml
@@ -26,12 +26,6 @@
<option name="teardown-command" value="setenforce 1" />
<option name="throw-if-cmd-fail" value="true" />
</target_preparer>
- <!-- This creates the file which gtest redirects its JSON output to -->
- <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
- <option name="run-command" value="touch /data/local/tmp/cronet_test_results_output.json"/>
- <option name="teardown-command" value="rm /data/local/tmp/cronet_test_results_output.json"/>
- <option name="throw-if-cmd-fail" value="true"/>
- </target_preparer>
<!-- This creates the file which gtest redirects its stdout output to -->
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="touch /data/local/tmp/cronet_gtest_output.txt"/>
@@ -54,5 +48,6 @@
<option name="jar" value="net_unittests_tester.jar"/>
<option name="set-option" value="library-to-load:net_unittests__library"/>
<option name="set-option" value="dump-native-coverage:true"/>
+ <option name="enable-pretty-logs" value="false" />
</test>
</configuration> \ No newline at end of file
diff --git a/test_runner/AndroidTest.xml b/test_runner/AndroidTest.xml
index a4bd777e4..c3ed8ebb0 100644
--- a/test_runner/AndroidTest.xml
+++ b/test_runner/AndroidTest.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,12 +24,6 @@
<option name="teardown-command" value="setenforce 1" />
<option name="throw-if-cmd-fail" value="true" />
</target_preparer>
- <!-- This creates the file which gtest redirects its JSON output to -->
- <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
- <option name="run-command" value="touch /data/local/tmp/cronet_test_results_output.json"/>
- <option name="teardown-command" value="rm /data/local/tmp/cronet_test_results_output.json"/>
- <option name="throw-if-cmd-fail" value="true"/>
- </target_preparer>
<!-- This creates the file which gtest redirects its stdout output to -->
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="touch /data/local/tmp/cronet_gtest_output.txt"/>
@@ -44,8 +37,9 @@
</target_preparer>
<!-- Runs the test -->
<test class="com.android.tradefed.testtype.HostTest">
- <option name="jar" value="cronet_unittests_tester.jar"/>
- <option name="set-option" value="library-to-load:cronet_unittests_android__library"/>
- <option name="set-option" value="dump-native-coverage:true"/>
+ <option name="jar" value="cronet_unittests_tester.jar" />
+ <option name="set-option" value="library-to-load:cronet_unittests_android__library" />
+ <option name="set-option" value="dump-native-coverage:true" />
+ <option name="enable-pretty-logs" value="false" />
</test>
</configuration> \ No newline at end of file
diff --git a/test_runner/src/com.android.tests.chromium.host/ChromiumHostDrivenTest.java b/test_runner/src/com.android.tests.chromium.host/ChromiumHostDrivenTest.java
index a8bd5f2af..6559dbcbc 100644
--- a/test_runner/src/com.android.tests.chromium.host/ChromiumHostDrivenTest.java
+++ b/test_runner/src/com.android.tests.chromium.host/ChromiumHostDrivenTest.java
@@ -16,83 +16,55 @@
package com.android.tests.chromium.host;
+import static com.android.tests.chromium.host.InstrumentationFlags.COMMAND_LINE_FLAGS_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.DUMP_COVERAGE_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.EXTRA_SHARD_NANO_TIMEOUT_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.LIBRARY_TO_LOAD_ACTIVITY_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.NATIVE_TEST_ACTIVITY_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.NATIVE_UNIT_TEST_ACTIVITY_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.RUN_IN_SUBTHREAD_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.STDOUT_FILE_KEY;
+import static com.android.tests.chromium.host.InstrumentationFlags.TEST_RUNNER;
+
+import com.android.ddmlib.MultiLineReceiver;
import com.android.tradefed.config.Option;
import com.android.tradefed.device.CollectingOutputReceiver;
import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.invoker.TestInformation;
+import com.android.tradefed.log.LogUtil;
+import com.android.tradefed.result.ITestInvocationListener;
+import com.android.tradefed.testtype.GTest;
+import com.android.tradefed.testtype.GTestListTestParser;
+import com.android.tradefed.testtype.GTestResultParser;
import com.google.common.base.Strings;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-
import java.io.File;
-import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class ChromiumHostDrivenTest extends BaseHostJUnit4Test {
- private static final String CHROMIUM_PACKAGE = "org.chromium.native_test";
- private static final String NATIVE_TEST_ACTIVITY_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
- "NativeTestInstrumentationTestRunner.NativeTestActivity");
- private static final String RUN_IN_SUBTHREAD_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
- "NativeTest.RunInSubThread");
- private static final String NATIVE_UNIT_TEST_ACTIVITY_KEY = String.format("%s.%s",
- CHROMIUM_PACKAGE,
- "NativeUnitTestActivity");
- private static final String COMMAND_LINE_FLAGS_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
- "NativeTest.CommandLineFlags");
- private static final String EXTRA_SHARD_NANO_TIMEOUT_KEY = String.format("%s.%s",
- CHROMIUM_PACKAGE,
- "NativeTestInstrumentationTestRunner.ShardNanoTimeout");
- private static final String DUMP_COVERAGE_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
- "NativeTestInstrumentationTestRunner.DumpCoverage");
- private static final String LIBRARY_TO_LOAD_ACTIVITY_KEY = String.format("%s.%s",
- CHROMIUM_PACKAGE,
- "NativeTestInstrumentationTestRunner.LibraryUnderTest");
- private static final String STDOUT_FILE_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
- "NativeTestInstrumentationTestRunner.StdoutFile");
- private static final String TEST_RUNNER = String.format("%s/%s", CHROMIUM_PACKAGE,
- "org.chromium.build.gtest_apk.NativeTestInstrumentationTestRunner");
- private static Duration testsTimeout = Duration.ofMinutes(15);
- // This contains the gtest runner result output.
- private static final String GTEST_RESULT_OUTPUT_PATH =
- "/data/local/tmp/cronet_test_results_output.json";
+public class ChromiumHostDrivenTest extends GTest {
+ // This counter is used to retry
+ private static final int retries = 1;
+ private static final Duration testsTimeout = Duration.ofMinutes(30);
// This contains the gtest logs that is printed to stdout.
private static final String GTEST_OUTPUT_PATH = "/data/local/tmp/cronet_gtest_output.txt";
private static final String CLEAR_CLANG_COVERAGE_FILES =
"find /data/misc/trace -name '*.profraw' -delete";
- @Rule
- public DeviceJUnit4ClassRunner.TestLogData logs = new DeviceJUnit4ClassRunner.TestLogData();
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
@Option(
name = "dump-native-coverage",
description = "Force APK under test to dump native test coverage upon exit"
)
private boolean mCoverage = false;
-
- @Option(
- name = "gtest-filter",
- description = "Run only tests specified by the filter"
- )
- private String gtestFilter = "*"; // Default to run everything
-
@Option(
name = "library-to-load",
description = "Name of the .so file under test"
)
- private String libraryToLoad;
+ private String libraryToLoad = "";
- private String createRunAllTestsCommand() {
+ private String createRunAllTestsCommand() throws DeviceNotAvailableException {
InstrumentationCommandBuilder builder = new InstrumentationCommandBuilder(TEST_RUNNER)
.addArgument(NATIVE_TEST_ACTIVITY_KEY, NATIVE_UNIT_TEST_ACTIVITY_KEY)
.addArgument(RUN_IN_SUBTHREAD_KEY, "1")
@@ -100,62 +72,54 @@ public class ChromiumHostDrivenTest extends BaseHostJUnit4Test {
.addArgument(LIBRARY_TO_LOAD_ACTIVITY_KEY, libraryToLoad)
.addArgument(STDOUT_FILE_KEY, GTEST_OUTPUT_PATH)
.addArgument(COMMAND_LINE_FLAGS_KEY,
- String.format("'--gtest_filter=%s --gtest_output=json:%s'",
- gtestFilter, ChromiumHostDrivenTest.GTEST_RESULT_OUTPUT_PATH));
+ String.format("'%s'", getAllGTestFlags("")));
if (mCoverage) {
builder.addArgument(DUMP_COVERAGE_KEY, "true");
}
return builder.build();
}
- private void logFileFromDevice(String filePath) throws DeviceNotAvailableException {
- File file = getDevice().pullFile(filePath);
- if (file != null) {
- logs.addTestLog(filePath, LogDataType.TEXT,
- new FileInputStreamSource(file));
- }
- }
-
- @Before
- public void setup() throws DeviceNotAvailableException {
- if (mCoverage) {
- getDevice().executeShellCommand(CLEAR_CLANG_COVERAGE_FILES);
- testsTimeout = Duration.ofMinutes(30);
- }
+ private void printHostLogs(String cmd) {
+ LogUtil.CLog.i(String.format("[Cronet] Library to be loaded: %s\n", libraryToLoad));
+ LogUtil.CLog.i(String.format("[Cronet] Command used to run gtests: adb shell %s\n", cmd));
+ LogUtil.CLog.i(String.format("[Cronet] Native-Coverage = %b", mCoverage));
}
- @Test
- public void testRunChromiumTests() throws Exception {
+ @Override
+ public void run(TestInformation testInfo, ITestInvocationListener listener)
+ throws DeviceNotAvailableException {
if (Strings.isNullOrEmpty(libraryToLoad)) {
throw new IllegalStateException("No library provided to be loaded.");
}
String cmd = createRunAllTestsCommand();
- CollectingOutputReceiver outputCollector = new CollectingOutputReceiver();
- getDevice().executeShellCommand(cmd, outputCollector, testsTimeout.toSeconds(),
- TimeUnit.SECONDS, 1);
- File logFile = folder.newFile();
- try (FileWriter fileWriter = new FileWriter(logFile)) {
- fileWriter.write(String.format("Library to be loaded: %s\n", libraryToLoad));
- fileWriter.write(String.format("Command used to run gtests: adb shell %s\n", cmd));
- if (mCoverage) {
- fileWriter.write("dump-native-coverage enabled!\n");
- }
- fileWriter.write(
- String.format("Instrumentation Result: %s", outputCollector.getOutput()));
+ printHostLogs(cmd);
+ getDevice().executeShellCommand(CLEAR_CLANG_COVERAGE_FILES);
+ getDevice().executeShellCommand(cmd, new CollectingOutputReceiver(),
+ testsTimeout.toMinutes(), TimeUnit.MINUTES, /* retryAttempts */ 1);
+ try {
+ parseAndReport(getDevice().pullFile(GTEST_OUTPUT_PATH), listener);
+ } catch (IOException e) {
+ throw new FailedReportingException("Failed to parse and report test results",
+ e.getCause());
+ }
+ }
+
+ private void parseAndReport(File testResultsOutput, ITestInvocationListener listener)
+ throws IOException {
+ if (testResultsOutput == null) {
+ throw new IOException(
+ String.format("Failed to retrieve %s from device", GTEST_OUTPUT_PATH));
}
- logs.addTestLog("cronet_extra_logs", LogDataType.TEXT,
- new FileInputStreamSource(logFile));
- logFileFromDevice(GTEST_RESULT_OUTPUT_PATH);
- logFileFromDevice(GTEST_OUTPUT_PATH);
- // The files are included in the test report generated after executing the tests.
- File gtestTestResultsJson = getDevice().pullFile(GTEST_RESULT_OUTPUT_PATH);
- GTestsMetaData gTestsMetaData = GTestsMetaData.parseFile(gtestTestResultsJson);
- Assert.assertFalse(gTestsMetaData.hasAnyFailures());
- if (!gTestsMetaData.isOutputParsedCorrectly()) {
- Assert.fail(
- "Failed to parse gtests result. Please check the logcat for more information.");
- } else if (gTestsMetaData.getTotalTests() == 0) {
- Assert.fail("No Test has been executed.");
+ // Loading all the lines is fine since this is done on the host-machine.
+ String[] lines = Files.readAllLines(testResultsOutput.toPath()).toArray(String[]::new);
+ MultiLineReceiver parser;
+ // the parser automatically reports the test result back to the infra through the listener.
+ if (isCollectTestsOnly()) {
+ parser = new GTestListTestParser(libraryToLoad, listener);
+ } else {
+ parser = new GTestResultParser(libraryToLoad, listener);
}
+ parser.processNewLines(lines);
+ parser.done();
}
} \ No newline at end of file
diff --git a/test_runner/src/com.android.tests.chromium.host/FailedReportingException.java b/test_runner/src/com.android.tests.chromium.host/FailedReportingException.java
new file mode 100644
index 000000000..f9f0fb319
--- /dev/null
+++ b/test_runner/src/com.android.tests.chromium.host/FailedReportingException.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tests.chromium.host;
+
+public class FailedReportingException extends RuntimeException {
+ public FailedReportingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/test_runner/src/com.android.tests.chromium.host/InstrumentationFlags.java b/test_runner/src/com.android.tests.chromium.host/InstrumentationFlags.java
new file mode 100644
index 000000000..86d7f3ff6
--- /dev/null
+++ b/test_runner/src/com.android.tests.chromium.host/InstrumentationFlags.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tests.chromium.host;
+
+public class InstrumentationFlags {
+ static final String CHROMIUM_PACKAGE = "org.chromium.native_test";
+ static final String NATIVE_TEST_ACTIVITY_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
+ "NativeTestInstrumentationTestRunner.NativeTestActivity");
+ static final String RUN_IN_SUBTHREAD_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
+ "NativeTest.RunInSubThread");
+ static final String NATIVE_UNIT_TEST_ACTIVITY_KEY = String.format("%s.%s",
+ CHROMIUM_PACKAGE,
+ "NativeUnitTestActivity");
+ static final String COMMAND_LINE_FLAGS_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
+ "NativeTest.CommandLineFlags");
+ static final String EXTRA_SHARD_NANO_TIMEOUT_KEY = String.format("%s.%s",
+ CHROMIUM_PACKAGE,
+ "NativeTestInstrumentationTestRunner.ShardNanoTimeout");
+ static final String DUMP_COVERAGE_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
+ "NativeTestInstrumentationTestRunner.DumpCoverage");
+ static final String LIBRARY_TO_LOAD_ACTIVITY_KEY = String.format("%s.%s",
+ CHROMIUM_PACKAGE,
+ "NativeTestInstrumentationTestRunner.LibraryUnderTest");
+ static final String STDOUT_FILE_KEY = String.format("%s.%s", CHROMIUM_PACKAGE,
+ "NativeTestInstrumentationTestRunner.StdoutFile");
+ static final String TEST_RUNNER = String.format("%s/%s", CHROMIUM_PACKAGE,
+ "org.chromium.build.gtest_apk.NativeTestInstrumentationTestRunner");
+}