Commit Graph

877 Commits

Author SHA1 Message Date
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