Commit Graph

1697 Commits

Author SHA1 Message Date
Marshall Clow
8283709e91 Move the optional tests into test/experimental. They were put into test/utilities because optional was going to be part of C++14, and then was pulled and put into the Library Fundamentals TS instead. No funcitonality change here; just moving files around.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223778 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 15:07:42 +00:00
Marshall Clow
4ad67e08cb Add all the relational operators to std::experimental::optional. Also update bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223775 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 14:49:17 +00:00
Sergey Dmitrouk
fff544efbd Explicitly include <sched.h> for sched_yield()
It might be implicitly included by <pthread.h> (and that's why it worked
so far), but it's not guaranteed (for example, this is not the case with
newlib).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223661 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 14:50:21 +00:00
Eric Fiselier
2764d046a1 Give lit.cfg's threading options default values when not defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223601 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-07 08:52:19 +00:00
Eric Fiselier
427f1a3014 Mark a couple of tests as XFAIL with older compilers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223600 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-07 05:31:17 +00:00
Eric Fiselier
cd83c78703 Consolidate error reporting in lit.cfg
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223599 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-07 04:28:50 +00:00
Eric Fiselier
2050be27a4 Revert parts of r223594. Use DYLD_LIBRARY_PATH on OSX when running tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223598 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-07 00:34:23 +00:00
Eric Fiselier
74e7af0d75 Fix apple clang detection in lit.cfg
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223597 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 22:49:38 +00:00
Eric Fiselier
83313c7ee8 Unify and cleanup rpath handling in tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 22:08:51 +00:00
Eric Fiselier
c934ca7237 [libcxx] Add logic to probe compiler in tests.
Summary:
This patch probes the cxx compiler used during testing by getting it to dump its predefined macros. Based on the value of these macros the compiler name and compiler name + version are added to the available features.

There are three compiler names:
- `clang`
- `apple-clang`
- `gcc`.

The available features added are equivalent to:
- `'%s' % compiler_name`
- `'%s-%s.%s' % compiler_name, major_version, minor_version`

This information can be used to XFAIL tests on different compilers / versions.



Reviewers: mclow.lists, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6399

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223593 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 21:13:15 +00:00
Eric Fiselier
7330ed3228 Add support for building and testing libc++ without threads to CMake.
Currently hacks must be used in to configure and build libc++ without threads
when using CMake. This patch adds CMake options to enable/disable building with
threads and a monotonic clock.

This patch also propagates the configuration information to lit so the tests
are properly configured as well.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223591 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 21:02:58 +00:00
Eric Fiselier
a245f9b263 Improve error message when _LIBCPP_HAS_NO_MONOTONIC_CLOCK is used improperly
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223590 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 20:09:11 +00:00
JF Bastien
93cfd7fc4e libc++: support NaCl when building thread.cpp
Summary: NaCl shouldn't include sysctl.h when trying to determine std:🧵:hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std:🧵:hardware_concurrency > 0.

Test Plan: make check-libcxx

Reviewers: dschuff, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6470

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223128 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 17:30:19 +00:00
JF Bastien
2bd5ffd330 libc++: add NaCl and PNaCl support for std::random_device
Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.

This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).

Test Plan: ninja check-libcxx

Reviewers: dschuff, mclow.lists, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6442

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 19:19:55 +00:00
JF Bastien
6317e9b85a libc++: integral types trap on PNaCl
Reviewers: dschuff, danalbert

    Subscribers: jfb, cfe-commits

    Differential Revision: http://reviews.llvm.org/D6411

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 17:51:58 +00:00
Eric Fiselier
6cb69ffa0a Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222794 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 21:57:41 +00:00
Eric Fiselier
bd0000808d Use lit.util.executeCommand instead of our own version
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 03:03:32 +00:00
Eric Fiselier
e6e69df598 Print lit configuration information after all configuration is done.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222711 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 23:46:42 +00:00
Dan Albert
877409a1c7 Add better support for custom test runners.
Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.

First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.

Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.

As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/

