summaryrefslogtreecommitdiffstats
path: root/libcxx/test
Commit message (Collapse)AuthorAgeFilesLines
* Give lit.cfg's threading options default values when not defined.Eric Fiselier2014-12-071-5/+4
| | | | llvm-svn: 223601
* Mark a couple of tests as XFAIL with older compilers.Eric Fiselier2014-12-072-0/+7
| | | | llvm-svn: 223600
* Consolidate error reporting in lit.cfgEric Fiselier2014-12-071-36/+23
| | | | llvm-svn: 223599
* Revert parts of r223594. Use DYLD_LIBRARY_PATH on OSX when running tests.Eric Fiselier2014-12-071-1/+4
| | | | llvm-svn: 223598
* Fix apple clang detection in lit.cfgEric Fiselier2014-12-061-1/+1
| | | | llvm-svn: 223597
* Unify and cleanup rpath handling in tests.Eric Fiselier2014-12-061-10/+3
| | | | llvm-svn: 223594
* [libcxx] Add logic to probe compiler in tests.Eric Fiselier2014-12-061-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 223593
* Add support for building and testing libc++ without threads to CMake.Eric Fiselier2014-12-063-11/+32
| | | | | | | | | | | 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. llvm-svn: 223591
* libc++: add NaCl and PNaCl support for std::random_deviceJF Bastien2014-12-011-30/+66
| | | | | | | | | | | | | | | | | 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 llvm-svn: 223068
* libc++: integral types trap on PNaClJF Bastien2014-11-261-1/+1
| | | | | | | | | | Reviewers: dschuff, danalbert Subscribers: jfb, cfe-commits Differential Revision: http://reviews.llvm.org/D6411 llvm-svn: 222842
* Use lit.util.executeCommand instead of our own versionEric Fiselier2014-11-251-20/+2
| | | | llvm-svn: 222717
* Print lit configuration information after all configuration is done.Eric Fiselier2014-11-241-7/+10
| | | | llvm-svn: 222711
* Add better support for custom test runners.Dan Albert2014-11-241-27/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 222698
* Handle extra whitespace in linux distribution name.Eric Fiselier2014-11-211-4/+5
| | | | llvm-svn: 222514
* Mark some locale tests as XFAIL on debian and opensuse.Eric Fiselier2014-11-213-0/+21
| | | | llvm-svn: 222513
* Add more REQUIRES: LOCALE.* to tests.Dan Albert2014-11-2112-0/+24
| | | | llvm-svn: 222492
* Remove xfail tag for darwin from quick_exit testEric Fiselier2014-11-201-1/+0
| | | | llvm-svn: 222406
* Remove tests that va_copy is not defined when C++ < 11.Eric Fiselier2014-11-202-8/+0
| | | | llvm-svn: 222405
* Change contradictory wording in va_copy test error message.Eric Fiselier2014-11-192-4/+4
| | | | llvm-svn: 222383
* Implement N4280 - 'Non-member size() and more'Marshall Clow2014-11-193-0/+236
| | | | llvm-svn: 222378
* Overhaul and separate nullptr_t tests to pass with C++03.Eric Fiselier2014-11-193-34/+95
| | | | | | | | | | | 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. llvm-svn: 222318
* Revert r222296 to fix bad commit messageEric Fiselier2014-11-193-95/+34
| | | | llvm-svn: 222316
* Cleanup quick_exit tests and get them passing in C++03.Eric Fiselier2014-11-193-2/+53
| | | | | | | | | 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. llvm-svn: 222298
* diff --git a/test/language.support/support.types/nullptr_t.pass.cpp ↵Eric Fiselier2014-11-193-34/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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); +} llvm-svn: 222296
* Modify tests to check that va_copy is only defined in C++11 and beyond.Eric Fiselier2014-11-182-4/+16
| | | | llvm-svn: 222282
* Flush out test cases for tuples constructor SFINAEEric Fiselier2014-11-182-23/+132
| | | | llvm-svn: 222278
* Add support for LLVM_USE_SANITIZER=ThreadEric Fiselier2014-11-181-0/+3
| | | | llvm-svn: 222259
* Add a test for LWG issue #2399. We already implement this, but now we have a ↵Marshall Clow2014-11-181-0/+9
| | | | | | test as well. llvm-svn: 222242
* Since Eric poisoned the comma operator on all our test iterators, we no ↵Marshall Clow2014-11-181-105/+0
| | | | | | longer need 'comma_iterator'. Remove it from the test suite. llvm-svn: 222238
* Fix the tests I broke with the last commit. Sorry for the noiseMarshall Clow2014-11-172-4/+3
| | | | llvm-svn: 222165
* Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and ↵Marshall Clow2014-11-171-0/+8
| | | | | | add tests. Mark LWG2400 and LWG2404 as complete llvm-svn: 222161
* Reworked mismatch tests to count the number of comparisons, and make sure we ↵Marshall Clow2014-11-172-58/+47
| | | | | | are conforming with LWG2404. We are llvm-svn: 222159
* Fix a warning in the test; no functionality changeMarshall Clow2014-11-171-1/+1
| | | | llvm-svn: 222143
* Implement void_t from N3911. Add a private version for use in the library ↵Marshall Clow2014-11-171-0/+69
| | | | | | 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) llvm-svn: 222138
* Add tests to ensure that reference_wrapper<T> is trivially copyable. This ↵Marshall Clow2014-11-171-5/+36
| | | | | | 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. llvm-svn: 222132
* Split thread test into two parts. Mark one as XFAIL with ASAN.Eric Fiselier2014-11-152-22/+75
| | | | | | | | 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. llvm-svn: 222076
* add debug info when compiling sanitizer testsEric Fiselier2014-11-141-1/+1
| | | | llvm-svn: 222051
* [libcxx] Fix memory leak in strstream tests.Eric Fiselier2014-11-148-0/+8
| | | | | | | | | | | | | | Summary: The strstream function `str()` sets `freeze(true)`. When `freeze` is true the destructor is not allowed to free any dynamically allocated memory. The memory leak causes ASAN to fail on these tests. To ensure memory is deallocated `strstream.freeze(false)` is called at the end of the tests. Reviewers: danalbert, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6261 llvm-svn: 222025
* Split string capacity test into two parts and mark one part as UNSUPPORTED ↵Eric Fiselier2014-11-142-12/+54
| | | | | | | | | | | | | | | when using sanitizers. The test is split such that: - max_size.pass.cpp tests that string::resize() fails to allocator for max_size and max_size -1 - over_max_size.pass.cpp tests that string::resize() throws a length error for max_size + 1 The test was split into two because max_size.pass.cpp cannot pass with sanitizers but over_max_size.pass.cpp can. llvm-svn: 221969
* Mark more tests as UNSUPPORTED with ASAN and MSAN.Eric Fiselier2014-11-144-2/+12
| | | | | | | | | | These tests fail for 2 reasons when using ASAN and MSAN. 1. If allocator_may_return_null=0 they will fail because null is returned or an exception is thrown. 2. When allocator_may_return_null=1 the new_handler is still not called. This results in an assertion failures. llvm-svn: 221967
* Setup llvm-symbolizer when running the tests with sanitizersEric Fiselier2014-11-141-0/+14
| | | | llvm-svn: 221966
* Add -O3 when testing with UBSAN. This triggers far undefined behaviourEric Fiselier2014-11-141-1/+1
| | | | llvm-svn: 221964
* Mark more locale tests as unsupported with ASAN and MSANEric Fiselier2014-11-138-0/+8
| | | | llvm-svn: 221937
* Replaced checking in string_view::remove_suffix/remove_prefix by ↵Marshall Clow2014-11-112-10/+4
| | | | | | _LIBCPP_ASSERT, since this is technically undefined behavior. Fixes PR#21496 llvm-svn: 221717
* Added vector<T>::insert tests suggested by code coverage resultsMarshall Clow2014-11-115-0/+130
| | | | llvm-svn: 221689
* EricQWF's code coverage work showed that none of the libc++ tests were ↵Marshall Clow2014-11-114-7/+81
| | | | | | exercising some code in vector<bool>. Add more tests in an attempt to get better coverage llvm-svn: 221644
* Fix rvalue bug in __has_operator_addressofEric Fiselier2014-11-051-1/+14
| | | | llvm-svn: 221398
* Fix operator & detection trait to check for free function overloads as wellEric Fiselier2014-11-051-0/+5
| | | | llvm-svn: 221395
* Mark another test as UNSUPPORTED with ASAN and MSANEric Fiselier2014-11-041-0/+2
| | | | llvm-svn: 221275
* Actually mark the tests an unsupported with MSAN (not just ASAN)Eric Fiselier2014-11-0430-30/+30
| | | | llvm-svn: 221240
OpenPOWER on IntegriCloud