Commit Graph

958 Commits

Author SHA1 Message Date
Eric Fiselier
f6ed0311fb Fix alignment in tests for readability.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 21:00:15 +00:00
Greg Fitzgerald
015fb24be6 Don't assume LIT_EXECUTABLE points to a Python script, take 2
Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable.  If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.

With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable.  You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228005 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 18:47:37 +00:00
Greg Fitzgerald
4668566a60 Revert "Don't assume LIT_EXECUTABLE points to a Python script"
This reverts r227994

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 18:16:47 +00:00
Greg Fitzgerald
35f1c499e4 Don't assume LIT_EXECUTABLE points to a Python script
Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable.  If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.

With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable.  You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 18:02:04 +00:00
Eric Fiselier
cdc7bb55df [libcxx] Add <experimental/system_error>
Summary:
This patch just adds the variable templates in <experimental/system_error>.

see: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#syserror


Reviewers: jroelofs, danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: chandlerc, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227973 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 16:03:24 +00:00
Eric Fiselier
665613f5be [libcxx] Add <experimental/chrono>
Summary:
This patch adds <experimental/chrono> which only contains a single variable template.

See: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#time

Reviewers: jroelofs, danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227860 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02 21:05:47 +00:00
Marshall Clow
a0ec4b7c85 Fix PR#22433. The algorithm is_partitioned was testing an item in the middle of the sequence twice.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02 18:16:35 +00:00
Marshall Clow
4c2684ccf9 Fix PR#22427. The implementation of inplace_merge had a \'small data set\' optimization; if either half of the merge was small (i.e, less than 9 items), it did an inplace merge rather than allocating a buffer and doing a faster/smarter merge. However, this failed to satisfy the complexity requirements in the standard. Remove that code. Add tests to check the complexity, and add the same tests for std::merge, since we are in that section of the test suite anyway.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02 17:35:53 +00:00
Marshall Clow
5e56c30413 Fix for PR22061 by K-ballo
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 22:22:35 +00:00
Marshall Clow
df00d5e5ad We had two identical files named 'MoveOnly.h' in the test suite. Move one to support/, remove the other, and update all the tests that included them. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 21:22:53 +00:00
Marshall Clow
eea9d20edb Removed some tabs that snuck into the test suite. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227363 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 20:26:11 +00:00
Marshall Clow
01c1c6fcc7 Fix PR22366. When move-constructing an associative container and explicitly passing an allocator that compares different, we were not calling the destructor of the elements in the moved-from container.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227359 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 19:54:25 +00:00
Eric Fiselier
a769d7ff49 Fix flag order of -xc++ in CXXCompiler.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 00:05:48 +00:00
Eric Fiselier
db5d6af29b Fix definition of __has_feature in r227263
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 23:05:41 +00:00
Eric Fiselier
a4449da43c Ensure __has_feature is defined in test/support/count_new.hpp
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227263 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 23:03:38 +00:00
Eric Fiselier
e1a6c17251 Fix linking pthread in tests on FreeBSD
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227240 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 20:43:53 +00:00
Nico Weber
a7dcd3a3e1 [libcxx] Make __wrap_iter work with gcc.
he following snippet doesn't build when using gcc and libc++:

    #include <string>
    void f(const std::string& s) { s.begin(); }
    #include <vector>
    void AppendTo(const std::vector<char>& v) { v.begin(); }

The problem is that __wrap_iter has a private constructor. It lists vector<>
and basic_string<> as friends, but gcc seems to ignore this for vector<> for
some reason. Declaring vector before the friend declaration in __wrap_iter is
enough to work around this problem, so do that. With this patch, I'm able to
build chromium/android with libc++. Without it, two translation units fail to
build. (iosfwd already provides a forward declaration of basic_string.)

As far as I can tell, this is due to a gcc bug, which I filed as
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816.

Fixes PR22355.

