Add e2e cmdline tests and fix Flush with no producers

Adds end-to-end coverage of the cmdline interface.
It is not simple anymore and recently became a source of bugs.
Furthermore, fix a minor bug that caused Flush() on an empty
tracing session to timeout (and waste time during tests).

Bug:120607375
Change-Id: Idcdbdd4a03712988beb65ec0b386769898ec98d8
diff --git a/Android.bp.extras b/Android.bp.extras
index d9d36ae..84c0f10 100644
--- a/Android.bp.extras
+++ b/Android.bp.extras
@@ -23,6 +23,7 @@
     "libprotobuf-cpp-lite",
   ],
   static_libs: [
+    "libgmock",
     "libgtest",
     "perfetto_src_tracing_ipc",
     "perfetto_trace_protos",