This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Add from-scratch testing configs for Windows
ClosedPublic

Authored by mstorsjo on Oct 5 2021, 5:51 PM.

Details

Reviewers
ldionne
yln
Group Reviewers
Restricted Project
Commits
rG7176799a7e19: [libc++] Add from-scratch testing configs for Windows
Summary

The paths to the compiler and to the python executable may need to
be quoted (if they're installed into e.g. "C:\Program Files").

All testing commands that are executed expect a gcc compatible command
line interface, while clang-cl uses different command line options.
In the original testing config, if the chosen compiler was clang-cl, it
was replaced with clang++ by looking for such an executable in the path.

For the new from-scratch test configs, I instead chose to add
"--driver-mode=g++" to flags - invoking "clang-cl --driver-mode=g++"
has the same effect as invoking "clang++", without needing to run any
heuristics for picking a different compiler executable.

This requires including %{{flags}} in the _supportsVerify function,
as running plain %{{cxx} on its own won't work that way. Alternatively,
the --driver-mode option could be appended on the %{cxx} substitution
(but it's not straightforward to change substitutions that already are
defined).

Diff Detail

Event Timeline

ldionne created this revision.Oct 5 2021, 5:51 PM
ldionne requested review of this revision.Oct 5 2021, 5:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2021, 5:51 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne updated this revision to Diff 377648.Oct 6 2021, 12:52 PM

Rebase onto main

ldionne updated this revision to Diff 377942.Oct 7 2021, 11:56 AM
ldionne retitled this revision from [libc++] Add barebones testing configs for GCC and Windows to [libc++] Add a from-scratch testing config for Windows.

Split the GCC part off.

@mstorsjo Could you please commandeer this per our discussion on Discord?

mstorsjo commandeered this revision.Oct 7 2021, 2:40 PM
mstorsjo added a reviewer: ldionne.

Sure. I'll pick this up and try to complete it a bit later.

mstorsjo updated this revision to Diff 392934.Dec 8 2021, 2:10 PM

Updated to work for both the clang-cl and mingw configurations. This goes on top of D11539.

mstorsjo retitled this revision from [libc++] Add a from-scratch testing config for Windows to [libc++] Add from-scratch testing configs for Windows.Dec 8 2021, 2:11 PM
mstorsjo edited the summary of this revision. (Show Details)
ldionne requested changes to this revision.Dec 8 2021, 2:23 PM
ldionne added inline comments.
libcxx/test/configs/llvm-libc++-mingw.cfg.in
15

There's a weird character here.

libcxx/utils/libcxx/test/format.py
24 ↗(On Diff #392934)

If we do this, I think it should then be %{{flags}} %{{compile_flags}}.

libcxx/utils/libcxx/test/newconfig.py
14–17 ↗(On Diff #392934)

I suggest we simply move that to lit.TestRunner. It's too general purpose to be included in newconfig.py, even though I know that is convenient.

50 ↗(On Diff #392934)

If this is necessary, IMO this should be part of lit_config.note() itself.

This revision now requires changes to proceed.Dec 8 2021, 2:23 PM
mstorsjo added inline comments.Dec 8 2021, 2:45 PM
libcxx/test/configs/llvm-libc++-mingw.cfg.in
15

Oops, will fix.

libcxx/utils/libcxx/test/format.py
24 ↗(On Diff #392934)

Yes, that's probably most consistent, and that substitution shouldn't have anything that we can't use here.

libcxx/utils/libcxx/test/newconfig.py
14–17 ↗(On Diff #392934)

Ok, I'll see about that.

50 ↗(On Diff #392934)

Ok, I'll try that too.

mstorsjo updated this revision to Diff 393124.Dec 9 2021, 5:29 AM
mstorsjo edited the summary of this revision. (Show Details)

Updated for changes to %{executor} in the previous patch, removing the need for using quote() in the individual configs. Moved the quote function to lit.TestRunner and flushing into lit.LitConfig._write_message(). Added %{{compile_flags}} in _supportsVerify for consistency. Got rid of the unexpected unicode NBSP.

The lit changes probably should be split out and reviewed separately, but keeping them in this review for one round at least, to simplify running the CI.

Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2021, 5:29 AM
mstorsjo updated this revision to Diff 393277.Dec 9 2021, 1:36 PM

Fix the final CI config

ldionne added a reviewer: yln.Dec 9 2021, 1:47 PM
ldionne added a subscriber: yln.

Adding @yln for the Lit part.

Adding @yln for the Lit part.

I can of course split out the Lit parts into separate patches, but the quote() function on its own is a bit tricky to submit without the use case attached.

mstorsjo updated this revision to Diff 395755.Dec 21 2021, 2:46 PM

Rebased on top of the split out changes. Now the remaining bits here should be pretty much straightforward.

I opted to rename the config files from "llvm-libc++-static-clangcl.cfg"
to "llvm-libc++-clangcl-static.cfg", where the latter feels like a more
logical hierarchical name to me.

ldionne accepted this revision.Dec 21 2021, 2:54 PM

Regarding naming, we already have llvm-libc++-shared-gcc.cfg.in, so please either update that one in a separate patch too, or keep the compiler last for consistency. Either way works for me.

Thanks a lot for splitting off the other changes, I think we've managed to improve the infrastructure while adding support for this platform, which is the way it should be done. Thanks for your work on this.

LGTM if CI is green -- I don't think I need to see this even if further changes are required, so don't be blocked on me being absent during the holidays in case you need to make more changes to make this pass.

This revision is now accepted and ready to land.Dec 21 2021, 2:54 PM
mstorsjo updated this revision to Diff 395769.Dec 21 2021, 4:12 PM

Restored the naming to llvm-libc++-{static,shared}-clangcl.cfg.in for now (not worth breaking the consistency with the -gcc one for now), rerunning CI.

This revision was automatically updated to reflect the committed changes.