Reviewers: jroelofs, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6373

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222698 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 22:24:06 +00:00
Eric Fiselier
1567ac850c Handle extra whitespace in linux distribution name.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222514 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 08:54:35 +00:00
Eric Fiselier
aeff14fc74 Mark some locale tests as XFAIL on debian and opensuse.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222513 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 08:02:38 +00:00
Dan Albert
5980ce383f Add more REQUIRES: LOCALE.* to tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222492 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 01:23:04 +00:00
Eric Fiselier
2c7a32ff0f Remove xfail tag for darwin from quick_exit test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222406 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 03:40:32 +00:00
Eric Fiselier
c5e361d024 Remove tests that va_copy is not defined when C++ < 11.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 03:39:25 +00:00
Eric Fiselier
19fdbe53b7 Change contradictory wording in va_copy test error message.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222383 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 20:01:26 +00:00
Marshall Clow
03c6791dc6 Implement N4280 - 'Non-member size() and more'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222378 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 19:43:23 +00:00
Marshall Clow
ab5bd89de1 Added entries for bugs 2118 and 2306, which were closed in Urbana
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222361 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 15:59:16 +00:00
Eric Fiselier
c2f0e465ca Overhaul and separate nullptr_t tests to pass with C++03.
The standard requires that nullptr_t can be reinterpret_cast to an integral type
at least the size of nullptr_t. There is no way to emulate this conversion in
the C++03 nullptr_t implementation. The test for this conversion has been moved
to a new test and marked XFAIL with c++03.

This recommits what was originally r222296.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222318 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 05:49:03 +00:00
Eric Fiselier
33c5db58e7 Revert r222296 to fix bad commit message
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222316 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 05:41:29 +00:00
Eric Fiselier
221907d782 Cleanup quick_exit tests and get them passing in C++03.
Wrap the original test in _LIBCPP_HAS_QUICK_EXIT so it only runs when we have
quick_exit and add two new tests that check that when _LIBCPP_HAS_QUICK_EXIT
is not defined then no definition of std::at_quick_exit or std::quick_exit are
available.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222298 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 01:45:12 +00:00
Eric Fiselier
0bb95849ec diff --git a/test/language.support/support.types/nullptr_t.pass.cpp b/test/language.support/support.types/nullptr_t.pass.cpp
index 6c15fef..4d7c8b0 100644
--- a/test/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/language.support/support.types/nullptr_t.pass.cpp
@@ -18,42 +18,62 @@ struct A
     A(std::nullptr_t) {}
 };
 