http://reviews.llvm.org/D7201


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227226 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 19:27:39 +00:00
Marshall Clow
a1bca66d28 Added test for incomplete type support in vector/list/forward_list. References PR#17980
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227131 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 20:06:52 +00:00
Eric Fiselier
bfad86e967 Change the available features used for no-rtti and no-exceptions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 18:11:58 +00:00
Marshall Clow
b9bf4a2185 Fix PR21428. Buffer was one byte too small in octal formatting case. Add test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227097 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 17:24:52 +00:00
Filipe Cabecinhas
447c76d9ee Add USES_TERMINAL to libcxx lit tests, if available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 06:59:51 +00:00
Marshall Clow
3150c3547a Fix PR#22284. Add a new overload to deque::insert to handle forward iterators. Update tests to exercise this case.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 18:33:29 +00:00
Eric Fiselier
dd7a4836e3 [libcxx] Allow use of ShTest in libc++ tests along with other changes.
Summary:
This patch allows the use of LIT's ShTest format in the libc++ test suite. ShTests have the suffix '.sh.cpp'. It also introduces a series of other changes. These changes are:

- More functionality including parsing test metadata has been moved into LIT.
- LibcxxTestFormat now supports multi-part suffixes.
- the `CXXCompiler` functionality has been used to shrink the size of LibcxxTestFormat. 
- The recursive loading of the site config has been turned into `libcxx.test.config.loadSiteConfig` so it can be used with libc++abi.
- Temporary files are now created in the build directory of libc++. This follows how it is down in ShTest.
- `not.py` was added as a utility executable that mirrors the functionality of LLVM's `not` executable. 
- The first ShTest test was added under test/libcxx/double_include.sh.cpp


Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226844 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 18:05:58 +00:00
Jonathan Roelofs
0243015f64 Fix lit config typo
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 00:05:11 +00:00
Eric Fiselier
b3289a0c88 Only use -target flag when target_triple is manually specified
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226615 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 22:37:25 +00:00
Eric Fiselier
e93e0347a6 Print compiler path during configuration and pass more flags to the linker
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226576 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 16:26:48 +00:00
Eric Fiselier
9ef5d45b2c Address danalbert's post-commit review comments on D7019 and small fixes.
This patch addresses some comments on http://reviews.llvm.org/D7019.

- Move compiler.py to test/libcxx from test/libcxx/test.
- Make CXXCompiler.target None by default.
- Use `{}` instead of `dict()` to initialize an empty dict.
- Pass the -fsanitize options to both the compile and link commands.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 16:14:18 +00:00
Marshall Clow
02f6369a6b Cleaning up the test suite; remove some includes of non-standard file <__config>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 19:05:51 +00:00
Eric Fiselier
33f50fb940 A couple small changes to get LIT working with python3
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:59:07 +00:00
Eric Fiselier
28a058bd51 [libcxx] Add compiler utility class for LIT tests
Summary:
This adds a compiler utility class that handles generating compile commands and running them. Instead of having to pass the compiler path and 3 groups of flags between the configuration and the test format this allows us to just pass the compiler object.



Reviewers: danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226323 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:35:08 +00:00
Eric Fiselier
ae8bc6b3ef Add 'no_default_flags' option for turning off all default test compile and link flags.
When 'no_default_flags' is true only flags passed using '--param=compile_flags'
and '--param=link_flags' will be used when compiling the tests. This option
can be used to run the test suite against libstdc++ and helps with all
unusual test suite configurations.

