perfetto_cmd: Teach perfetto_cmd to parse pbtxt configs

Adds the ability for perfetto_cmd to understand pbtxt configs
(this is controlled by the -t/--txt flag). This is somewhat complicated
by perfetto_cmd only having access to protobuf lite.

- Add a cut down version of descriptor.proto
- Use this to generate a (lite) descriptor.pb.h/descriptor.pb.cc
- Convert perfetto_config.proto into a FileSetDescriptor
  (perfetto_config.descriptor)
- Encode perfetto_config.descriptor as a C++ constant named
  kPerfettoConfigDescriptor (perfetto_config.descriptor.h)
- Use descriptor.pb.h to parse the kPerfettoConfigDescriptor
- Manually parse the incoming config based on the descriptor and
  use protozero to write the proto encoding into a buffer which is then
  parsed as normal.

Converting perfetto_config.proto to a descriptor happens at commit time
to avoid having to teach google3 and Android build systems how to
convert a proto descriptor into a .h file of the correct format.

This is not a stable API. Backwards and forwards compatible proto format changes
such as renaming a field or removing an optional field are breaking changes to
the proto text format (we can't distinguish between a typo'ed field and an
optional field) so this format is only really designed for local testing.

Several smaller clean ups:
- Move scattered_stream_memory_delegate.{h,cc} to be part of protozero
  proper
- Remove the (now empty) src/protozero:test_support target
- Remove unused code in tools/gen_merged_protos
- Remove trailing whitespace in PRESUBMIT.py

Change-Id: Ic59b1338bd83421f68d4e12b4e01b9aaf5aa99be
diff --git a/tools/tmux b/tools/tmux
index 3afdb0c..ff12b42 100755
--- a/tools/tmux
+++ b/tools/tmux
@@ -116,7 +116,8 @@
 fi
 
 CONFIG_DEVICE_PATH=$CONFIG
-if [[ "$CONFIG" != ":test" ]]; then
+CMD_OPTS=""
+if [[ "$CONFIG" == *.protobuf ]]; then
   CONFIG_DEVICE_PATH=$DIR/$CONFIG.protobuf
   CONFIG_PATH=$OUT/$CONFIG.protobuf;
   if [[ ! -f $CONFIG_PATH ]]; then
@@ -124,6 +125,15 @@
     exit 1
   fi
   push $CONFIG_PATH
+elif [[ "$CONFIG" != ":test" ]]; then
+  CONFIG_DEVICE_PATH=$DIR/$CONFIG
+  CONFIG_PATH=test/configs/$CONFIG;
+  if [[ ! -f $CONFIG_PATH ]]; then
+    echo 'Config "'$CONFIG_PATH'" not known.'
+    exit 1
+  fi
+  CMD_OPTS="--txt $CMD_OPTS"
+  push $CONFIG_PATH
 fi
 
 POSTFIX=""
@@ -179,7 +189,7 @@
 tmux send-keys "$PREFIX PERFETTO_METATRACE_FILE=$DIR/mtrace $DIR/traced_probes $POSTFIX" Enter
 
 tmux select-pane -t 2
-tmux send-keys "$PREFIX $DIR/perfetto -c $CONFIG_DEVICE_PATH -o $DIR/trace $POSTFIX"
+tmux send-keys "$PREFIX $DIR/perfetto $CMD_OPTS -c $CONFIG_DEVICE_PATH -o $DIR/trace $POSTFIX"
 
 # Select consumer pane.
 tmux select-pane -t 2