This is an archive of the discontinued LLVM Phabricator instance.

Modify LIT to accept environment variable LIT_FILTER to select tests.
ClosedPublic

Authored by george.karpenkov on Jul 6 2017, 2:49 PM.

Details

Summary

This is especially useful when lit is invoked indirectly by the build
system, and additional arguments can not be easily specified.

Diff Detail

Repository
rL LLVM

Event Timeline

This revision is now accepted and ready to land.Jul 6 2017, 4:45 PM
This revision was automatically updated to reflect the committed changes.
mgorny added a subscriber: mgorny.Jul 25 2017, 2:43 PM

I'm sorry to crash the party but the added test fails on Linux:

$ "LIT_FILTER=o[a-z]e" "/usr/src/llvm/utils/lit/_venv/bin/python" "/usr/src/llvm/utils/lit/tests/../lit.py" "/usr/src/llvm/utils/lit/tests/../tests/Inputs/discovery"
# command stderr:
'LIT_FILTER=o[a-z]e': command not found
error: command failed with exit status: 127

It looks that lit does not expect shell-style variable substitutions here. I would suggest using env ... but I suppose that wouldn't be portable to Windows (not that I expect the current syntax to work any better there).

@mgorny I can fix this on Linux. I will not be able to do testing on Windows though.
TBH I haven't been able to run tests: how did you do that? I've even opened a bug about this: https://bugs.llvm.org/show_bug.cgi?id=33704
Is there a buildbot checking for those?

TBH I haven't been able to run tests: how did you do that? I've even opened a bug about this: https://bugs.llvm.org/show_bug.cgi?id=33704

./lit.py -v tests ;-)

Is there a buildbot checking for those?

I'd like to pursue one once we get all the current failures fixed.

@mgorny I still can't run them:

  1. No class called FileBasedTest: where is it?
  2. From which directory do you run it? If I run it from util/lit it misses FileCheck/etc. Or do you just modify $PATH?
  3. Can we document it somewhere?

@mgorny I still can't run them:

  1. No class called FileBasedTest: where is it?

It's a breakage from another commit. I'm currently working on finding a proper solution for it.

  1. From which directory do you run it? If I run it from util/lit it misses FileCheck/etc. Or do you just modify $PATH?

I have it installed in /usr/bin. However, modifying PATH should work as well.

  1. Can we document it somewhere?

Sure, please do ;-). Or maybe even add a CMake target for it ;-).

modocache edited edge metadata.Jul 25 2017, 3:20 PM

Running tests is documented in utils/lit/README.txt, in the section Contributing to lit.

As for a CMake target for lit tests, @delcypher added one in rL257221, but it was reverted because the tests failed on Windows.

@modocache

Running tests is documented

Yeah, but they were failing, so I thought that maybe the documentation is out of date.

but it was reverted because the tests failed on Windows

that's a shame, can't we simply if/def around it for MSVC?

Yeah, but they were failing, so I thought that maybe the documentation is out of date.

Ah, whoops, I hadn't read your comment above before posting -- sorry!

that's a shame, can't we simply if/def around it for MSVC?

I agree, I think this would be a good thing to do as soon as possible. Unfortunately part of the test suite fails on all host machines at the moment. I commented on https://reviews.llvm.org/D35857#820783 with how I think would be a good way to proceed -- sorry for the scattered discussion.