NOTE: sanitizer flags are still added when '--param=use_sanitizer' is used even
if '--param=no_default_flags' is given.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226322 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:22:08 +00:00
Dan Albert
818911cc85 [libc++] Add support for cross compiling.
Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226237 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 00:55:15 +00:00
Jonathan Roelofs
66ffe01f97 Print out environment in lit notes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226223 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:04:37 +00:00
Dan Albert
7df8e62258 Use set() instead of option() for string option.
Fixes issue in r226185.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:56:45 +00:00
Dan Albert
00a620eb3b Add a cmake option for LIT configuration variant.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226185 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:35:04 +00:00
Jonathan Roelofs
88b2a86232 Refactor configure_link_flags for modularity. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226174 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 16:18:13 +00:00
Jonathan Roelofs
583f2e7093 Rename src_root -> libcxx_src_root. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 00:03:14 +00:00
Jonathan Roelofs
33459617e7 Rename system_lib -> system_cxx_lib. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226061 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 23:38:12 +00:00
Jonathan Roelofs
fcd02b85a5 Rename library_root to libcxx_library_root. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226043 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 21:56:50 +00:00
Jonathan Roelofs
fa08adae13 Refactor configure_compile_flags. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226040 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 21:02:14 +00:00
Jonathan Roelofs
7819fd7108 Support picking the unwinder used for testing on linux (just as libc++abi testing allows)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 19:29:04 +00:00
Jonathan Roelofs
6f599cea0e Fix a lit configuration diagnostic. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225985 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 14:48:27 +00:00
Jonathan Roelofs
f1b1b7f8fe Refactor the lit config's linker flag discovery code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225920 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:29:04 +00:00
Marshall Clow
083e011d6c Make regex::assign not clobber the regex in case of failure. Fixes PR#22213
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 16:49:52 +00:00
Eric Fiselier
fe079256b2 Fix vexing parse in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 15:56:41 +00:00
Marshall Clow
141dd0c245 One more #include request in the test suite from Walter Brown
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225609 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-11 18:07:06 +00:00
Marshall Clow
6b913d7c52 Walter Brown sent a list of tests which needed 'additional includes' to match what was in the standard. Added these includes to the tests. No changes to the library or test results.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225541 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 20:25:52 +00:00
Dan Albert
aa66357f48 [libc++] Refactor test components into modules.
Summary:
I've moved the bulk of `lit.cfg` into `test/libcxx/testconfig.py` and
`test/libcxx/testformat.py`. All that remains in `lit.cfg` is the
logic to discover lit.site.cfg if lit.cfg was run directly, and the
logic for loading configuration variants.

The configuration variant flow has changed with this patch. Rather
than instantiating an object of type `<VARIANT>Configuration`, we now
instatiate an object of type `Configuration` that was loaded from the
module `<VARIANT>.testconfig.py`.

This has to be done on a per-project basis rather than in LIT itself
because LIT doesn't actually know where the real test directory is,
only where the site configuration is (which is usually in the output
directory). It's simple enough to do though, so it's fine to require
each project to do it themselves.

I also cleaned up all the pylint issues while I was here, which was
mostly just a matter of fixing long lines.

Reviewers: mclow.lists, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225532 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 18:03:29 +00:00
Marshall Clow
a09f3444e6 In early C++11 standard drafts, std::function derived from std::unary_function or std::binary_function if there was only one (or two) parameters. Before C++11 shipped, this restiction was lifted, but libc++ still does this (which is fine). However, the tests still check for this outdated requiremnt. Change then to check for the nested typedefs instead (which are still required by the standard). No change to the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08 06:36:41 +00:00
Marshall Clow
1fdd937c0a Add checks to make sure the hash functor has the right typedefs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08 06:18:59 +00:00
Marshall Clow
c7e395f338 Missed a typename
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 22:26:48 +00:00
Marshall Clow
674e07d3c8 libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 21:53:23 +00:00
Marshall Clow
87d03942c4 In C++03, a bunch of the arithmetic/logical/comparison functors (such as negate/bit_not.pass/logical_not) were defined as deriving from unary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225402 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 21:51:30 +00:00
Marshall Clow
b15298338c Add tests to check the typedefs from the result of std::owner_less
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 20:54:51 +00:00
Marshall Clow
58d4e04168 Missed one comparison test in r225375
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225376 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 20:40:28 +00:00
Marshall Clow
27a1a2c84a In C++03, a bunch of the arithmetic/logical/comparison functors (such as add/equal_to/logical_or) were defined as deriving from binary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 20:31:06 +00:00
Dan Albert
0588c74a87 Move a test to the new tests directory.
I had written the patch that added this test before the tests were
moved into tests/std, so the test ended up in the wrong directory.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225300 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 22:18:27 +00:00
Dan Albert
21b03d7189 Make a test UNSUPPORTED if libcpp-has-no-threads.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 19:32:30 +00:00
Dan Albert
8f1ac0fb3d Appease MSAN buildbots.
This is just a compile time test, but we have MSAN buildbots that will
fail since `exp` was uninitialized.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225286 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 19:23:25 +00:00
Marshall Clow
fd8ed7fa85 Fix PR 22106; make std::swap work for multi-dimensional arrays. Thanks to Peter Griess for the report and suggested fix
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 19:20:49 +00:00
Dan Albert
c101738156 Obey [atomics.types.operations.req]/21 for GCC.
Summary:
Excerpt from [atomics.types.operations.req]/21:

