perfetto: add CTS tests and make integration tests run on CTS

This CL creates tests for CTS and also sets up infrastructure to run
the ftrace integration test on CTS as well.

Note that for CTS, we never setup the service or the ftrace producer
because we expect both to be included and running as part of the system
image.

Test: CL is tests
Change-Id: Ie128cdb1cab3d220ef52d158c370f69626e0a339
Bug:
diff --git a/Android.bp b/Android.bp
index 64d8065..6b350eb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1793,3 +1793,79 @@
     "perfetto_defaults",
   ],
 }
+
+// These targets are appended to the autogenerated Android.bp by tools/gen_android_bp.
+// TODO(lalitm): find a better way to do this sharing.
+
+// TODO(lalitm): uncomment these when the CTS tests are to be enabled.
+/*
+cc_test {
+  name: "CtsPerfettoTestCases",
+  srcs: [
+    "src/base/android_task_runner.cc",
+    "src/base/test/test_task_runner.cc",
+    "src/ftrace_reader/cpu_reader.cc",
+    "src/ftrace_reader/event_info.cc",
+    "src/ftrace_reader/format_parser.cc",
+    "src/ftrace_reader/ftrace_controller.cc",
+    "src/ftrace_reader/ftrace_procfs.cc",
+    "src/ftrace_reader/proto_translation_table.cc",
+    "src/traced/probes/ftrace_producer.cc",
+    "test/fake_consumer.cc",
+    "test/end_to_end_integrationtest.cc",
+    "test/end_to_end_integrationtest_cts.cc",
+  ],
+  static_libs: [
+    "libgmock",
+    "libgtest",
+    "libgtest_main",
+    "perfetto_src_tracing_ipc",
+  ],
+  shared_libs: [
+    "libandroid",
+    "liblog",
+    "libprotobuf-cpp-lite",
+  ],
+  test_suites: [
+    "cts",
+    "vts",
+    "general-tests",
+  ],
+  compile_multilib: "both",
+  multilib: {
+    lib32: {
+        suffix: "32",
+    },
+    lib64: {
+        suffix: "64",
+    },
+  },
+  cflags: [
+    "-DPERFETTO_BUILD_WITH_ANDROID",
+  ],
+}
+
+cc_library_shared {
+  name: "libperfettocts_jni",
+  srcs: [
+    "src/base/android_task_runner.cc",
+    "src/base/test/test_task_runner.cc",
+    "test/fake_producer.cc",
+    "test/cts/producer/jni/fake_producer_jni.cc",
+  ],
+  static_libs: [
+    "libprotobuf-cpp-lite",
+    "perfetto_src_tracing_ipc",
+  ],
+  shared_libs: [
+    "libandroid",
+    "liblog",
+    "libnativehelper_compat_libc++",
+  ],
+  compile_multilib: "both",
+  stl: "libc++_static",
+  cflags: [
+    "-DPERFETTO_BUILD_WITH_ANDROID",
+  ],
+}
+*/
\ No newline at end of file