This is an archive of the discontinued LLVM Phabricator instance.

[lit] Add LIT_DEBUG environment variable to support passing options though ninja
Needs ReviewPublic

Authored by george.karpenkov on Aug 8 2018, 6:11 PM.

Details

Summary

Currently, there two useful techniques for debugging failing tests from LIT:

  • -vv flag shows every line as it is executed
  • FILECHECK_DUMP_INPUT_ON_FAILURE tells FileCheck to show the original input which failed the comparison.

Note that -vv flag can not be passed through ninja, and a manual LIT invocation is required.
This patch proposes a unification of such debugging features under a common umbrella, so that each flag would not have to be memorized separately.

Diff Detail

Event Timeline

jdenny added inline comments.Aug 9 2018, 12:48 PM
llvm/utils/lit/lit/TestingConfig.py
24–25

If LIT_DEBUG=2 and FILECHECK_DUMP_INPUT_ON_FAILURE=0 are specified in the environment, does the former clobber the latter? Should it?

llvm/utils/lit/lit/main.py
204–208

If LIT_DEBUG>2, does debug_level=0? It seems you should have a diagnostic for unexpected LIT_DEBUG values, or you should at least let larger than expected values imply the largest expected value.

llvm/utils/lit/tests/Inputs/test_verbose_filecheck
11–13

I haven't tried out your dump feature yet, but I would've expected that CHECK-NEXT makes sense for the last three directives.

llvm/utils/lit/tests/shtest-run-at-line.py
6–7

If we change this to LIT_DEBUG=2, will this test still pass? It looks like it would, but I might have missed something.

I'm thinking that, by adding a few more FileCheck commands here (with different prefixes), you could easily extend this test to ensure that LIT_DEBUG=1 doesn't dump the file and that LIT_DEBUG=2 does dump it. Other tests already test that dumping works correctly, so here you could just test that it's been activated or not activated by looking for existence or absence of "Full input was".

Or you could put those kinds of checks in your other test, which currently only checks for file dumping at LIT_DEBUG=2.

@george.karpenkov: I don't know what your current plans are for this patch. I recall you once mentioned wanting it to set FileCheck's -v. D53517 could help with that, and it addresses other uses cases, such as color.