> When only one memory_order argument is supplied, the value of
> success is order, and the value of failure is order except that a
> value of memory_order_acq_rel shall be replaced by the value
> memory_order_acquire and a value of memory_order_release shall be
> replaced by the value memory_order_relaxed.

Clean up some copy pasta while I'm here (someone added a return
statement to a void function).

Reviewers: EricWF, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225280 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 18:39:37 +00:00
Eric Fiselier
60b3df404e Prevent ill-formed instantiation of __invoke_of<...> during the evaluation of a bind expression. Fixes PR22003.
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.

Bug reportand patch from Michel Morin.

http://llvm.org/bugs/show_bug.cgi?id=22003


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224753 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 05:54:34 +00:00
Marshall Clow
e26488fd83 Remove non-const test to get test passing. Will come back later and (correctly) add non-const tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224748 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 01:30:39 +00:00
Eric Fiselier
4eb5b6d5ee [libcxx] Consolidate new/delete replacement in tests and disable it when using sanitizers.
Summary:
MSAN and ASAN also replace new/delete which leads to a link error in these tests. Currently they are unsupported but I think it would be useful if these tests could run with sanitizers.

This patch creates a support header that consolidates the new/delete replacement functionality and checking.
When we are using sanitizers new and delete are no longer replaced and the checks always return true.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224741 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 22:38:59 +00:00
Eric Fiselier
71dc14e864 [libcxx] Add numerous options to libc++ LIT test suite configuration.
Summary:
In order to fully replace the testit script we need to update LIT so it provides the same functionality.
This patch adds a number of different configuration options to LIT to do that. It also adds documentation for all of the command line parameters that LIT supports.

Generic options added:
- `libcxx_headers`
- `libcxx_library`
- `compile_flags`


Generic options modified:
- `link_flags`: Changed from overriding the default args to adding extra args instead (to match compile flags)
- `use_sanitizer`: Renamed from `llvm_use_sanitizer`


Please see the added documentation for more information about the switches. As for the actual documentation I'm not sure if it should be kept in libc++ forever since it adds an undue maintenance burden, but I think it should be added for the time being while the changes are new. I'm verify unskilled with HTML so if the documentation needs any changes please let me know.

Hopefully this will kill testit.



Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: alexfh, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224728 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 20:49:45 +00:00
Eric Fiselier
814b625303 Move unconditional test compile and link flags into their configuration functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224674 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 04:14:14 +00:00
Eric Fiselier
4778eed34f [libcxx] Teach libcxx's lit configuration new ways to find lit.site.cfg
Summary:
Currently to run tests in tree you need to symlink the lit.site.cfg file generated by the cmake build into the source tree, and teach your VCS to ignore it.

This allows the user to specify where to find the lit.site.cfg file two different ways:
* lit_site_config lit parameter
* LIT_SITE_CONFIG enviroment variable. 

