[libc++] Make the verify-support feature implicit

Tests that require support for Clang-verify are already marked as such
explicitly by their extension, which is .verify.cpp. Requiring the use
of an explicit Lit feature is, after thought, not really helpful.

This is a change in design: we have been bitten in the past by tests not
being enabled when we thought they were. However, the issue was mostly
with file extensions being ignored. The fix for that is not to blindly
require explicit features all the time, but instead to report all files
that are in the suite but that don't match any known test format. This
can be implemented in a follow-up patch.
This commit is contained in:
Louis Dionne 2020-04-27 12:49:01 -04:00
parent bd3058e82d
commit 2fd7d364cd
84 changed files with 27 additions and 155 deletions

View File

@ -19,7 +19,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE

View File

@ -10,7 +10,7 @@
// when -fdelayed-template-parsing is enabled, like it is on Windows.
// XFAIL: LIBCXX-WINDOWS-FIXME
// REQUIRES: verify-support, diagnose-if-support
// REQUIRES: diagnose-if-support
// UNSUPPORTED: libcpp-has-no-threads
// <atomic>

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// Test that libc++ does not generate a warning diagnostic about the comparator
// too early for containers of incomplete types.

View File

@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: diagnose-if-support, verify-support
// REQUIRES: diagnose-if-support
// Test that libc++ generates a warning diagnostic when the container is
// provided a non-const callable comparator.

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// Test that libc++ does not generate a warning diagnostic about the comparator
// or the hasher too early for containers of incomplete types.

View File

@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: diagnose-if-support, verify-support
// REQUIRES: diagnose-if-support
// Test that libc++ generates a warning diagnostic when the container is
// provided a non-const callable comparator or a non-const hasher.

View File

@ -20,7 +20,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// UNSUPPORTED: c++98 || c++03
#include <cstdio>

View File

@ -15,7 +15,6 @@
// Deprecated in C++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// <memory>

View File

@ -14,7 +14,6 @@
// Deprecated in C++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS

View File

@ -28,7 +28,6 @@
// Deprecated in C++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
// Clang 6 does not handle the deprecated attribute on template members properly,
// so the rebind<int> check below fails.

View File

@ -22,7 +22,6 @@
// Deprecated in C++17
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS

View File

@ -10,7 +10,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS

View File

@ -16,8 +16,6 @@
// GCC 7 is the first version to introduce [[nodiscard]]
// UNSUPPORTED: gcc-5, gcc-6
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
#include <__config>

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// GCC 7 is the first version to introduce [[nodiscard]]
// UNSUPPORTED: gcc-5, gcc-6

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// GCC 7 is the first version to introduce [[nodiscard]]
// UNSUPPORTED: gcc-5, gcc-6

View File

@ -11,7 +11,6 @@
// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <__config>

View File

@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// AppleClang9 doesn't yet support C++17's implicitly synthesized deduction
// guides from existing ctors, needed by default_searcher() below.

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// UNSUPPORTED: c++98, c++03
// <experimental/filesystem>

View File

@ -1,18 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Make sure that we provide the %{verify} substitution. We can only test
// this when the verify-support feature is enabled, and it's difficult to
// check that it's enabled when it should be, so we just trust that it is.
// REQUIRES: verify-support
// RUN: test -n "%{verify}"
// RUN: %{cxx} %s %{flags} %{compile_flags} -fsyntax-only %{verify}
// expected-no-diagnostics

View File

@ -0,0 +1,6 @@
import libcxx.test.newformat
# The tests in this directory need to know whether Clang-verify is supported
# to work properly.
if libcxx.test.newformat._supportsVerify(config):
config.available_features.add('verify-support')

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// XFAIL: *
// Make sure the test DOES NOT pass if there are no diagnostics, but we didn't

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// Make sure the test passes if we expected no diagnostics
// expected-no-diagnostics

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// Make sure the test passes if the expected diagnostic is correct.
struct Foo { };

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// REQUIRES: verify-support
// XFAIL: *
// Make sure the test DOES NOT pass if the expected diagnostic is wrong.

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
// REQUIRES: with_system_cxx_lib=macosx
// REQUIRES: availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
// REQUIRES: with_system_cxx_lib=macosx
// REQUIRES: availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
// REQUIRES: with_system_cxx_lib=macosx
// REQUIRES: availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
// REQUIRES: with_system_cxx_lib=macosx
// REQUIRES: availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-has-no-threads
// REQUIRES: verify-support
// [[nodiscard]] on constructors isn't supported by all compilers
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9

