[PATCH] D31550: Let the OS take care of the current working directory

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 17:36:42 PDT 2017


rnk added a comment.

chdir isn't thread safe, and lit still supports running the tests with threads. It looks like there are portability issues with requiring multiprocessing everywhere, so I think this change would require conditionally launching a child python process to implement the internal shell. That also kind of sucks, though, since python process startup isn't fast.

I also kind of liked emulating the shell environment. It seemed cleaner than manipulating global state. That's a minor concern, though.

I think you're right, if we want to implement subshells and ulimit, we need to create a process and manipulate its environment, cwd, etc. What we have stops just short of that, since I've basically assumed that we will never implement shell variable expansion or subshells. I'd be happy if lit could do more basic environment variable manipulation (export), but subshells felt like a bridge too far. I figured tests that needed this stuff could call bash directly and have a `REQUIRES: bash` line or something.

Do you think we can reasonably implement variable expansion? The last time I looked at it, it seemed too hard, and I worked around the problem by adding more lit substitutions. Maybe it would be OK if we just implemented the ${} expansion syntax?


https://reviews.llvm.org/D31550





More information about the llvm-commits mailing list