example usage:
```
lit -sv --param=libcxx_site_config=path/to/libcxx-build/test/lit.site.cfg path/to/tests
```
Or
```
export LIBCXX_SITE_CONFIG=path/to/libcxx-build/test/lit.site.cfg
lit -sv path/to/tests
```
The command line parameter will override the environment variable. 
If neither options are present a warning is issued and the `lit.cfg` file is loaded directly. 


Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: ddunbar, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224671 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 03:16:55 +00:00
Eric Fiselier
a90c6dd460 Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 01:40:03 +00:00
Eric Fiselier
669a8a5a19 [libcxx] Add <experimental/type_traits> for LFTS
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
2014-12-19 22:21:44 +00:00
Eric Fiselier
bd8adae47f Remove unneeded configuration code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224618 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 21:42:17 +00:00
Eric Fiselier
b8e76804f1 [libcxx] Allow the use of ccache when running the test suite.
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
2014-12-19 19:27:32 +00:00
Marshall Clow
4975bad299 Re-commit the test for regex that I busted last night - now passes under ASAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224342 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 16:22:43 +00:00
Jonathan Roelofs
7797c867d3 Appease the c++14 buildbots
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224304 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 01:18:11 +00:00
Marshall Clow
a1a4db3fe5 Comment out the breaking tests until I figure out what's going on here.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224301 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 00:59:59 +00:00
Marshall Clow
e51267e2d1 Once more w/o the typo.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224298 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 00:46:23 +00:00
Marshall Clow
cde7ca0a97 Fix the literal string that I said would be six elements long to actually be six elements long. Octal. Sheesh.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224297 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 00:45:47 +00:00
Marshall Clow
ab3c50593c Add test to ensure that iterator_traits<NotAnIterator> doesn't have a value type
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 00:30:07 +00:00
Marshall Clow
e3e7054f48 Implement LWG 2217 - operator==(sub_match, string) slices on embedded '\0's
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224292 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 23:57:56 +00:00
Eric Fiselier
ae9fec0bdf Add support for building libc++ as a 32 bit library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224096 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 03:12:18 +00:00
Eric Fiselier
01f6a1410c Fix building and running tests when LIBCXX_ENABLE_EXCEPTIONS or LIBCXX_ENABLE_RTTI are turned off.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224095 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 02:36:23 +00:00
Jonathan Roelofs
08e3a7887f Add 'REQUIRES: long_tests' to one more long test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224069 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 22:27:49 +00:00
Jonathan Roelofs
5030eaf65d Add 'REQUIERS: long_tests' to a few more long tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224064 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 22:05:18 +00:00
Jonathan Roelofs
2f2daa1436 Fix platform_support.h's get_temp_file_name() on Newlib under __STRICT_ANSI__
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224057 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 20:56:40 +00:00
Jonathan Roelofs
cddec8a9dd Add an XFAIL for Newlib's missing uchar.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224037 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 19:11:39 +00:00
Jonathan Roelofs
d9144e8d17 Mark a bunch of long running tests as 'REQUIRES: long_tests'
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
2014-12-11 18:35:36 +00:00
Jonathan Roelofs
952438bf70 Mark some more fenv tests as UNSUPPORTED by newlib
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224024 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 16:17:26 +00:00
Jonathan Roelofs
f2bd5a0fe1 Add an XFAIL for Newlib's missing fenv.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224021 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 15:37:22 +00:00
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
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
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
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
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
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
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
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
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
50ada3a8f7 [libcxx] Fix memory leak in strstream tests.
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222025 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 19:10:43 +00:00
Eric Fiselier
1c3b15d339 Split string capacity test into two parts and mark one part as UNSUPPORTED 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 03:16:12 +00:00
Eric Fiselier
71915c132a Mark more tests as UNSUPPORTED with ASAN and MSAN.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221967 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 02:55:16 +00:00
Eric Fiselier
44678f4058 Setup llvm-symbolizer when running the tests with sanitizers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221966 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 02:47:08 +00:00
Eric Fiselier
05123a8d9f Add -O3 when testing with UBSAN. This triggers far undefined behaviour
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221964 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 02:07:52 +00:00
Eric Fiselier
2138b18080 Mark more locale tests as unsupported with ASAN and MSAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221937 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 22:45:23 +00:00
Marshall Clow
1cf810b81b Replaced checking in string_view::remove_suffix/remove_prefix by _LIBCPP_ASSERT, since this is technically undefined behavior. Fixes PR#21496
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 22:07:10 +00:00
Marshall Clow
ac23805464 Added vector<T>::insert tests suggested by code coverage results
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221689 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 16:44:05 +00:00
Marshall Clow
3f305aefa0 EricQWF's code coverage work showed that none of the libc++ tests were exercising some code in vector<bool>. Add more tests in an attempt to get better coverage
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221644 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 00:16:30 +00:00
Eric Fiselier
b6e0ef2deb Fix rvalue bug in __has_operator_addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221398 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 21:20:10 +00:00
Eric Fiselier
341b59021c Fix operator & detection trait to check for free function overloads as well
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221395 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 20:59:18 +00:00
Eric Fiselier
69697c8506 Mark another test as UNSUPPORTED with ASAN and MSAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221275 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 17:03:47 +00:00
Eric Fiselier
829a84308e Actually mark the tests an unsupported with MSAN (not just ASAN)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221240 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 05:36:15 +00:00
Eric Fiselier
72aab5f478 Mark tests that replace operator new/delete as UNSUPPORTED with ASAN and MSAN.
tests that replace operator new/delete won't link when using ASAN and MSAN 
because these sanitizers also replace new/delete.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221236 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 05:11:41 +00:00
Eric Fiselier
1de15f518f Add test for type properties of std::reference_wrapper
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221224 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 01:54:44 +00:00
Marshall Clow
26aa8c9254 Mark string_view::to_string as const. Fixes PR21428
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-02 15:35:32 +00:00
Eric Fiselier
a01a62391c Fix example in documentation of target triple sanitization.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220804 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28 18:03:38 +00:00
Eric Fiselier
522aaf67ea [libcxx] Delay evaluation of __make_tuple_types to prevent blowing the max template instantiation depth. Fixes Bug #18345
Summary:
http://llvm.org/bugs/show_bug.cgi?id=18345

