Enable memory end-to-end tests in cts
These cover important APIs that are used by other android projects.
* Link //src/profiling/memory:end_to_end_tests into perfetto_cts_deps,
which is included into CtsPerfettoTestCases.
* Add more libraries to CtsPerfettoTestCases (the new code requires
them).
* Increase the test timeout as these tests take some time to run.
* Move the on device path of the test from /data/local/tmp to
/data/local/tests/unrestricted: this is necessary because the
on-device heapprofd needs to access the test binary for symbolization.
heapprofd is not allowed by selinux to access /data/local/tmp
Tested: `atest CtsPerfettoTestCases` on cuttlefish and sargo
Bug: 206657946
Change-Id: I5b27f2b4ea8c71aa8bc2ae3c5d9ca00a12cea41c
diff --git a/Android.bp b/Android.bp
index 38cc829..8edaabb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1005,11 +1005,17 @@
":perfetto_include_perfetto_base_base",
":perfetto_include_perfetto_ext_base_base",
":perfetto_include_perfetto_ext_ipc_ipc",
+ ":perfetto_include_perfetto_ext_trace_processor_export_json",
+ ":perfetto_include_perfetto_ext_trace_processor_importers_memory_tracker_memory_tracker",
":perfetto_include_perfetto_ext_traced_sys_stats_counters",
":perfetto_include_perfetto_ext_traced_traced",
":perfetto_include_perfetto_ext_tracing_core_core",
":perfetto_include_perfetto_ext_tracing_ipc_ipc",
+ ":perfetto_include_perfetto_profiling_normalize",
":perfetto_include_perfetto_protozero_protozero",
+ ":perfetto_include_perfetto_trace_processor_basic_types",
+ ":perfetto_include_perfetto_trace_processor_storage",
+ ":perfetto_include_perfetto_trace_processor_trace_processor",
":perfetto_include_perfetto_tracing_core_core",
":perfetto_include_perfetto_tracing_core_forward_decls",
":perfetto_include_perfetto_tracing_tracing",
@@ -1060,6 +1066,8 @@
":perfetto_protos_perfetto_trace_perfetto_zero_gen",
":perfetto_protos_perfetto_trace_power_cpp_gen",
":perfetto_protos_perfetto_trace_power_zero_gen",
+ ":perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen",
+ ":perfetto_protos_perfetto_trace_processor_zero_gen",
":perfetto_protos_perfetto_trace_profiling_cpp_gen",
":perfetto_protos_perfetto_trace_profiling_zero_gen",
":perfetto_protos_perfetto_trace_ps_cpp_gen",
@@ -1082,11 +1090,46 @@
":perfetto_src_ipc_host",
":perfetto_src_ipc_perfetto_ipc",
":perfetto_src_kallsyms_kallsyms",
+ ":perfetto_src_profiling_common_callstack_trie",
+ ":perfetto_src_profiling_common_interner",
+ ":perfetto_src_profiling_common_interning_output",
+ ":perfetto_src_profiling_common_proc_utils",
+ ":perfetto_src_profiling_common_producer_support",
+ ":perfetto_src_profiling_common_profiler_guardrails",
+ ":perfetto_src_profiling_common_unwind_support",
+ ":perfetto_src_profiling_memory_client",
+ ":perfetto_src_profiling_memory_daemon",
+ ":perfetto_src_profiling_memory_end_to_end_tests",
+ ":perfetto_src_profiling_memory_ring_buffer",
+ ":perfetto_src_profiling_memory_scoped_spinlock",
+ ":perfetto_src_profiling_memory_wire_protocol",
":perfetto_src_protozero_filtering_bytecode_common",
":perfetto_src_protozero_filtering_bytecode_generator",
":perfetto_src_protozero_filtering_bytecode_parser",
":perfetto_src_protozero_filtering_message_filter",
":perfetto_src_protozero_protozero",
+ ":perfetto_src_trace_processor_analysis_analysis",
+ ":perfetto_src_trace_processor_containers_containers",
+ ":perfetto_src_trace_processor_db_db",
+ ":perfetto_src_trace_processor_export_json",
+ ":perfetto_src_trace_processor_ftrace_descriptors",
+ ":perfetto_src_trace_processor_importers_common_common",
+ ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
+ ":perfetto_src_trace_processor_lib",
+ ":perfetto_src_trace_processor_metatrace",
+ ":perfetto_src_trace_processor_metrics_metrics",
+ ":perfetto_src_trace_processor_sqlite_sqlite",
+ ":perfetto_src_trace_processor_storage_full",
+ ":perfetto_src_trace_processor_storage_minimal",
+ ":perfetto_src_trace_processor_storage_storage",
+ ":perfetto_src_trace_processor_tables_tables",
+ ":perfetto_src_trace_processor_types_types",
+ ":perfetto_src_trace_processor_util_descriptors",
+ ":perfetto_src_trace_processor_util_gzip",
+ ":perfetto_src_trace_processor_util_interned_message_view",
+ ":perfetto_src_trace_processor_util_proto_to_args_parser",
+ ":perfetto_src_trace_processor_util_protozero_to_text",
+ ":perfetto_src_trace_processor_util_util",
":perfetto_src_traced_probes_android_log_android_log",
":perfetto_src_traced_probes_common_common",
":perfetto_src_traced_probes_data_source",
@@ -1119,6 +1162,17 @@
"test/cts/heapprofd_test_cts.cc",
"test/cts/traced_perf_test_cts.cc",
],
+ shared_libs: [
+ "heapprofd_client_api",
+ "libandroidicu",
+ "libbase",
+ "liblog",
+ "libprocinfo",
+ "libsqlite",
+ "libunwindstack",
+ "libutils",
+ "libz",
+ ],
static_libs: [
"libgmock",
"libgtest",
@@ -1175,6 +1229,8 @@
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
"perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
+ "perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen_headers",
+ "perfetto_protos_perfetto_trace_processor_zero_gen_headers",
"perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
"perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
@@ -1186,6 +1242,12 @@
"perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
"perfetto_src_base_version_gen_h",
+ "perfetto_src_trace_processor_importers_gen_cc_chrome_track_event_descriptor",
+ "perfetto_src_trace_processor_importers_gen_cc_config_descriptor",
+ "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
],
export_generated_headers: [
"perfetto_protos_perfetto_common_cpp_gen_headers",
@@ -1235,6 +1297,8 @@
"perfetto_protos_perfetto_trace_perfetto_zero_gen_headers",
"perfetto_protos_perfetto_trace_power_cpp_gen_headers",
"perfetto_protos_perfetto_trace_power_zero_gen_headers",
+ "perfetto_protos_perfetto_trace_processor_metrics_impl_zero_gen_headers",
+ "perfetto_protos_perfetto_trace_processor_zero_gen_headers",
"perfetto_protos_perfetto_trace_profiling_cpp_gen_headers",
"perfetto_protos_perfetto_trace_profiling_zero_gen_headers",
"perfetto_protos_perfetto_trace_ps_cpp_gen_headers",
@@ -1246,6 +1310,12 @@
"perfetto_protos_perfetto_trace_track_event_cpp_gen_headers",
"perfetto_protos_perfetto_trace_track_event_zero_gen_headers",
"perfetto_src_base_version_gen_h",
+ "perfetto_src_trace_processor_importers_gen_cc_chrome_track_event_descriptor",
+ "perfetto_src_trace_processor_importers_gen_cc_config_descriptor",
+ "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
],
defaults: [
"perfetto_defaults",
@@ -1253,6 +1323,10 @@
cflags: [
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+ "-DHAVE_HIDDEN",
+ ],
+ header_libs: [
+ "bionic_libc_platform_headers",
],
}
diff --git a/test/cts/Android.bp b/test/cts/Android.bp
index 3958566..6927ebb 100644
--- a/test/cts/Android.bp
+++ b/test/cts/Android.bp
@@ -31,8 +31,11 @@
"perfetto_gtest_logcat_printer",
],
shared_libs: [
+ "heapprofd_client_api",
"libandroid",
+ "libsqlite",
"liblog",
+ "libz",
],
test_suites: [
"cts",
diff --git a/test/cts/AndroidTest.xml b/test/cts/AndroidTest.xml
index 2a9276c..70fe6fc 100644
--- a/test/cts/AndroidTest.xml
+++ b/test/cts/AndroidTest.xml
@@ -30,17 +30,17 @@
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="cleanup" value="true" />
- <option name="push" value="CtsPerfettoTestCases->/data/local/tmp/CtsPerfettoTestCases" />
+ <option name="push" value="CtsPerfettoTestCases->/data/local/tests/unrestricted/CtsPerfettoTestCases" />
<option name="append-bitness" value="true" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="setprop persist.traced_perf.enable 1" />
</target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
- <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="native-test-device-path" value="/data/local/tests/unrestricted" />
<option name="module-name" value="CtsPerfettoTestCases" />
- <option name="runtime-hint" value="0m30s" />
+ <option name="runtime-hint" value="2m30s" />
<!-- test-timeout unit is ms -->
- <option name="native-test-timeout" value="40000" />
+ <option name="native-test-timeout" value="180000" />
</test>
</configuration>
diff --git a/test/cts/BUILD.gn b/test/cts/BUILD.gn
index 0404ceb..b5bb8e8 100644
--- a/test/cts/BUILD.gn
+++ b/test/cts/BUILD.gn
@@ -32,6 +32,12 @@
"../../src/base:test_support",
"../../test:test_helper",
]
+
+ if (enable_perfetto_heapprofd) {
+ deps += [
+ "../../src/profiling/memory:end_to_end_tests",
+ ]
+ }
sources = [
"device_feature_test_cts.cc",
"end_to_end_integrationtest_cts.cc",