Adjust libc++ test infastructure to fully support modules

This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways:

1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules.
2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled.

This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features.

NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-12-05 23:16:07 +00:00
parent c6d8e8a9cc
commit bca6de0e4e
37 changed files with 207 additions and 140 deletions

View File

@@ -10,16 +10,13 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class ...Mutex> class lock_guard;
// lock_guard(Mutex&..., adopt_lock_t);
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>

View File

@@ -10,16 +10,13 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class ...Mutex> class lock_guard;
// lock_guard& operator=(lock_guard const&) = delete;
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>

View File

@@ -10,16 +10,13 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class ...Mutex> class lock_guard;
// lock_guard(lock_guard const&) = delete;
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>

View File

@@ -10,16 +10,13 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class ...Mutex> class lock_guard;
// explicit lock_guard(Mutex&...);
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>

View File

@@ -10,16 +10,13 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class ...Mutex> class lock_guard;
// explicit lock_guard(mutex_type& m);
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>

View File

@@ -16,5 +16,6 @@
// dialects, including C++03, even though it is forward declared using
// variadic templates.
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include "mutex.pass.cpp" // Use the existing non-variadic test

View File

@@ -10,10 +10,6 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// FIXME: When modules are enabled we can't affect the contents of <mutex>
// by defining a macro
// XFAIL: -fmodules
// <mutex>
// template <class Mutex>
@@ -24,6 +20,7 @@
// ...
// };
// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <type_traits>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -9,7 +9,7 @@
//
// UNSUPPORTED: libcpp-has-no-threads
// FLAKY_TEST
// FLAKY_TEST.
// <mutex>

View File

@@ -9,7 +9,7 @@
//
// UNSUPPORTED: libcpp-has-no-threads
// FLAKY_TEST
// FLAKY_TEST.
// <mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>

View File

@@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
// FLAKY_TEST
// FLAKY_TEST.
// <shared_mutex>