Write a wrapper to record logcat while another process is running

It is often useful to have the device logcat from while our tests are
running. Until now this had to be done manually. This adds a wrapper
script that will run another script with logcat running in the
background. The logcat is written to the '-o' or --output file.
--logcat-invoke '<invoke>' lets one control how the logcat is
collected. The output of the command is piped to the logcat file.  The
command is killed with SIGTERM when the testing ends. Users should be
very careful that everything is properly quoted.

Test: ./tools/wrap-logcat.py -o /tmp/test-logcat \
                             --logcat-invoke 'adb logcat -v threadtime' \
                             './test/run-test --dev 001-HelloWorld'
Bug: 74429665

Change-Id: I70527b5b9e1547aa1f97a217ec56fd1ffc0c235c
1 file changed