View File

@ -12,7 +12,6 @@
// Check that libc++'s emulation of std::function is deprecated in C++03
// REQUIRES: c++98 || c++03
// REQUIRES: verify-support
#include <functional>
#include "test_macros.h"

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <map>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <map>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <set>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <set>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <queue>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <queue>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <stack>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <array>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <deque>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <forward_list>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <list>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <vector>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <vector>

View File

@ -9,7 +9,6 @@
// Make sure that a std::vector containing move-only types can't be copied.
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
#include <vector>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <unordered_map>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <unordered_map>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <unordered_set>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <unordered_set>

View File

@ -12,7 +12,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>

View File

@ -12,7 +12,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>

View File

@ -12,7 +12,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>

View File

@ -12,7 +12,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include "filesystem_include.h"

View File

@ -13,7 +13,6 @@
// template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <vector>
#include <iterator>

View File

@ -13,7 +13,6 @@
// template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <vector>
#include <iterator>

View File

@ -13,7 +13,6 @@
// template <class E> constexpr bool empty(initializer_list<E> il) noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <initializer_list>
#include <iterator>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -12,7 +12,6 @@
// void* operator new[](std::size_t, void *);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <new>

View File

@ -12,7 +12,6 @@
// void* operator new(std::size_t, void *);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <new>

View File

@ -12,7 +12,6 @@
// void* operator new(std::size_t);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <new>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// REQUIRES: -faligned-allocation
// ADDITIONAL_COMPILE_FLAGS: -faligned-allocation

View File

@ -12,7 +12,6 @@
// void* operator new(std::size_t, std::nothrow_t &);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <new>

View File

@ -12,7 +12,6 @@
// template <class T> constexpr T* launder(T* p) noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <new>
#include <cassert>

View File

@ -13,7 +13,6 @@
// bool empty() const;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <regex>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <string>

View File

@ -14,7 +14,6 @@
// bool empty() const noexcept;
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <string_view>

View File

@ -8,7 +8,6 @@
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// <future>

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// <memory>

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// <memory>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
#include <functional>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
#include <functional>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
#include <functional>

View File

@ -13,7 +13,6 @@
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
#include <functional>

View File

@ -16,7 +16,6 @@
// };
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
#include <memory>
#include <cstdint>

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// REQUIRES: verify-support
// <memory>

View File

@ -130,7 +130,6 @@ class Configuration(object):
self.configure_obj_root()
self.configure_cxx_stdlib_under_test()
self.configure_cxx_library_root()
self.configure_use_clang_verify()
self.configure_use_thread_safety()
self.configure_ccache()
self.configure_compile_flags()
@ -323,16 +322,6 @@ class Configuration(object):
if self.get_lit_conf('enable_experimental') is None:
self.config.enable_experimental = 'true'
def configure_use_clang_verify(self):
'''If set, run clang with -verify on failing tests.'''
self.use_clang_verify = self.get_lit_bool('use_clang_verify')
if self.use_clang_verify is None:
# NOTE: We do not test for the -verify flag directly because
# -verify will always exit with non-zero on an empty file.
self.use_clang_verify = self.cxx.isVerifySupported()
self.lit_config.note(
"inferred use_clang_verify as: %r" % self.use_clang_verify)
def configure_use_thread_safety(self):
'''If set, run clang with -verify on failing tests.'''
has_thread_safety = self.cxx.hasCompileFlag('-Werror=thread-safety')

View File

@ -135,8 +135,6 @@ class LibcxxTestFormat(object):
substitutions.append(('%{file_dependencies}', ' '.join(data_files)))
# Add other convenience substitutions
if self.cxx.isVerifySupported():
substitutions.append(('%{verify}', ' '.join(self.cxx.verify_flags)))
substitutions.append(('%{build}', '%{cxx} -o %t.exe %s %{flags} %{compile_flags} %{link_flags}'))
substitutions.append(('%{run}', '%{exec} %t.exe'))

