[PATCH] D47913: [Support] Introduce a new utility for testing child process execution

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 15:31:52 PDT 2018


zturner created this revision.
zturner added reviewers: echristo, dblaikie.
Herald added a subscriber: mgorny.

I was auditing our process launching API and looking at how well it was tested, and I noticed that none of the functionality related to I/O redirection was tested at all.  I also noticed that all testing was done via unit tests and they are all extremely hard to understand and follow.

The approach here is more LLVMish, using a tool to dump some output and then FileCheck it.  Since I was specifically trying to test re-direction here, the only support I've added so far is for specifying command line arguments that describe how to redirect stdout and stderr, and I wrote some tests which I believe are significantly easier to understand than the existing unit tests.

There are plenty of other interesting opportunities for exploration with a tool such as this.  For example, LLDB (or any kind of tracing utility) could use it as a kind of "strace" equivalent where it logs all of its events and we could FileCheck that.

In a followup patch, I plan to use this mechanism to test that launching a process with a specific environment works.  I am going to do this by introducing meta-variable substitutions into the command language, so that you can write something like `write stdout $ENV{PATH}`


https://reviews.llvm.org/D47913

Files:
  llvm/CMakeLists.txt
  llvm/test/Support/execute.test
  llvm/test/lit.cfg.py
  llvm/utils/trace/CMakeLists.txt
  llvm/utils/trace/Trace.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47913.150416.patch
Type: text/x-patch
Size: 8833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180607/3352eddc/attachment.bin>


More information about the llvm-commits mailing list