[libcxx-commits] [PATCH] D116010: [libcxx] [test] Don't rerun supportsVerify for each individual test
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 20 09:23:04 PST 2021
mstorsjo updated this revision to Diff 395478.
mstorsjo marked an inline comment as done.
mstorsjo added a comment.
Use hasCompileFlag() instead of the original code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116010/new/
https://reviews.llvm.org/D116010
Files:
libcxx/test/libcxx/selftest/fail.cpp/lit.local.cfg
libcxx/utils/libcxx/test/dsl.py
libcxx/utils/libcxx/test/features.py
libcxx/utils/libcxx/test/format.py
Index: libcxx/utils/libcxx/test/format.py
===================================================================
--- libcxx/utils/libcxx/test/format.py
+++ libcxx/utils/libcxx/test/format.py
@@ -12,21 +12,6 @@
import pipes
import re
import shutil
-import subprocess
-
-def _supportsVerify(config):
- """
- Determine whether clang-verify is supported by the given configuration.
-
- This is done by checking whether the %{cxx} substitution in that
- configuration supports certain compiler flags.
- """
- command = "%{{cxx}} -xc++ {} -Werror -fsyntax-only -Xclang -verify-ignore-unexpected".format(os.devnull)
- command = lit.TestRunner.applySubstitutions([command], config.substitutions,
- recursion_limit=config.recursiveExpansionLimit)[0]
- devNull = open(os.devnull, 'w')
- result = subprocess.call(command, shell=True, stdout=devNull, stderr=devNull)
- return result == 0
def _getTempPaths(test):
"""
@@ -216,7 +201,7 @@
def execute(self, test, litConfig):
VERIFY_FLAGS = '-Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0'
- supportsVerify = _supportsVerify(test.config)
+ supportsVerify = 'verify-support' in test.config.available_features
filename = test.path_in_suite[-1]
# TODO(ldionne): We currently disable tests that re-define _LIBCPP_ASSERT
Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -41,6 +41,7 @@
Feature(name='has-fobjc-arc', when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc') and
sys.platform.lower().strip() == 'darwin'), # TODO: this doesn't handle cross-compiling to Apple platforms.
Feature(name='objective-c++', when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc')),
+ Feature(name='verify-support', when=lambda cfg: supportsVerify(cfg)),
Feature(name='non-lockfree-atomics',
when=lambda cfg: sourceBuilds(cfg, """
Index: libcxx/utils/libcxx/test/dsl.py
===================================================================
--- libcxx/utils/libcxx/test/dsl.py
+++ libcxx/utils/libcxx/test/dsl.py
@@ -12,6 +12,7 @@
import platform
import re
import shutil
+import subprocess
import tempfile
import libcxx.test.format
@@ -168,6 +169,16 @@
])
return exitCode == 0
+ at _memoizeExpensiveOperation(lambda c: (c.substitutions, c.environment))
+def supportsVerify(config):
+ """
+ Determine whether clang-verify is supported by the given configuration.
+
+ This is done by checking whether the %{cxx} substitution in that
+ configuration supports certain compiler flags.
+ """
+ return hasCompileFlag(config, '-Xclang -verify-ignore-unexpected')
+
@_memoizeExpensiveOperation(lambda c, s: (c.substitutions, c.environment, s))
def runScriptExitCode(config, script):
"""
Index: libcxx/test/libcxx/selftest/fail.cpp/lit.local.cfg
===================================================================
--- libcxx/test/libcxx/selftest/fail.cpp/lit.local.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-import libcxx.test.format
-
-# The tests in this directory need to know whether Clang-verify is supported
-# to work properly.
-if libcxx.test.format._supportsVerify(config):
- config.available_features.add('verify-support')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116010.395478.patch
Type: text/x-patch
Size: 3536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211220/ca91eda5/attachment-0001.bin>
More information about the libcxx-commits
mailing list