[llvm-dev] RFC: A cross platform way of using shell commands in lit tests

Zachary Turner via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 16 12:51:19 PDT 2016


I had considered this as well, and someone also asked the same question
offline.  Here's the response I gave:
---
The one thing that keeps me from being totally on board is that as part of
this, I want to encourage people to think of ways to write simpler tests.
Do we really need all this crap running sed, awk, grep, piping through 4
different intermediate processes, copying files around, and more?  Maybe at
that point you need to consider adding a new command line option to your
tool specificially make it easier to test.  Or do soemthing differently.
Having a FULL command set available means people will just do whatever
crazy thing they can think of instead of properly designing a test.  A good
example of this is the clang-tidy test I mentioned in the original post.  I
added an additional command line option to clang-tidy and rewrote that
entire test purely with run lines <https://reviews.llvm.org/D23533#56e9c922>
.
I think people should only be doing really simple shell activity from tests.
--

I agree it's much simpler.  On the other hand, maybe if we end up
implementing all this stuff directly into lit it's a moot point anyway.
Implementing it in lit has the added advantage that it doesn't involve
invoking a new process for every command, which is major performance
bottleneck on windows when running the test suite.

On Tue, Aug 16, 2016 at 12:39 PM Alex Bradbury <asb at asbradbury.org> wrote:

> On 16 August 2016 at 17:19, Zachary Turner via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > Well, It would be nice if we could remove the GnuWin32 dependency as
> well.
> > Lots of tests use grep, sed, cd, ln, or whatever.  Anyone who's ever
> tried
> > downloading and installing GnuWin32 knows what a pain it is.  It installs
> > programs called, for example, "link" which interfere with standard
> windows
> > tools, and puts them in your path.  There are other examples of this.
> And
> > it's also HUGE.  And nobody can ever figure out how to download it
> > correctly.  Plus there are some minor differences in the tools behavior.
> >
> > I'm proposing that we replace shell commands in tests with a tool that we
> > create which implements the most common shell commands and options.
>
> How about just using busybox-w32 for find, grep, sed, and other
> standard UNIX commands https://github.com/rmyorston/busybox-w32. It's
> a single exe < 500KiB.
>
> Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160816/9e5481ab/attachment.html>


More information about the llvm-dev mailing list