[lit] Always quote arguments containing '[' on windows
authorMartin Storsjö <martin@martin.st>
Tue, 6 Apr 2021 10:33:14 +0000 (13:33 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 14 Apr 2021 09:32:48 +0000 (12:32 +0300)
commit37935405efbebc4bd9f1ffac9152571c6a8469dc
treec6fcf73a1d2833e4f50fc86923b191a5859b451d
parent3b32dc4b84c8eaa0de337d6847c2c4cdbfcb4333
[lit] Always quote arguments containing '[' on windows

This avoids breaking clang-tidy/infrastructure/validate-check-names.cpp
if 'not' is evaluated as a lit internal tool (making TestRunner
invoke 'grep' directly in that test, instead of invoking 'not', which
then invokes 'grep').

The quoting of arguments is still brittle if the executable is an
MSYS based tool though, as MSYS based tools incorrectly unescape
backslashes in quoted arguments (contrary to regular win32 argument
parsing rules), see D99406 and
https://github.com/msys2/msys2-runtime/issues/36 for more examples
of the issues.

Differential Revision: https://reviews.llvm.org/D99938
llvm/test/Other/lit-quoting.txt
llvm/utils/lit/lit/TestRunner.py