+template <class T>
+void test_conversions()
+{
+    {
+        T p = 0;
+        assert(p == nullptr);
+    }
+    {
+        T p = nullptr;
+        assert(p == nullptr);
+        assert(nullptr == p);
+        assert(!(p != nullptr));
+        assert(!(nullptr != p));
+    }
+}
+
+template <class T>
+void test_comparisons()
+{
+    T p = nullptr;
+    assert(p == nullptr);
+    assert(p <= nullptr);
+    assert(p >= nullptr);
+    assert(!(p != nullptr));
+    assert(!(p < nullptr));
+    assert(!(p > nullptr));
+    assert(nullptr == p);
+    assert(nullptr <= p);
+    assert(nullptr >= p);
+    assert(!(nullptr != p));
+    assert(!(nullptr < p));
+    assert(!(nullptr > p));
+}
+
+
 int main()
 {
     static_assert(sizeof(std::nullptr_t) == sizeof(void*),
                   "sizeof(std::nullptr_t) == sizeof(void*)");
-    A* p = 0;
-    assert(p == nullptr);
-    void (A::*pmf)() = 0;
-#ifdef __clang__
-    // GCC 4.2 can't handle this
-    assert(pmf == nullptr);
-#endif
-    int A::*pmd = 0;
-    assert(pmd == nullptr);
-    A a1(nullptr);
-    A a2(0);
-    bool b = nullptr;
-    assert(!b);
-    assert(nullptr == nullptr);
-    assert(nullptr <= nullptr);
-    assert(nullptr >= nullptr);
-    assert(!(nullptr != nullptr));
-    assert(!(nullptr < nullptr));
-    assert(!(nullptr > nullptr));
-    A* a = nullptr;
-    assert(a == nullptr);
-    assert(a <= nullptr);
-    assert(a >= nullptr);
-    assert(!(a != nullptr));
-    assert(!(a < nullptr));
-    assert(!(a > nullptr));
-    assert(nullptr == a);
-    assert(nullptr <= a);
-    assert(nullptr >= a);
-    assert(!(nullptr != a));
-    assert(!(nullptr < a));
-    assert(!(nullptr > a));
-    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
-    assert(i == 0);
+
+    {
+        test_conversions<std::nullptr_t>();
+        test_conversions<void*>();
+        test_conversions<A*>();
+        test_conversions<void(*)()>();
+        test_conversions<void(A::*)()>();
+        test_conversions<int A::*>();
+    }
+    {
+        test_comparisons<std::nullptr_t>();
+        test_comparisons<void*>();
+        test_comparisons<A*>();
+        test_comparisons<void(*)()>();
+    }
+    {
+        bool b = nullptr;
+        assert(!b);
+    }
 }
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
new file mode 100644
index 0000000..92bd879
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// typedef decltype(nullptr) nullptr_t;
+
+#include <cstddef>
+
+int main()
+{
+    std::ptrdiff_t i = static_cast<std::ptrdiff_t>(nullptr);
+}
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
new file mode 100644
index 0000000..34c7a93
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: nullptr_t emulation cannot handle a reinterpret_cast to an
+// integral type
+// XFAIL: c++98, c++03
+
+// typedef decltype(nullptr) nullptr_t;
+
+
+#include <cstddef>
+#include <cassert>
+
+int main()
+{
+    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
+    assert(i == 0);
+}


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222296 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 01:31:56 +00:00
Eric Fiselier
1f8e21c6a3 Modify tests to check that va_copy is only defined in C++11 and beyond.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222282 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 23:46:18 +00:00
Eric Fiselier
f2215ae626 Flush out test cases for tuples constructor SFINAE
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222278 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 23:01:57 +00:00
Eric Fiselier
af2976deb3 Add support for LLVM_USE_SANITIZER=Thread
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 21:26:45 +00:00
Marshall Clow
b1d7c713b4 Marked LWG 2399 as complete. I committed a test for this earlier today.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222251 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 20:37:47 +00:00
Marshall Clow
7683fe2b7a Add a test for LWG issue #2399. We already implement this, but now we have a test as well.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222242 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 18:14:53 +00:00
Marshall Clow
9a4997ba29 Update status of LWG issues 2340, 2396 and 2401. In all three cases, these are things that we already do.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222240 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 17:35:16 +00:00
Marshall Clow
e52b63237a Since Eric poisoned the comma operator on all our test iterators, we no longer need 'comma_iterator'. Remove it from the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222238 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 16:15:00 +00:00
Marshall Clow
48b428d540 Fix the tests I broke with the last commit. Sorry for the noise
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222165 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 19:16:57 +00:00
Marshall Clow
4b3ca8c249 Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add tests. Mark LWG2400 and LWG2404 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222161 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 19:05:50 +00:00
Marshall Clow
36628eb77a Reworked mismatch tests to count the number of comparisons, and make sure we are conforming with LWG2404. We are
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222159 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 18:52:25 +00:00
Marshall Clow
cfeac66f8c Fix a warning in the test; no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 16:34:44 +00:00
Marshall Clow
88aae920ef Implement void_t from N3911. Add a private version for use in the library before C++1z. Update the 1z status page, marking a bunch of issues that don't require library changes as complete (2129, 2212, 2230, 2233, 2325, 2365, 2376)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 15:50:08 +00:00
Marshall Clow
275b6bbe1c Add tests to ensure that reference_wrapper<T> is trivially copyable. This was added to C++1z with the adoption of N4277, but libc++ already implemented it as a conforming extension. No code changes were needed, just more tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 15:04:46 +00:00
Eric Fiselier
9a1468f79e Fix build regression caused by not defining ABI library macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222085 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 17:25:23 +00:00
Eric Fiselier
8e2855ce0b [libcxx] Refactor CMakeLists.txt handling of compile and link flags to suppress warnings.
Summary:
Currently we have 5 variables that are used to specify options for building libcxx
1. `LIBCXX_CXX_FEATURE_FLAGS`
2. `LIBCXX_CXX_WARNING_FLAGS`
3. `LIBCXX_CXX_REQUIRED_FLAGS`
4. `compile_flags` (in libcxx/lib)
5. `link_flags` (in libcxx/lib)

The first three all get put into `CMAKE_CXX_FLAGS`. 
This changes the way flags are handled by only using 3 different options:

1. `LIBCXX_CXX_FLAGS` - general compile and link flags.
2. `LIBCXX_COMPILE_FLAGS` - compile only flags.
3. `LIBCXX_LINK_FLAGS` - link only flags.

This patch also removes the warning about `-nostdinc++` being unused during linking.



Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6277

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222080 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 06:26:30 +00:00
Eric Fiselier
0364baca04 Split thread test into two parts. Mark one as XFAIL with ASAN.
The second part of the test checks that std::terminate is called when a running
thread is move assigned to. Calling std::terminate prevents some of the destructors
to be called and ASAN fires on this.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222076 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 01:58:45 +00:00
Eric Fiselier
017e1aab88 Initialize pointer in string conversion helpers to prevent MSAN diagnostic.
Since the initialization of the pointer happens across the libc library boundry
MSAN will not know the pointer was initialized. This fixes MSAN failures in
test/strings/string.conversions.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222052 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 22:23:57 +00:00
Eric Fiselier
1383dc5bd0 add debug info when compiling sanitizer tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222051 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 22:18:03 +00:00
Eric Fiselier
fd2848735a Add -gline-tables-only when compiling w/ sanitizers in RELEASE
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222035 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 20:38:07 +00:00