View File

@ -13,16 +13,16 @@ import pipes
import re
import subprocess
def _supportsVerify(test):
def _supportsVerify(config):
"""
Determine whether clang-verify is supported for that test.
Determine whether clang-verify is supported by the given configuration.
This is done by checking whether the %{cxx} substitution supports certain
compiler flags.
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], test.config.substitutions,
recursion_limit=test.config.recursiveExpansionLimit)[0]
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
@ -56,11 +56,6 @@ def parseScript(test, preamble, fileDependencies):
substitutions.append(('%{build}', '%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe'))
substitutions.append(('%{run}', '%{exec} %t.exe'))
# Add the %{verify} substitution and the verify-support feature if Clang-verify is supported
if _supportsVerify(test):
test.config.available_features.add('verify-support')
substitutions.append(('%{verify}', '-Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0'))
# Parse the test file, including custom directives
additionalCompileFlags = []
fileDependencies = list(fileDependencies)
@ -125,7 +120,9 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
FOO.sh.<anything> - A builtin Lit Shell test
FOO.verify.cpp - Compiles with clang-verify
FOO.verify.cpp - Compiles with clang-verify. This type of test is
automatically marked as UNSUPPORTED if the compiler
does not support Clang-verify.
FOO.fail.cpp - Compiled with clang-verify if clang-verify is
supported, and equivalent to a .compile.fail.cpp
@ -176,19 +173,7 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
Additional provided substitutions and features
==============================================
The test format will define the following substitutions for use inside
tests:
%{verify}
This expands to the set of flags that must be passed to the
compiler in order to use Clang-verify, if that is supported.
verify-support
This Lit feature will be made available when the compiler supports
Clang-verify. This can be used to disable tests that require that
feature, such as `.verify.cpp` tests.
The test format will define the following substitutions for use inside tests:
%{file_dependencies}
@ -203,18 +188,6 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
%{run}
Equivalent to `%{exec} %t.exe`. This is intended to be used
in conjunction with the %{build} substitution.
Design notes
============
This test format never implicitly disables a type of test. For example,
we could be tempted to automatically mark `.verify.cpp` tests as
UNSUPPORTED when clang-verify isn't supported by the compiler. However,
this sort of logic has been known to cause tests to be ignored in the
past, so we favour having tests mark themselves as unsupported explicitly.
This test format still needs work in the following areas:
- It is unknown how well it works on Windows yet.
"""
def getTestsInDirectory(self, testSuite, pathInSuite, litConfig, localConfig):
SUPPORTED_SUFFIXES = ['[.]pass[.]cpp$', '[.]pass[.]mm$', '[.]run[.]fail[.]cpp$',
@ -246,6 +219,8 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
def execute(self, test, litConfig):
self._checkBaseSubstitutions(test.config.substitutions)
VERIFY_FLAGS = '-Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0'
supportsVerify = _supportsVerify(test.config)
filename = test.path_in_suite[-1]
# TODO(ldionne): We currently disable tests that re-define _LIBCPP_ASSERT
@ -291,8 +266,11 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
]
return self._executeShTest(test, litConfig, steps, fileDependencies=['%t.exe'])
elif filename.endswith('.verify.cpp'):
if not supportsVerify:
return lit.Test.Result(lit.Test.UNSUPPORTED,
"Test {} requires support for Clang-verify, which isn't supported by the compiler".format(test.getFullName()))
steps = [
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only %{verify}"
"%dbg(COMPILED WITH) %{{cxx}} %s %{{flags}} %{{compile_flags}} -fsyntax-only {}".format(VERIFY_FLAGS)
]
return self._executeShTest(test, litConfig, steps)
# Make sure to check these ones last, since they will match other
@ -307,9 +285,9 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
# otherwise it's like a .compile.fail.cpp test. This is only provided
# for backwards compatibility with the test suite.
elif filename.endswith('.fail.cpp'):
if _supportsVerify(test):
if supportsVerify:
steps = [
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only %{verify}"
"%dbg(COMPILED WITH) %{{cxx}} %s %{{flags}} %{{compile_flags}} -fsyntax-only {}".format(VERIFY_FLAGS)
]
else:
steps = [