This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix the _supportsVerify check on Windows by fixing quoting
ClosedPublic

Authored by mstorsjo on May 28 2021, 4:24 AM.

Details

Summary

The pipes.quote function quotes using single quotes, the same goes
for the newer shlex.quote (which is the preferred form in Python 3).
This isn't suitable for quoting in command lines on Windows (and the
documentation for shlex.quote even says it's only usable for Unix
shells).

In general, the python subprocess.list2cmdline function should do
proper quoting for the platform's current shell. However, it doesn't
quote the ';' char, which we pass within some arguments to run.py.
Therefore use the custom reimplementation from lit.TestRunner.

This didn't matter for command lines that are executed by either bash
or the lit internal shell, but if executing things directly using
subprocess.call, as in _supportsVerify, the quoted path to %{cxx}
fails to be resolved by the Windows shell.

This unlocks 114 tests that previously were skipped on Windows.

This is one out of two possible ways of fixing the same problem; this
would seem like the proper solution, but ended up being a mess,
so therefore mostly posting it for reference.

Diff Detail

Event Timeline

mstorsjo created this revision.May 28 2021, 4:24 AM
mstorsjo requested review of this revision.May 28 2021, 4:24 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 28 2021, 4:24 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.May 28 2021, 5:23 AM

I like this better than the other approach, actually, because of the chicken-and-egg issue with the other one.

This revision is now accepted and ready to land.May 28 2021, 5:23 AM
mstorsjo updated this revision to Diff 348850.May 31 2021, 12:16 PM

Rerun CI after fixing the failing testcases that this unlocks.

This revision was landed with ongoing or failed builds.May 31 2021, 11:52 PM
This revision was automatically updated to reflect the committed changes.