This is an archive of the discontinued LLVM Phabricator instance.

[LIT] Add a .gitignore to llvm/utils/lit
AbandonedPublic

Authored by EricWF on Jul 18 2015, 12:59 PM.

Details

Summary

This patch adds a .gitignore to the llvm/utils/lit folder. There are two main reasons why it would be useful if LIT had it's own gitignore.

  1. When testing LIT in-tree, the tests create a folder test/Output which constantly has to be removed.
  2. When using LIT in a standalone repo, outside of the LLVM tree (see https://github.com/delcypher/llvm-lit), .pyc files are not ignored because the LLVM .gitignore is not present.

I'm not sure what the policy is for .gitignore's in a subtree of LLVM, but if this is acceptable I would like to add it.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 30086.Jul 18 2015, 12:59 PM
EricWF retitled this revision from to [LIT] Add a .gitignore to llvm/utils/lit.
EricWF updated this object.
EricWF added a reviewer: ddunbar.
EricWF set the repository for this revision to rL LLVM.
EricWF added a subscriber: llvm-commits.
EricWF added a subscriber: chandlerc.

@chandlerc: Do you have an objection to this patch on principle?

chandlerc edited edge metadata.Jul 20 2015, 4:54 PM

So, I don't think we should support testing in-tree because I don't like dirtying the tree.

What is the issue with .pyc files? I don't see how you get to that being a problem.

If you don't want *.pyc files, why not set the PYTHONDONTWRITEBYTECODE env var, or sys.dont_write_bytecode = false, or use python -B?

So, I don't think we should support testing in-tree because I don't like dirtying the tree.

"testing in-tree" is probably the wrong way to describe it. Currently LIT doesn't generate a check-lit rule
or a lit.site.cfg file. The only way (that I know of) to test LIT is to run lit.py llvm-src/utils/lit/tests. Because this doesn't
set the config.test_exec_root option the ShTest temporary directory will be llvm-src/utils/lit/tests/Output.

One way to keep the tree clean would be to set config.test_exec_root to a created temporary directory. However
I don't think this directory can be cleaned up though (other than by the OS).

What is the issue with .pyc files? I don't see how you get to that being a problem.

This is a problem I have outside of my LLVM work (so it's not a real reason to make this change). I use LIT on other projects as a git submodule. The LIT submodule is just llvm/utils/lit so llvm/.gitignore is not present. When python ends up generating the llvm/utils/lit/lit/*.pyc files they are not ignored by version control.

If you don't want *.pyc files, why not set the PYTHONDONTWRITEBYTECODE env var, or sys.dont_write_bytecode = false, or use python -B?

I don't mind the *.pyc files, I just want version control to ignore them when I'm using LIT as a submodule.

So, I don't think we should support testing in-tree because I don't like dirtying the tree.

"testing in-tree" is probably the wrong way to describe it. Currently LIT doesn't generate a check-lit rule
or a lit.site.cfg file. The only way (that I know of) to test LIT is to run lit.py llvm-src/utils/lit/tests. Because this doesn't
set the config.test_exec_root option the ShTest temporary directory will be llvm-src/utils/lit/tests/Output.

One way to keep the tree clean would be to set config.test_exec_root to a created temporary directory. However
I don't think this directory can be cleaned up though (other than by the OS).

Doing this or finding some other way of testing lit without dirtying the source tree sounds like the better fix to me.

What is the issue with .pyc files? I don't see how you get to that being a problem.

This is a problem I have outside of my LLVM work (so it's not a real reason to make this change). I use LIT on other projects as a git submodule. The LIT submodule is just llvm/utils/lit so llvm/.gitignore is not present. When python ends up generating the llvm/utils/lit/lit/*.pyc files they are not ignored by version control.

Well, you're dropping your submodule into some other tree, use its .gitignore? I guess that doesn't work because of how submodules work? You can create a clone-local ignores file, maybe use that?

Anyways, I don't think we should work around this in LLVM.

We could graduate lit to a full project and that would fix this. But I don't really think we should do that either, because I think it is useful for lit to remain crazy simple and *only* serve the purposes that LLVM testing has for it, and not become a fully generic test runner.

My 2 cents, others might disagree.

If you don't want *.pyc files, why not set the PYTHONDONTWRITEBYTECODE env var, or sys.dont_write_bytecode = false, or use python -B?

I don't mind the *.pyc files, I just want version control to ignore them when I'm using LIT as a submodule.

EricWF abandoned this revision.Jul 20 2015, 7:46 PM

Abandoning due to @chandlerc's feedback. I'm going to fix the Output problem differently.