This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Don't rerun supportsVerify for each individual test
ClosedPublic

Authored by mstorsjo on Dec 19 2021, 2:59 PM.

Details

Summary

We can't just memoize _supportsVerify in place in format.py, as it
previously was executed in each of the individual processes.

Instead move the function to dsl.py and add a feature flag for it
instead, which can be used both by tests (that already have such
a flag, locally for one set of tests) and for the testing framework
itself.

Diff Detail

Event Timeline

mstorsjo created this revision.Dec 19 2021, 2:59 PM
mstorsjo requested review of this revision.Dec 19 2021, 2:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2021, 2:59 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne requested changes to this revision.Dec 20 2021, 8:08 AM
ldionne added inline comments.
libcxx/utils/libcxx/test/dsl.py
180–185

If we move it here, I suggest we rewrite it as:

return hasCompileFlag(config, '-Xclang -verify-ignore-unexpected')
libcxx/utils/libcxx/test/format.py
219

I wonder why I didn't do it that way from the start. I guess it's because we didn't have features.py when I first introduced the new testing format.

This revision now requires changes to proceed.Dec 20 2021, 8:08 AM
mstorsjo marked an inline comment as done.Dec 20 2021, 9:18 AM
mstorsjo added inline comments.
libcxx/utils/libcxx/test/dsl.py
180–185

Ok, will try. That actually would fix two other issues I was planning on fixing afterwards.

mstorsjo updated this revision to Diff 395478.Dec 20 2021, 9:23 AM
mstorsjo marked an inline comment as done.

Use hasCompileFlag() instead of the original code.

ldionne accepted this revision.Dec 21 2021, 6:52 AM

This LGTM, but even better would be to actually remove def supportsVerify(config) altogether and inline the check in Feature(name='verify-support', ...). Sorry I didn't suggest that yesterday.

This revision is now accepted and ready to land.Dec 21 2021, 6:52 AM
mstorsjo updated this revision to Diff 395667.Dec 21 2021, 6:57 AM

Remove the superfluous intermediate function altogether

Extra conclusion (I'll amend it to the commit message):

By reimplementing this based on hasCompileFlag(), it also implicitly fixes two other issues: Previously, _supportsVerify called subprocess.call() directly, which can interpret command line quoting differently than lit.TestRunner.

(In particular, TestRunner handles arguments quoted by a single quote, while launching Windows processes with subprocess.call() only supports double quotes. This allows using shlex.quote(), which uses single quotes, everywhere - as all commands now go through TestRunner.)

Secondly, the old _supportsVerify method didn't include either %{flags) or %{compile_flags}.

ldionne accepted this revision.Dec 21 2021, 9:00 AM