[PATCH] D35396: [lit] Make %T return a per-test temporary directory

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 14:18:43 PDT 2017

delcypher added a comment.

In https://reviews.llvm.org/D35396#839504, @george.karpenkov wrote:

> @delcypher I think LIT already does some magic to work with Windows, right? Many tests use `mkdir`, otherwise none of them would run.

The lit  shell tests have two modes. Internal and external. External just invokes bash and the internal shell implements a shell command parser in python.

The `executeScriptInternal()` function in `TestRunner.py` handles running commands using the internal shell. This eventually calls `_executeShCmd()`. If you look at the implementation is has special support of a few shell built-ins (namely `cd`, `echo`, `export` and `env`). I don't see any special support for `mkdir` though. If the command doesn't start with `.` then `lit.util.which()` will be used to find the executable. So AFAICT `mkdir` will just run the `mkdir` command when using the internal shell.

The approach I've used in the past to handle different system tools is to add a substitution that expands to the command appropriate for the platform.




More information about the llvm-commits mailing list