Tuple's constructor and assignment operators for "tuple-like" types evaluates __make_tuple_types unnecessarily. In the case of a large array this can blow the template instantiation depth.

Ex:
```
#include <array>
#include <tuple>
#include <memory>
 
typedef std::array<int, 1256> array_t;
typedef std::tuple<array_t> tuple_t;

int main() {
  array_t a;
  tuple_t t(a); // broken
  t = a; // broken

  // make_shared uses tuple behind the scenes. This bug breaks this code.
  std::make_shared<array_t>(a);
}
```

To prevent this from happening we delay the instantiation of `__make_tuple_types` until after we perform the length check. Currently `__make_tuple_types` is instantiated at the same time that the length check .


Test Plan: Two tests have been added. One for the "tuple-like" constructors and another for the "tuple-like" assignment operator. 

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: K-ballo, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220769 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28 06:31:22 +00:00
Jonathan Roelofs
cf85245c08 Test that the single-threaded lit feature is available iff the corresponding guard is #defined
http://reviews.llvm.org/D6006


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220729 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 22:39:19 +00:00
Eric Fiselier
2b0f03a2a7 Add special case handling of linux target triples that do not contain -gnu.
For targets that end it `redhat-linux` and `suse-linux` manually add the `-gnu`
section of the target since `linux-gnu` is needed in the testsuite.

This patch also moves the removal of minor and patchlevel numbers from OSX
triples to be handled when deducing the triple instead of when adding available
features.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220724 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 22:14:25 +00:00
Eric Fiselier
4889a16c9f Add test to ensure including <atomic> fails when _LIBCPP_HAS_NO_THREADS is defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220722 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 21:38:23 +00:00
Eric Fiselier
62a0e01343 Fix use of operator comma in is_permutation and delete comma operator for test iterators.
The comma operators in the test iterators give better error messages when they
are deleted as opposed to not defined. Delete these functions when possible.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220715 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 20:26:25 +00:00
Eric Fiselier
e4e883e6c8 [libcxx] Remove use of uniform initialization from regex tests so that they compile in C++03.
Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220707 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 19:29:32 +00:00
Eric Fiselier
b991975439 [libcxx] Fix use of operator comma where the types can be user defined
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220706 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 19:28:20 +00:00