summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Move test into test/std subdirectory.Eric Fiselier2014-12-204817-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Add <experimental/type_traits> for LFTSEric Fiselier2014-12-197-0/+945
| | | | | | | | | | | | | | | | Summary: This adds the <experimental/type_traits> (minus invocation traits). Mostly just the `_v` traits. Reviewers: K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5742 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224626 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unneeded configuration code.Eric Fiselier2014-12-191-12/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224618 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Allow the use of ccache when running the test suite.Eric Fiselier2014-12-191-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to get the bots running quicker I would like to be able to use ccache with the test suite. This patch adds support for running the test suite using ccache. To use ccache pass `--param=use_ccache=true` when running the test suite. ccache will not cache any command that invokes ld, so the build step needs to be split into two separate compile commands. The cost of splitting the build step into two parts when not using ccache seems to be minimal. On my machine I saw a difference of ~5 seconds on a 5 minute test suite run. A full test suite run with ccache generates about 250MB of cached data. I recorded the following times for running the test suite in the following configurations: - no ccache: 340s - initial ccache run: 380s - rerun with ccache (no changes): 53s. - rerun with ccache (<string> changed): 80s - rerun with ccache (<cmath> changed): 169s - rerun with ccache (<valarray> changed): 69s Reviewers: mclow.lists, jroelofs, danalbert Reviewed By: jroelofs Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6647 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224603 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-commit the test for regex that I busted last night - now passes under ASANMarshall Clow2014-12-161-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224342 91177308-0d34-0410-b5e6-96231b3b80d8
* Appease the c++14 buildbotsJonathan Roelofs2014-12-161-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224304 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment out the breaking tests until I figure out what's going on here.Marshall Clow2014-12-161-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224301 91177308-0d34-0410-b5e6-96231b3b80d8
* Once more w/o the typo.Marshall Clow2014-12-161-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224298 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the literal string that I said would be six elements long to actually be ↵Marshall Clow2014-12-161-2/+2
| | | | | | six elements long. Octal. Sheesh. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224297 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test to ensure that iterator_traits<NotAnIterator> doesn't have a value typeMarshall Clow2014-12-161-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224295 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG 2217 - operator==(sub_match, string) slices on embedded '\0'sMarshall Clow2014-12-151-13/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224292 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for building libc++ as a 32 bit libraryEric Fiselier2014-12-123-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224096 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix building and running tests when LIBCXX_ENABLE_EXCEPTIONS or ↵Eric Fiselier2014-12-123-0/+15
| | | | | | LIBCXX_ENABLE_RTTI are turned off. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224095 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'REQUIRES: long_tests' to one more long testJonathan Roelofs2014-12-111-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224069 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'REQUIERS: long_tests' to a few more long testsJonathan Roelofs2014-12-114-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224064 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix platform_support.h's get_temp_file_name() on Newlib under __STRICT_ANSI__Jonathan Roelofs2014-12-111-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224057 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an XFAIL for Newlib's missing uchar.hJonathan Roelofs2014-12-111-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224037 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark a bunch of long running tests as 'REQUIRES: long_tests'Jonathan Roelofs2014-12-1138-0/+86
| | | | | | | This lets us skip them as UNSUPPORTED on slow systems like QEMU git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224032 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark some more fenv tests as UNSUPPORTED by newlibJonathan Roelofs2014-12-112-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224024 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an XFAIL for Newlib's missing fenv.hJonathan Roelofs2014-12-111-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224021 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the optional tests into test/experimental. They were put into ↵Marshall Clow2014-12-0968-0/+6
| | | | | | 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
* Add all the relational operators to std::experimental::optional. Also update ↵Marshall Clow2014-12-0922-159/+742
| | | | | | 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
* Give lit.cfg's threading options default values when not defined.Eric Fiselier2014-12-071-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223601 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark a couple of tests as XFAIL with older compilers.Eric Fiselier2014-12-072-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223600 91177308-0d34-0410-b5e6-96231b3b80d8
* Consolidate error reporting in lit.cfgEric Fiselier2014-12-071-36/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223599 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert parts of r223594. Use DYLD_LIBRARY_PATH on OSX when running tests.Eric Fiselier2014-12-071-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223598 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix apple clang detection in lit.cfgEric Fiselier2014-12-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223597 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify and cleanup rpath handling in tests.Eric Fiselier2014-12-061-10/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223594 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223593 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223591 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222842 91177308-0d34-0410-b5e6-96231b3b80d8
* Use lit.util.executeCommand instead of our own versionEric Fiselier2014-11-251-20/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222717 91177308-0d34-0410-b5e6-96231b3b80d8
* Print lit configuration information after all configuration is done.Eric Fiselier2014-11-241-7/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222711 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222698 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle extra whitespace in linux distribution name.Eric Fiselier2014-11-211-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222514 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark some locale tests as XFAIL on debian and opensuse.Eric Fiselier2014-11-213-0/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222513 91177308-0d34-0410-b5e6-96231b3b80d8
* Add more REQUIRES: LOCALE.* to tests.Dan Albert2014-11-2112-0/+24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222492 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove xfail tag for darwin from quick_exit testEric Fiselier2014-11-201-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222406 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tests that va_copy is not defined when C++ < 11.Eric Fiselier2014-11-202-8/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222405 91177308-0d34-0410-b5e6-96231b3b80d8
* Change contradictory wording in va_copy test error message.Eric Fiselier2014-11-192-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222383 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement N4280 - 'Non-member size() and more'Marshall Clow2014-11-193-0/+236
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222378 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222318 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r222296 to fix bad commit messageEric Fiselier2014-11-193-95/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222316 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222298 91177308-0d34-0410-b5e6-96231b3b80d8
* 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); +} git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222296 91177308-0d34-0410-b5e6-96231b3b80d8
* Modify tests to check that va_copy is only defined in C++11 and beyond.Eric Fiselier2014-11-182-4/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222282 91177308-0d34-0410-b5e6-96231b3b80d8
* Flush out test cases for tuples constructor SFINAEEric Fiselier2014-11-182-23/+132
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222278 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for LLVM_USE_SANITIZER=ThreadEric Fiselier2014-11-181-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222259 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222242 91177308-0d34-0410-b5e6-96231b3b80d8