[PATCH] D18647: [lit][googletest] Don't choke on non-executables

Daniel Dunbar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 11:38:34 PDT 2016


In cases where this is trigger, wouldn't the warning always fire and the
proper way to suppress (so developers don't regularly see warnings) to
exclude that path? If so, then it seems like erroring out is ok, it just
forces resolution of that issue immediately.

On Thu, Mar 31, 2016 at 8:09 AM, Brian Gesiak <modocache at gmail.com> wrote:

> modocache created this revision.
> modocache added reviewers: ddunbar, abdulras.
> modocache added subscribers: llvm-commits, kastiglione.
>
> lit is usually forgiving when it comes to files that aren't tests, but
> happen to match the test suffix being searched for. For example, even if I
> specify a suffix of ".py", lit will not fail the test suite if it finds
> a Python file that doesn't contain any lit commands.
>
> lit's googletest format, on the other hand, is not as forgiving. If a
> normal, non-executable file matching the test suffix is found, lit
> attempts to execute it:
>
> ```
> NotATest --gtest_list_tests
> ```
>
> This fails, and causes lit to fail the test suite.
>
> To mirror the lit's lenient behavior with other test formats, instead
> of failing the test, have lit simply emit a warning instead. Add a test
> that verifies the new behavior.
>
> http://reviews.llvm.org/D18647
>
> Files:
>   utils/lit/lit/formats/googletest.py
>   utils/lit/tests/Inputs/googletest-format/DummySubDir/NotAGoogleTest
>
> Index: utils/lit/tests/Inputs/googletest-format/DummySubDir/NotAGoogleTest
> ===================================================================
> --- /dev/null
> +++ utils/lit/tests/Inputs/googletest-format/DummySubDir/NotAGoogleTest
> @@ -0,0 +1,3 @@
> +This file is not an executable, but it happens to have the same test
> suffix as
> +as the googletest executables in this directory. lit should emit a
> warning in
> +this case, but it should not fail the test suite.
> Index: utils/lit/lit/formats/googletest.py
> ===================================================================
> --- utils/lit/lit/formats/googletest.py
> +++ utils/lit/lit/formats/googletest.py
> @@ -35,8 +35,8 @@
>                lines = lines.replace('\r', '')
>              lines = lines.split('\n')
>          except:
> -            litConfig.error("unable to discover google-tests in %r" %
> path)
> -            raise StopIteration
> +            litConfig.warning("unable to discover google-tests in %r" %
> path)
> +            lines = []
>
>          nested_tests = []
>          for ln in lines:
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/cb464675/attachment.html>


More information about the llvm-commits mailing list